mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Update log files are now copied to application folder.
This commit is contained in:
parent
ff8d837380
commit
b74ef12a4c
@ -22,6 +22,7 @@ public static class PathExtentions
|
||||
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\\";
|
||||
|
||||
public static string NormalizePath(this string path)
|
||||
{
|
||||
@ -94,6 +95,11 @@ public static string GetCacheFolder(this EnviromentProvider enviromentProvider)
|
||||
return Path.Combine(enviromentProvider.GetWebRoot(), "Cache");
|
||||
}
|
||||
|
||||
public static string GetUpdateLogFolder(this EnviromentProvider enviromentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.ApplicationPath, UPDATE_LOG_FOLDER_NAME);
|
||||
}
|
||||
|
||||
public static string GetUpdateSandboxFolder(this EnviromentProvider enviromentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.SystemTemp, UPDATE_SANDBOX_FOLDER_NAME);
|
||||
@ -118,5 +124,10 @@ public static string GetUpdateClientExePath(this EnviromentProvider enviromentPr
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetUpdateClientFolder(), UPDATE_CLIENT_EXE);
|
||||
}
|
||||
|
||||
public static string GetSandboxLogFolder(this EnviromentProvider enviromentProvider)
|
||||
{
|
||||
return Path.Combine(enviromentProvider.GetUpdateSandboxFolder(), UPDATE_LOG_FOLDER_NAME);
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,9 @@ class UpdateProviderStartFixture : TestBase
|
||||
{
|
||||
private const string UPDATE_FOLDER = @"C:\Temp\nzbdrone_update\nzbdrone\";
|
||||
private const string BACKUP_FOLDER = @"C:\Temp\nzbdrone_update\nzbdrone_backup\";
|
||||
private const string SANDBOX_LOG_FOLDER = @"C:\Temp\nzbdrone_update\UpdateLogs\";
|
||||
private const string TARGET_FOLDER = @"C:\NzbDrone\";
|
||||
private const string UPDATE_LOG_FOLDER = @"C:\NzbDrone\UpdateLogs\";
|
||||
|
||||
Mock<EnviromentProvider> _enviromentProvider;
|
||||
|
||||
@ -239,5 +241,7 @@ private void VerifyProcessRestart()
|
||||
Mocker.GetMock<ProcessProvider>()
|
||||
.Verify(c => c.Start(TARGET_FOLDER + "nzbdrone.exe"), Times.Once());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,24 @@ public static void Main(string[] args)
|
||||
{
|
||||
logger.FatalException("An error has occurred while applying update package.", e);
|
||||
}
|
||||
|
||||
TransferUpdateLogs();
|
||||
|
||||
}
|
||||
|
||||
private static void TransferUpdateLogs()
|
||||
{
|
||||
try
|
||||
{
|
||||
var enviromentProvider = new EnviromentProvider();
|
||||
var diskProvider = new DiskProvider();
|
||||
logger.Info("Copying log tiles to application directory.");
|
||||
diskProvider.CopyDirectory(enviromentProvider.GetSandboxLogFolder(), enviromentProvider.GetUpdateLogFolder());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.FatalException("Can't copy upgrade log files to target folder", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void InitLoggers()
|
||||
@ -57,7 +75,7 @@ private static void InitLoggers()
|
||||
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.FileName = Path.Combine(PathExtentions.UPDATE_LOG_FOLDER_NAME, DateTime.Now.ToString("yyyy.MM.dd-H-mm") + ".txt");
|
||||
lastUpgradeLog.KeepFileOpen = false;
|
||||
lastUpgradeLog.Layout = "${longdate} - ${logger}: ${message} ${exception}";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user