mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-31 20:24:21 -04:00
More log dir configurable
This commit is contained in:
parent
a51798dd8d
commit
6d9ee138d6
@ -7,6 +7,7 @@
|
|||||||
- [EraYaN](https://github.com/EraYaN)
|
- [EraYaN](https://github.com/EraYaN)
|
||||||
- [flemse](https://github.com/flemse)
|
- [flemse](https://github.com/flemse)
|
||||||
- [bfayers](https://github.com/bfayers)
|
- [bfayers](https://github.com/bfayers)
|
||||||
|
- [Bond_009](https://github.com/Bond-009)
|
||||||
|
|
||||||
# Emby Contributors
|
# Emby Contributors
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
|
||||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
|
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
|
||||||
|
@ -154,8 +154,13 @@ namespace MediaBrowser.Server.Mono
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task createLogger()
|
private static void createLogger()
|
||||||
{
|
{
|
||||||
|
var logDir = Environment.GetEnvironmentVariable("JELLYFIN_LOG_DIR");
|
||||||
|
if (string.IsNullOrEmpty(logDir)){
|
||||||
|
logDir = Path.Combine(_appPaths.ProgramDataPath, "logs");
|
||||||
|
Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", logDir);
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string path = Path.Combine(_appPaths.ProgramDataPath, "logging.json");
|
string path = Path.Combine(_appPaths.ProgramDataPath, "logging.json");
|
||||||
@ -168,11 +173,13 @@ namespace MediaBrowser.Server.Mono
|
|||||||
using (Stream rscstr = assembly.GetManifestResourceStream(resourcePath))
|
using (Stream rscstr = assembly.GetManifestResourceStream(resourcePath))
|
||||||
using (Stream fstr = File.Open(path, FileMode.CreateNew))
|
using (Stream fstr = File.Open(path, FileMode.CreateNew))
|
||||||
{
|
{
|
||||||
await rscstr.CopyToAsync(fstr);
|
rscstr.CopyTo(fstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var configuration = new ConfigurationBuilder()
|
var configuration = new ConfigurationBuilder()
|
||||||
.AddJsonFile(path)
|
.SetBasePath(_appPaths.ProgramDataPath)
|
||||||
|
.AddJsonFile("logging.json")
|
||||||
|
.AddEnvironmentVariables("JELLYFIN_")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
Serilog.Log.Logger = new LoggerConfiguration()
|
Serilog.Log.Logger = new LoggerConfiguration()
|
||||||
@ -185,7 +192,7 @@ namespace MediaBrowser.Server.Mono
|
|||||||
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.File(
|
||||||
Path.Combine(AppContext.BaseDirectory, "logs", "log_.log"),
|
Path.Combine(logDir, "logs", "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()
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
"WriteTo": [
|
"WriteTo": [
|
||||||
{ "Name": "Console",
|
{ "Name": "Console",
|
||||||
"Args": {
|
"Args": {
|
||||||
"outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] {Message}{NewLine}{Exception}"
|
"outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] {Message:lj}{NewLine}{Exception}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ "Name": "File",
|
{ "Name": "File",
|
||||||
"Args": {
|
"Args": {
|
||||||
"path": "logs//log_.log",
|
"path": "%JELLYFIN_LOG_DIR%//log_.log",
|
||||||
"rollingInterval": "Day",
|
"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}"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user