mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Add logging to updater
This commit is contained in:
@@ -39,6 +39,10 @@
|
|||||||
<ApplicationIcon>jackett.ico</ApplicationIcon>
|
<ApplicationIcon>jackett.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
|
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
|
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
|
@@ -21,8 +21,9 @@ namespace Jackett.Updater
|
|||||||
|
|
||||||
private void Run(string[] args)
|
private void Run(string[] args)
|
||||||
{
|
{
|
||||||
|
Engine.SetupLogging(null, "updater.txt");
|
||||||
Engine.Logger.Info("Jackett Updater v" + GetCurrentVersion());
|
Engine.Logger.Info("Jackett Updater v" + GetCurrentVersion());
|
||||||
|
Engine.Logger.Info("Options " + string.Join(" ", args));
|
||||||
try {
|
try {
|
||||||
var options = new UpdaterConsoleOptions();
|
var options = new UpdaterConsoleOptions();
|
||||||
if (Parser.Default.ParseArguments(args, options))
|
if (Parser.Default.ParseArguments(args, options))
|
||||||
@@ -78,7 +79,7 @@ namespace Jackett.Updater
|
|||||||
|
|
||||||
Engine.Logger.Info("Waiting for Jackett to close..");
|
Engine.Logger.Info("Waiting for Jackett to close..");
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
|
Engine.Logger.Info("Finding files in: " + updateLocation);
|
||||||
var files = Directory.GetFiles(updateLocation, "*.*", SearchOption.AllDirectories);
|
var files = Directory.GetFiles(updateLocation, "*.*", SearchOption.AllDirectories);
|
||||||
foreach(var file in files)
|
foreach(var file in files)
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="Autofac" version="3.5.2" targetFramework="net45" />
|
||||||
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
|
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
|
||||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
|
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
|
||||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
|
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net45" />
|
||||||
|
@@ -115,7 +115,7 @@ namespace Jackett
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void SetupLogging(ContainerBuilder builder)
|
public static void SetupLogging(ContainerBuilder builder = null, string logfile = "log.txt")
|
||||||
{
|
{
|
||||||
var logLevel = Startup.TracingEnabled ? LogLevel.Debug : LogLevel.Info;
|
var logLevel = Startup.TracingEnabled ? LogLevel.Debug : LogLevel.Info;
|
||||||
// Add custom date time format renderer as the default is too long
|
// Add custom date time format renderer as the default is too long
|
||||||
@@ -125,7 +125,7 @@ namespace Jackett
|
|||||||
var logFile = new FileTarget();
|
var logFile = new FileTarget();
|
||||||
logConfig.AddTarget("file", logFile);
|
logConfig.AddTarget("file", logFile);
|
||||||
logFile.Layout = "${longdate} ${level} ${message} ${exception:format=ToString}";
|
logFile.Layout = "${longdate} ${level} ${message} ${exception:format=ToString}";
|
||||||
logFile.FileName = Path.Combine(ConfigurationService.GetAppDataFolderStatic(), "log.txt");
|
logFile.FileName = Path.Combine(ConfigurationService.GetAppDataFolderStatic(), logfile);
|
||||||
logFile.ArchiveFileName = "log.{#####}.txt";
|
logFile.ArchiveFileName = "log.{#####}.txt";
|
||||||
logFile.ArchiveAboveSize = 500000;
|
logFile.ArchiveAboveSize = 500000;
|
||||||
logFile.MaxArchiveFiles = 5;
|
logFile.MaxArchiveFiles = 5;
|
||||||
@@ -147,9 +147,10 @@ namespace Jackett
|
|||||||
logConfig.LoggingRules.Add(serviceRule);
|
logConfig.LoggingRules.Add(serviceRule);
|
||||||
|
|
||||||
LogManager.Configuration = logConfig;
|
LogManager.Configuration = logConfig;
|
||||||
|
if (builder != null)
|
||||||
|
{
|
||||||
builder.RegisterInstance<Logger>(LogManager.GetCurrentClassLogger()).SingleInstance();
|
builder.RegisterInstance<Logger>(LogManager.GetCurrentClassLogger()).SingleInstance();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetLogLevel(LogLevel level)
|
public static void SetLogLevel(LogLevel level)
|
||||||
|
Reference in New Issue
Block a user