1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Upgrade log files are now date stamped (no longer overwritten)

This commit is contained in:
kay.one 2011-11-20 17:30:59 -08:00
parent d73853f08b
commit ff8d837380

View File

@ -54,16 +54,15 @@ private static void InitLoggers()
LogConfiguration.RegisterUdpLogger();
LogConfiguration.RegisterExceptioneer();
var fileTarget = new FileTarget();
fileTarget.AutoFlush = true;
fileTarget.ConcurrentWrites = false;
fileTarget.DeleteOldFileOnStartup = true;
fileTarget.FileName = "upgrade.log";
fileTarget.KeepFileOpen = false;
var lastUpgradeLog = new FileTarget();
lastUpgradeLog.AutoFlush = true;
lastUpgradeLog.ConcurrentWrites = false;
lastUpgradeLog.FileName = Path.Combine("UpgradeLog", DateTime.Now.ToString("yyyy.MM.dd-H-mm") + ".txt");
lastUpgradeLog.KeepFileOpen = false;
lastUpgradeLog.Layout = "${longdate} - ${logger}: ${message} ${exception}";
fileTarget.Layout = "${logger}: ${message} ${exception}";
LogManager.Configuration.AddTarget(fileTarget.GetType().Name, fileTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget));
LogManager.Configuration.AddTarget(lastUpgradeLog.GetType().Name, lastUpgradeLog);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, lastUpgradeLog));
LogConfiguration.Reload();
}