mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: Exceptions during Upgrade and AppStart are reported correctly.
This commit is contained in:
parent
ac568ef47b
commit
7a3f7bf67c
@ -30,8 +30,7 @@ public static void ReportParseError(string title)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (RestProvider == null && EnviromentProvider.IsProduction)
|
||||
return;
|
||||
VerifyRestProvider();
|
||||
|
||||
lock (parserErrorCache)
|
||||
{
|
||||
@ -59,9 +58,8 @@ public static void ReportException(LogEventInfo logEvent)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (RestProvider == null && EnviromentProvider.IsProduction)
|
||||
return;
|
||||
|
||||
VerifyRestProvider();
|
||||
|
||||
var report = new ExceptionReport();
|
||||
report.LogMessage = logEvent.FormattedMessage;
|
||||
report.String = logEvent.Exception.ToString();
|
||||
@ -81,5 +79,21 @@ public static void ReportException(LogEventInfo logEvent)
|
||||
logger.Info("Unable to report exception. " + e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void VerifyRestProvider()
|
||||
{
|
||||
if(RestProvider == null)
|
||||
{
|
||||
if(EnviromentProvider.IsProduction)
|
||||
{
|
||||
logger.Warn("Rest provider wasn't provided. creating new one!");
|
||||
RestProvider = new RestProvider(new EnviromentProvider());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("REST Provider wasn't configured correctly.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace NzbDrone.Common
|
||||
public class RestProvider
|
||||
{
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly EnviromentProvider _enviromentProvider;
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Update.Providers;
|
||||
@ -29,9 +27,10 @@ public static void Main(string[] args)
|
||||
try
|
||||
{
|
||||
Console.WriteLine("Starting NzbDrone Update Client");
|
||||
|
||||
InitLoggers();
|
||||
_kernel = new StandardKernel();
|
||||
InitLoggers();
|
||||
|
||||
|
||||
|
||||
logger.Info("Updating NzbDrone to version {0}", _kernel.Get<EnviromentProvider>().Version);
|
||||
_kernel.Get<Program>().Start(args);
|
||||
@ -62,6 +61,8 @@ private static void TransferUpdateLogs()
|
||||
|
||||
private static void InitLoggers()
|
||||
{
|
||||
ReportingService.RestProvider = _kernel.Get<RestProvider>();
|
||||
|
||||
LogConfiguration.RegisterRemote();
|
||||
|
||||
LogConfiguration.RegisterConsoleLogger(LogLevel.Trace);
|
||||
|
@ -44,6 +44,8 @@ private static void BindKernel()
|
||||
private static void InitilizeApp()
|
||||
{
|
||||
var enviromentProvider = _kernel.Get<EnviromentProvider>();
|
||||
|
||||
ReportingService.RestProvider = _kernel.Get<RestProvider>();
|
||||
|
||||
LogConfiguration.RegisterRollingFileLogger(enviromentProvider.GetLogFileName(), LogLevel.Info);
|
||||
LogConfiguration.RegisterConsoleLogger(LogLevel.Debug);
|
||||
|
Loading…
Reference in New Issue
Block a user