mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Refactored logs to use a logs/ folder and also roll over after 10MB. A maximum of 5 logs will persist (50MB of log data).
This commit is contained in:
parent
58856c0d70
commit
590ee771c1
@ -20,6 +20,7 @@ namespace API.Services.Tasks
|
|||||||
private readonly ILogger<BackupService> _logger;
|
private readonly ILogger<BackupService> _logger;
|
||||||
private readonly IDirectoryService _directoryService;
|
private readonly IDirectoryService _directoryService;
|
||||||
private readonly string _tempDirectory = Path.Join(Directory.GetCurrentDirectory(), "temp");
|
private readonly string _tempDirectory = Path.Join(Directory.GetCurrentDirectory(), "temp");
|
||||||
|
private readonly string _logDirectory = Path.Join(Directory.GetCurrentDirectory(), "logs");
|
||||||
|
|
||||||
private readonly IList<string> _backupFiles;
|
private readonly IList<string> _backupFiles;
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ namespace API.Services.Tasks
|
|||||||
var fi = new FileInfo(logFileName);
|
var fi = new FileInfo(logFileName);
|
||||||
|
|
||||||
var files = maxRollingFiles > 0
|
var files = maxRollingFiles > 0
|
||||||
? _directoryService.GetFiles(Directory.GetCurrentDirectory(), $@"{fi.Name}{multipleFileRegex}\.log")
|
? _directoryService.GetFiles(_logDirectory, $@"{Path.GetFileNameWithoutExtension(fi.Name)}{multipleFileRegex}\.log")
|
||||||
: new[] {"kavita.log"};
|
: new[] {"kavita.log"};
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
"Microsoft.AspNetCore.Hosting.Internal.WebHost": "Information"
|
"Microsoft.AspNetCore.Hosting.Internal.WebHost": "Information"
|
||||||
},
|
},
|
||||||
"File": {
|
"File": {
|
||||||
"Path": "kavita.log",
|
"Path": "logs/kavita.log",
|
||||||
"Append": "True",
|
"Append": "True",
|
||||||
"FileSizeLimitBytes": 0,
|
"FileSizeLimitBytes": 10485760,
|
||||||
"MaxRollingFiles": 0
|
"MaxRollingFiles": 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Port": 5000
|
"Port": 5000
|
||||||
|
Loading…
x
Reference in New Issue
Block a user