铭轩同学

铭轩,为自己代言!

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Web;

namespace Common
{
    public class LogHelper : System.Web.UI.Page
    {
        private static HttpContext myContext = HttpContext.Current;
        /// <summary>
        /// 写日志
        /// </summary>
        /// <param name="Path"></param>
        /// <param name="InfoStr"></param>
        public static void WriteLog(string InfoStr)
        {
            System.IO.StreamWriter sw = new System.IO.StreamWriter(myContext.Server.MapPath("/log/cps_log" + DateTime.Now.ToString("yyyyMMdd") + ".txt"), true, System.Text.Encoding.UTF8);
            sw.WriteLine(DateTime.Now);
            sw.WriteLine(InfoStr);
            sw.WriteLine("");
            sw.Close();
            sw.Dispose();
        }
    }
}

  

posted on 2014-05-28 16:02  铭轩同学  阅读(485)  评论(0编辑  收藏  举报