修改BUG:数据库记录异常日志后清除异常缓存,异常日志Exceptions表结构变更

This commit is contained in:
Argo-Lenovo 2017-04-06 13:28:25 +08:00
parent a4e97ce5cb
commit 6ab660724c
3 changed files with 11 additions and 6 deletions

View File

@ -1,4 +1,5 @@
using Bootstrap.DataAccess;
using Longbow.Caching;
using Longbow.ExceptionManagement;
using Longbow.ExceptionManagement.Configuration;
using System;
@ -21,6 +22,7 @@ namespace Bootstrap.Admin
{
if (publisherElement.Mode == PublisherMode.Off) return;
ExceptionHelper.Log(ex, additionalInfo);
CacheManager.Clear(k => k == ExceptionHelper.RetrieveExceptionsDataKey);
}
}
}

View File

@ -14,7 +14,10 @@ namespace Bootstrap.DataAccess
/// </summary>
public static class ExceptionHelper
{
internal const string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions";
/// <summary>
///
/// </summary>
public static readonly string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions";
/// <summary>
///
/// </summary>
@ -32,7 +35,7 @@ namespace Bootstrap.DataAccess
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@AppDomainName", AppDomain.CurrentDomain.FriendlyName));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ErrorPage", additionalInfo["ErrorPage"]));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserID", DBAccess.ToDBValue(additionalInfo["UserId"])));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserIp", additionalInfo["UserIp"]));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@UserIp", DBAccess.ToDBValue(additionalInfo["UserIp"])));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ExceptionType", ex.GetType().FullName));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@Message", ex.Message));
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@StackTrace", DBAccess.ToDBValue(ex.StackTrace), ParameterDirection.Input));
@ -68,8 +71,8 @@ namespace Bootstrap.DataAccess
Id = (int)reader[0],
AppDomainName = (string)reader[1],
ErrorPage = (string)reader[2],
UserId = (string)reader[3],
UserIp = (string)reader[4],
UserId = reader.IsDBNull(3) ? string.Empty : (string)reader[3],
UserIp = reader.IsDBNull(4) ? string.Empty : (string)reader[4],
ExceptionType = (string)reader[5],
Message = (string)reader[6],
StackTrace = (string)reader[7],

View File

@ -258,8 +258,8 @@ CREATE TABLE [dbo].[Exceptions](
[ID] [int] IDENTITY(1,1) NOT NULL,
[AppDomainName] [varchar](50) NOT NULL,
[ErrorPage] [varchar](50) NOT NULL,
[UserID] [varchar](50) NOT NULL,
[UserIp] [varchar](15) NOT NULL,
[UserID] [varchar](50) NULL,
[UserIp] [varchar](15) NULL,
[ExceptionType] [nvarchar](max) NOT NULL,
[Message] [nvarchar](max) NOT NULL,
[StackTrace] [nvarchar](max) NULL,