From c376f4ca51b55db4dff8d5aa50b7a847870e41f5 Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Tue, 3 Mar 2020 00:35:41 +0100 Subject: [PATCH 1/3] Register Serilog logging services correctly --- Emby.Server.Implementations/ApplicationHost.cs | 5 ++--- Jellyfin.Server/Program.cs | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 8ea188724a..1e7bbd7047 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -672,9 +672,8 @@ namespace Emby.Server.Implementations serviceCollection.AddSingleton(JsonSerializer); - serviceCollection.AddSingleton(LoggerFactory); - serviceCollection.AddLogging(); - serviceCollection.AddSingleton(Logger); + // TODO: Support for injecting ILogger should be deprecated in favour of ILogger and this removed + serviceCollection.AddSingleton(_logger); serviceCollection.AddSingleton(FileSystemManager); serviceCollection.AddSingleton(); diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 1dd598236b..484e507a23 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -26,6 +26,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Serilog; +using Serilog.Events; using Serilog.Extensions.Logging; using SQLitePCL; using ILogger = Microsoft.Extensions.Logging.ILogger; @@ -260,6 +261,7 @@ namespace Jellyfin.Server } } }) + .UseSerilog() .UseContentRoot(appHost.ContentRoot) .ConfigureServices(services => { From 9a6c27947353585391e211aa88b925f81e8cd7b9 Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Tue, 3 Mar 2020 00:36:54 +0100 Subject: [PATCH 2/3] Increase min log level to 'Warning' framework namespaces --- Jellyfin.Server/Resources/Configuration/logging.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Jellyfin.Server/Resources/Configuration/logging.json b/Jellyfin.Server/Resources/Configuration/logging.json index acbca8b856..f64a85219d 100644 --- a/Jellyfin.Server/Resources/Configuration/logging.json +++ b/Jellyfin.Server/Resources/Configuration/logging.json @@ -1,6 +1,12 @@ { "Serilog": { - "MinimumLevel": "Information", + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Warning", + "System": "Warning" + } + }, "WriteTo": [ { "Name": "Console", From a4bf645ba5f878f23ce2ba916121fddd6b981968 Mon Sep 17 00:00:00 2001 From: Mark Monteiro Date: Tue, 3 Mar 2020 01:10:26 +0100 Subject: [PATCH 3/3] Fix compilation error --- Emby.Server.Implementations/ApplicationHost.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 1e7bbd7047..679ef4851e 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -673,7 +673,7 @@ namespace Emby.Server.Implementations serviceCollection.AddSingleton(JsonSerializer); // TODO: Support for injecting ILogger should be deprecated in favour of ILogger and this removed - serviceCollection.AddSingleton(_logger); + serviceCollection.AddSingleton(Logger); serviceCollection.AddSingleton(FileSystemManager); serviceCollection.AddSingleton();