Browse Source

Register Serilog logging services correctly

Mark Monteiro 5 years ago
parent
commit
c376f4ca51
2 changed files with 4 additions and 3 deletions
  1. 2 3
      Emby.Server.Implementations/ApplicationHost.cs
  2. 2 0
      Jellyfin.Server/Program.cs

+ 2 - 3
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<T> and this removed
+            serviceCollection.AddSingleton<ILogger>(_logger);
 
             serviceCollection.AddSingleton(FileSystemManager);
             serviceCollection.AddSingleton<TvDbClientManager>();

+ 2 - 0
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 =>
                 {