aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Server')
-rw-r--r--Jellyfin.Server/Jellyfin.Server.csproj9
-rw-r--r--Jellyfin.Server/Middleware/ResponseTimeMiddleware.cs2
-rw-r--r--Jellyfin.Server/Middleware/UrlDecodeQueryFeature.cs2
-rw-r--r--Jellyfin.Server/Program.cs50
4 files changed, 45 insertions, 18 deletions
diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj
index 49d979e115..045ed6a2ba 100644
--- a/Jellyfin.Server/Jellyfin.Server.csproj
+++ b/Jellyfin.Server/Jellyfin.Server.csproj
@@ -31,10 +31,10 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
- <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.0-rc.2*" />
- <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0-rc.2*" />
- <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.0-rc.2*" />
- <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="6.0.0-rc.2*" />
+ <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.0" />
+ <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
+ <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.0" />
+ <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="prometheus-net" Version="5.0.1" />
<PackageReference Include="prometheus-net.AspNetCore" Version="5.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
@@ -44,6 +44,7 @@
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Graylog" Version="2.2.2" />
+ <PackageReference Include="Serilog.Sinks.Map" Version="1.0.2" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.7" />
</ItemGroup>
diff --git a/Jellyfin.Server/Middleware/ResponseTimeMiddleware.cs b/Jellyfin.Server/Middleware/ResponseTimeMiddleware.cs
index 74874da1b0..da9b691365 100644
--- a/Jellyfin.Server/Middleware/ResponseTimeMiddleware.cs
+++ b/Jellyfin.Server/Middleware/ResponseTimeMiddleware.cs
@@ -68,7 +68,7 @@ namespace Jellyfin.Server.Middleware
if (_enableWarning && watch.ElapsedMilliseconds > _warningThreshold)
{
_logger.LogWarning(
- "Slow HTTP Response from {url} to {remoteIp} in {elapsed:g} with Status Code {statusCode}",
+ "Slow HTTP Response from {Url} to {RemoteIp} in {Elapsed:g} with Status Code {StatusCode}",
context.Request.GetDisplayUrl(),
context.GetNormalizedRemoteIp(),
watch.Elapsed,
diff --git a/Jellyfin.Server/Middleware/UrlDecodeQueryFeature.cs b/Jellyfin.Server/Middleware/UrlDecodeQueryFeature.cs
index e4d2937e7e..2f1d791573 100644
--- a/Jellyfin.Server/Middleware/UrlDecodeQueryFeature.cs
+++ b/Jellyfin.Server/Middleware/UrlDecodeQueryFeature.cs
@@ -51,7 +51,7 @@ namespace Jellyfin.Server.Middleware
return;
}
- if (!key.Contains('='))
+ if (!key.Contains('=', StringComparison.Ordinal))
{
_store = value;
return;
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 5f848be9e1..6e4c2280be 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -13,6 +13,7 @@ using Emby.Server.Implementations;
using Jellyfin.Server.Implementations;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.ClientEvent;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.IO;
using Microsoft.AspNetCore.Hosting;
@@ -25,6 +26,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Serilog;
using Serilog.Extensions.Logging;
+using Serilog.Filters;
using SQLitePCL;
using ConfigurationExtensions = MediaBrowser.Controller.Extensions.ConfigurationExtensions;
using ILogger = Microsoft.Extensions.Logging.ILogger;
@@ -596,22 +598,46 @@ namespace Jellyfin.Server
{
// Serilog.Log is used by SerilogLoggerFactory when no logger is specified
Log.Logger = new LoggerConfiguration()
- .ReadFrom.Configuration(configuration)
- .Enrich.FromLogContext()
- .Enrich.WithThreadId()
+ .WriteTo.Logger(lc =>
+ lc.ReadFrom.Configuration(configuration)
+ .Enrich.FromLogContext()
+ .Enrich.WithThreadId()
+ .Filter.ByExcluding(Matching.FromSource<ClientEventLogger>()))
+ .WriteTo.Logger(lc =>
+ lc.WriteTo.Map(
+ "ClientName",
+ (clientName, wt)
+ => wt.File(
+ Path.Combine(appPaths.LogDirectoryPath, "log_" + clientName + "_.log"),
+ rollingInterval: RollingInterval.Day,
+ outputTemplate: "{Message:l}{NewLine}{Exception}",
+ encoding: Encoding.UTF8))
+ .Filter.ByIncludingOnly(Matching.FromSource<ClientEventLogger>()))
.CreateLogger();
}
catch (Exception ex)
{
Log.Logger = new LoggerConfiguration()
- .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message:lj}{NewLine}{Exception}")
- .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}] [{ThreadId}] {SourceContext}: {Message}{NewLine}{Exception}",
- encoding: Encoding.UTF8))
- .Enrich.FromLogContext()
- .Enrich.WithThreadId()
+ .WriteTo.Logger(lc =>
+ lc.WriteTo.Async(x => x.File(
+ Path.Combine(appPaths.LogDirectoryPath, "log_.log"),
+ rollingInterval: RollingInterval.Day,
+ outputTemplate: "{Message:l}{NewLine}{Exception}",
+ encoding: Encoding.UTF8))
+ .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message:lj}{NewLine}{Exception}")
+ .Enrich.FromLogContext()
+ .Enrich.WithThreadId())
+ .WriteTo.Logger(lc =>
+ lc
+ .WriteTo.Map(
+ "ClientName",
+ (clientName, wt)
+ => wt.File(
+ Path.Combine(appPaths.LogDirectoryPath, "log_" + clientName + "_.log"),
+ rollingInterval: RollingInterval.Day,
+ outputTemplate: "{Message:l}{NewLine}{Exception}",
+ encoding: Encoding.UTF8))
+ .Filter.ByIncludingOnly(Matching.FromSource<ClientEventLogger>()))
.CreateLogger();
Log.Logger.Fatal(ex, "Failed to create/read logger configuration");
@@ -649,7 +675,7 @@ namespace Jellyfin.Server
private static string NormalizeCommandLineArgument(string arg)
{
- if (!arg.Contains(" ", StringComparison.OrdinalIgnoreCase))
+ if (!arg.Contains(' ', StringComparison.Ordinal))
{
return arg;
}