From 6e9a6313ff144aecd69b4f261953517f2cf6ea41 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 20 Nov 2011 20:18:40 -0800 Subject: [PATCH] Fixed update log path issues. --- NzbDrone.Common.Test/PathExtentionFixture.cs | 12 ++++++++++++ NzbDrone.Common/PathExtentions.cs | 2 +- NzbDrone.Update/Program.cs | 3 +-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/NzbDrone.Common.Test/PathExtentionFixture.cs b/NzbDrone.Common.Test/PathExtentionFixture.cs index d90c776e6..d093e3919 100644 --- a/NzbDrone.Common.Test/PathExtentionFixture.cs +++ b/NzbDrone.Common.Test/PathExtentionFixture.cs @@ -103,5 +103,17 @@ namespace NzbDrone.Common.Test { GetEnviromentProvider().GetUpdateClientExePath().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\NzbDrone\NzbDrone.Update\NzbDrone.Update.exe"); } + + [Test] + public void GetSandboxLogFolder() + { + GetEnviromentProvider().GetSandboxLogFolder().Should().BeEquivalentTo(@"C:\Temp\Nzbdrone_update\UpdateLogs\"); + } + + [Test] + public void GetUpdateLogFolder() + { + GetEnviromentProvider().GetUpdateLogFolder().Should().BeEquivalentTo(@"C:\NzbDrone\UpdateLogs\"); + } } } diff --git a/NzbDrone.Common/PathExtentions.cs b/NzbDrone.Common/PathExtentions.cs index d9fe4f070..886d10db9 100644 --- a/NzbDrone.Common/PathExtentions.cs +++ b/NzbDrone.Common/PathExtentions.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Common private const string UPDATE_BACKUP_FOLDER_NAME = "nzbdrone_backup\\"; private const string UPDATE_CLIENT_EXE = "nzbdrone.update.exe"; private const string UPDATE_CLIENT_FOLDER_NAME = "NzbDrone.Update\\"; - public const string UPDATE_LOG_FOLDER_NAME = "UpdateLogs\\"; + private const string UPDATE_LOG_FOLDER_NAME = "UpdateLogs\\"; public static string NormalizePath(this string path) { diff --git a/NzbDrone.Update/Program.cs b/NzbDrone.Update/Program.cs index 163268779..e64607ecd 100644 --- a/NzbDrone.Update/Program.cs +++ b/NzbDrone.Update/Program.cs @@ -65,11 +65,10 @@ namespace NzbDrone.Update LogConfiguration.RegisterConsoleLogger(LogLevel.Trace); LogConfiguration.RegisterUdpLogger(); - var lastUpgradeLog = new FileTarget(); lastUpgradeLog.AutoFlush = true; lastUpgradeLog.ConcurrentWrites = false; - lastUpgradeLog.FileName = Path.Combine(PathExtentions.UPDATE_LOG_FOLDER_NAME, DateTime.Now.ToString("yyyy.MM.dd-H-mm") + ".txt"); + lastUpgradeLog.FileName = Path.Combine(new EnviromentProvider().GetSandboxLogFolder(), DateTime.Now.ToString("yyyy.MM.dd-H-mm") + ".txt"); lastUpgradeLog.KeepFileOpen = false; lastUpgradeLog.Layout = "${longdate} - ${logger}: ${message} ${exception:format=ToString}";