Improve logging performance

Perform logging to file on a background thread.
This means logging won't be bottlenecked by IO.
This commit is contained in:
Bond_009
2019-01-05 23:08:22 +01:00
parent f57ad728a5
commit 7af3754a11
3 changed files with 17 additions and 7 deletions

View File

@@ -173,10 +173,10 @@ namespace Jellyfin.Server
{
Serilog.Log.Logger = new LoggerConfiguration()
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss}] [{Level:u3}] {Message:lj}{NewLine}{Exception}")
.WriteTo.File(
.WriteTo.Async(x => x.File(
Path.Combine(appPaths.LogDirectoryPath, "log_.log"),
rollingInterval: RollingInterval.Day,
outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] {Message}{NewLine}{Exception}")
outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] {Message}{NewLine}{Exception}"))
.Enrich.FromLogContext()
.CreateLogger();