diff --git a/24Hour/Filter/RequestLoggingFilter.cs b/24Hour/Filter/RequestLoggingFilter.cs index 8576d56..4af50e1 100644 --- a/24Hour/Filter/RequestLoggingFilter.cs +++ b/24Hour/Filter/RequestLoggingFilter.cs @@ -10,10 +10,12 @@ namespace _24Hour.Filter private Stopwatch _stopwatch;//统计程序耗时 public RequestLoggingFilter(ILogger logger) { + + this.logger = logger; _stopwatch = Stopwatch.StartNew(); } - public void OnActionExecuted(ActionExecutedContext context) + public async void OnActionExecuted(ActionExecutedContext context) { _stopwatch.Stop(); var request = context.HttpContext.Request; @@ -27,13 +29,13 @@ namespace _24Hour.Filter } public void OnActionExecuting(ActionExecutingContext context) { - var request = context.HttpContext.Request; - var info = $"Start request method:[{request?.Method}] path:[{request?.Path}]"; - if (info.Length > 1024) - { - info = info.Substring(0, 1024); - } - logger.LogInformation(info); + //var request = context.HttpContext.Request; + //var info = $"Start request method:[{request?.Method}] path:[{request?.Path}]"; + //if (info.Length > 1024) + //{ + // info = info.Substring(0, 1024); + //} + //logger.LogInformation(info); } } }