提交 ad3f1d94 编写于 作者: Jason_WangG's avatar Jason_WangG

修改日志记录格式

上级 7ce32f1e
......@@ -24,7 +24,9 @@ namespace Mozi.HttpEmbedded.Common
dir.Create();
}
StreamWriter sw = new StreamWriter(LogDir + name + "_" + DateTime.Now.ToString("yyyyMMdd") + ".log", true);
sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " "+Enum.GetName(typeof(LogLevel),level)+" | " + info);
string loginfo = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " "+Enum.GetName(typeof(LogLevel),level)+" | " + info;
sw.WriteLine(loginfo);
Console.WriteLine(loginfo);
sw.Flush();
sw.Close();
}
......
using System;
using Mozi.HttpEmbedded.Auth;
using Mozi.HttpEmbedded.Common;
using Mozi.HttpEmbedded.Compress;
using Mozi.HttpEmbedded.Page;
using Mozi.HttpEmbedded.Source;
......@@ -115,6 +116,7 @@ namespace Mozi.HttpEmbedded
catch (Exception ex)
{
sc = StatusCode.InternalServerError;
Log.Save(ex.Message+":"+ex.StackTrace??"");
}
finally
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册