From ff8d837380c7d9dcf936f7b9306d76dc3c5dc9bd Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 20 Nov 2011 17:30:59 -0800 Subject: [PATCH] Upgrade log files are now date stamped (no longer overwritten) --- NzbDrone.Update/Program.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/NzbDrone.Update/Program.cs b/NzbDrone.Update/Program.cs index e2439b2ea..97a76389f 100644 --- a/NzbDrone.Update/Program.cs +++ b/NzbDrone.Update/Program.cs @@ -54,16 +54,15 @@ namespace NzbDrone.Update LogConfiguration.RegisterUdpLogger(); LogConfiguration.RegisterExceptioneer(); - var fileTarget = new FileTarget(); - fileTarget.AutoFlush = true; - fileTarget.ConcurrentWrites = false; - fileTarget.DeleteOldFileOnStartup = true; - fileTarget.FileName = "upgrade.log"; - fileTarget.KeepFileOpen = false; - - fileTarget.Layout = "${logger}: ${message} ${exception}"; - LogManager.Configuration.AddTarget(fileTarget.GetType().Name, fileTarget); - LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget)); + 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}"; + + LogManager.Configuration.AddTarget(lastUpgradeLog.GetType().Name, lastUpgradeLog); + LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, lastUpgradeLog)); LogConfiguration.Reload(); }