重构代码:异常模块增加异常类型显示
This commit is contained in:
parent
d86fe3e7b7
commit
43796875af
|
@ -15,7 +15,8 @@
|
|||
{ title: "请求网址", field: "ErrorPage", sortable: true },
|
||||
{ title: "用户名", field: "UserId", sortable: true },
|
||||
{ title: "IP", field: "UserIp", sortable: true },
|
||||
{ title: "错误", field: "Message", sortable: false },
|
||||
{ title: "异常类型", field: "ExceptionType", sortable: false },
|
||||
{ title: "异常描述", field: "Message", sortable: false },
|
||||
{ title: "记录时间", field: "LogTime", sortable: true }
|
||||
]
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public static void Log(Exception ex, NameValueCollection additionalInfo)
|
||||
{
|
||||
var errorPage = additionalInfo["ErrorPage"] ?? (ex.Message.Length > 50 ? ex.Message.Substring(0, 50) : ex.Message);
|
||||
var errorPage = additionalInfo["ErrorPage"] ?? (nameof(ex).Length > 50 ? nameof(ex).Substring(0, 50) : nameof(ex));
|
||||
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.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue