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();