diff --git a/AuthoringTool/Startup.cs b/AuthoringTool/Startup.cs index 68762a140..af4b2e884 100644 --- a/AuthoringTool/Startup.cs +++ b/AuthoringTool/Startup.cs @@ -39,6 +39,7 @@ using Presentation.PresentationLogic.MyLearningWorlds; using Presentation.PresentationLogic.SelectedViewModels; using Serilog; +using Serilog.Settings.Configuration; using Serilog.Sinks.SystemConsole.Themes; using Shared; using Shared.Configuration; @@ -75,13 +76,23 @@ public void ConfigureServices(IServiceCollection services) var logFileName = Environment.IsDevelopment() ? "log-dev.txt" : "log.txt"; var logFilePath = Path.Combine(ApplicationPaths.LogsFolder, logFileName); - Log.Logger = new LoggerConfiguration() - .ReadFrom.Configuration(Configuration) - .Enrich.FromLogContext() - .WriteTo.Console(theme: AnsiConsoleTheme.Code) - .WriteTo.File(path: logFilePath, buffered: false, rollOnFileSizeLimit: true, fileSizeLimitBytes: 100000000, - retainedFileCountLimit: 5) - .CreateLogger(); + try + { + var options = new ConfigurationReaderOptions(typeof(ConsoleLoggerExtensions).Assembly); + var loggerConfig = new LoggerConfiguration(); + loggerConfig.ReadFrom.Configuration(Configuration, options) + .Enrich.FromLogContext() + .WriteTo.Console(theme: AnsiConsoleTheme.Code) + .WriteTo.File(path: logFilePath, buffered: false, rollOnFileSizeLimit: true, + fileSizeLimitBytes: 100000000, + retainedFileCountLimit: 5); + Log.Logger = loggerConfig.CreateLogger(); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } services.AddLogging(builder => { diff --git a/AuthoringTool/appsettings.json b/AuthoringTool/appsettings.json index 3641d1e2b..8dcc4b21e 100644 --- a/AuthoringTool/appsettings.json +++ b/AuthoringTool/appsettings.json @@ -1,7 +1,7 @@ { "Serilog": { "MinimumLevel": { - "Default": "Trace", + "Default": "Verbose", "Override": { "Microsoft": "Warning", "Microsoft.AspNetCore": "Warning",