From c7c6c10937fdb6c6a7f7b68fd75aed90a64e69b4 Mon Sep 17 00:00:00 2001 From: liuwf Date: Tue, 5 Nov 2024 17:05:23 +0800 Subject: [PATCH] =?UTF-8?q?fix-=E6=97=A5=E5=BF=97=E6=8C=89=E5=A4=A9?= =?UTF-8?q?=E5=88=86=E5=89=B2=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.Serilog/SerilogExtensions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SlnMesnac.Serilog/SerilogExtensions.cs b/SlnMesnac.Serilog/SerilogExtensions.cs index f9e5128..23b2522 100644 --- a/SlnMesnac.Serilog/SerilogExtensions.cs +++ b/SlnMesnac.Serilog/SerilogExtensions.cs @@ -44,15 +44,15 @@ namespace SlnMesnac.Serilog app.UseSerilogRequestLogging(); #region 通过配置文件读取日志存放位置 - var appConfig = app.ApplicationServices.GetService(); + // var appConfig = app.ApplicationServices.GetService(); // var logPath = $"{appConfig.logPath}/Logs/{DateTime.UtcNow:yyyy-MM-dd}/"; var logPath = $"{currentDirectory}/Logs/{DateTime.UtcNow:yyyy-MM-dd}/"; #endregion Log.Logger = new LoggerConfiguration().MinimumLevel.Information().WriteTo.Console() - .WriteTo.File(Path.Combine(logPath, "Info.log"), LogEventLevel.Information) - .WriteTo.File(Path.Combine(logPath, "Error.log"), LogEventLevel.Error) - .WriteTo.File(Path.Combine(logPath, "Warn.log"), LogEventLevel.Warning) + .WriteTo.File(Path.Combine(logPath, "Info.log"), LogEventLevel.Information, rollingInterval: RollingInterval.Day) + .WriteTo.File(Path.Combine(logPath, "Error.log"), LogEventLevel.Error, rollingInterval: RollingInterval.Day) + .WriteTo.File(Path.Combine(logPath, "Warn.log"), LogEventLevel.Warning, rollingInterval: RollingInterval.Day) //.WriteTo.File(Path.Combine(logPath, "Debug.log"), LogEventLevel.Debug, fileSizeLimitBytes: 5 * 1024) .CreateLogger(); app.UseSerilogRequestLogging();