mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
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:
parent
f57ad728a5
commit
7af3754a11
@ -25,6 +25,7 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
|
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="3.0.1" />
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.0.1" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Async" Version="1.3.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
|
||||||
<PackageReference Include="SkiaSharp" Version="1.68.0" />
|
<PackageReference Include="SkiaSharp" Version="1.68.0" />
|
||||||
|
@ -173,10 +173,10 @@ namespace Jellyfin.Server
|
|||||||
{
|
{
|
||||||
Serilog.Log.Logger = new LoggerConfiguration()
|
Serilog.Log.Logger = new LoggerConfiguration()
|
||||||
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss}] [{Level:u3}] {Message:lj}{NewLine}{Exception}")
|
.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"),
|
Path.Combine(appPaths.LogDirectoryPath, "log_.log"),
|
||||||
rollingInterval: RollingInterval.Day,
|
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()
|
.Enrich.FromLogContext()
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
|
|
||||||
|
@ -2,12 +2,18 @@
|
|||||||
"Serilog": {
|
"Serilog": {
|
||||||
"MinimumLevel": "Information",
|
"MinimumLevel": "Information",
|
||||||
"WriteTo": [
|
"WriteTo": [
|
||||||
{ "Name": "Console",
|
{
|
||||||
|
"Name": "Console",
|
||||||
"Args": {
|
"Args": {
|
||||||
"outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] {Message:lj}{NewLine}{Exception}"
|
"outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] {Message:lj}{NewLine}{Exception}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ "Name": "File",
|
{
|
||||||
|
"Name": "Async",
|
||||||
|
"Args": {
|
||||||
|
"configure": [
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
"Args": {
|
"Args": {
|
||||||
"path": "%JELLYFIN_LOG_DIR%//log_.log",
|
"path": "%JELLYFIN_LOG_DIR%//log_.log",
|
||||||
"rollingInterval": "Day",
|
"rollingInterval": "Day",
|
||||||
@ -17,3 +23,6 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user