From b2b69bb771d672fa197e60ef21f0a58a344e2cb5 Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Tue, 23 Oct 2018 13:50:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG=EF=BC=9AExceptions.Log?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=86=85=E9=83=A8ErrorPage=E4=BD=BF=E7=94=A8?= =?UTF-8?q?nameof(ex)=E5=AF=BC=E8=87=B4=E7=BB=93=E6=9E=9C=E4=B8=BAex?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.DataAccess.SQLite/Exceptions.cs | 2 +- Bootstrap.DataAccess/Exceptions.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Bootstrap.DataAccess.SQLite/Exceptions.cs b/Bootstrap.DataAccess.SQLite/Exceptions.cs index f78ec8a7..b7deceba 100644 --- a/Bootstrap.DataAccess.SQLite/Exceptions.cs +++ b/Bootstrap.DataAccess.SQLite/Exceptions.cs @@ -44,7 +44,7 @@ namespace Bootstrap.DataAccess.SQLite ["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'))"; using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql)) { diff --git a/Bootstrap.DataAccess/Exceptions.cs b/Bootstrap.DataAccess/Exceptions.cs index 9d2654ca..477d23c8 100644 --- a/Bootstrap.DataAccess/Exceptions.cs +++ b/Bootstrap.DataAccess/Exceptions.cs @@ -85,7 +85,7 @@ namespace Bootstrap.DataAccess ["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())"; using (DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql)) {