修改BUG:Exceptions.Log方法内部ErrorPage使用nameof(ex)导致结果为ex字符串

This commit is contained in:
Argo-MacBookPro 2018-10-23 13:50:21 +08:00
parent 8dd9c3e773
commit b2b69bb771
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ namespace Bootstrap.DataAccess.SQLite
["ErrorPage"] = null ["ErrorPage"] = null
}; };
} }
var errorPage = additionalInfo["ErrorPage"] ?? (nameof(ex).Length > 50 ? nameof(ex).Substring(0, 50) : nameof(ex)); var errorPage = additionalInfo["ErrorPage"] ?? ex.GetType().Name;
var sql = "insert into Exceptions (AppDomainName, ErrorPage, UserID, UserIp, ExceptionType, Message, StackTrace, LogTime) values (@AppDomainName, @ErrorPage, @UserID, @UserIp, @ExceptionType, @Message, @StackTrace, datetime('now', 'localtime'))"; var sql = "insert into Exceptions (AppDomainName, ErrorPage, UserID, UserIp, ExceptionType, Message, StackTrace, LogTime) values (@AppDomainName, @ErrorPage, @UserID, @UserIp, @ExceptionType, @Message, @StackTrace, datetime('now', 'localtime'))";
using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql)) using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql))
{ {

View File

@ -85,7 +85,7 @@ namespace Bootstrap.DataAccess
["ErrorPage"] = null ["ErrorPage"] = null
}; };
} }
var errorPage = additionalInfo["ErrorPage"] ?? (nameof(ex).Length > 50 ? nameof(ex).Substring(0, 50) : nameof(ex)); var errorPage = additionalInfo["ErrorPage"] ?? (ex.GetType().Name.Length > 50 ? ex.GetType().Name.Substring(0, 50) : ex.GetType().Name);
var sql = "insert into Exceptions (AppDomainName, ErrorPage, UserID, UserIp, ExceptionType, Message, StackTrace, LogTime) values (@AppDomainName, @ErrorPage, @UserID, @UserIp, @ExceptionType, @Message, @StackTrace, GetDate())"; var sql = "insert into Exceptions (AppDomainName, ErrorPage, UserID, UserIp, ExceptionType, Message, StackTrace, LogTime) values (@AppDomainName, @ErrorPage, @UserID, @UserIp, @ExceptionType, @Message, @StackTrace, GetDate())";
using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql)) using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql))
{ {