Merge pull request #2288 from Bond-009/logging

Add brackets around thread id
This commit is contained in:
Vasily 2020-01-16 16:45:46 +03:00 committed by GitHub
commit ad481322f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

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

View File

@ -5,7 +5,7 @@
{ {
"Name": "Console", "Name": "Console",
"Args": { "Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] {ThreadId} {SourceContext}: {Message:lj} {NewLine}{Exception}" "outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message:lj}{NewLine}{Exception}"
} }
}, },
{ {
@ -20,7 +20,7 @@
"retainedFileCountLimit": 3, "retainedFileCountLimit": 3,
"rollOnFileSizeLimit": true, "rollOnFileSizeLimit": true,
"fileSizeLimitBytes": 100000000, "fileSizeLimitBytes": 100000000,
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] {ThreadId} {SourceContext}:{Message} {NewLine}{Exception}" "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}:{Message}{NewLine}{Exception}"
} }
} }
] ]