Removed ET error reporting
This commit is contained in:
parent
1824fd6682
commit
e090843755
|
@ -2,7 +2,6 @@
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
using NLog.Targets;
|
using NLog.Targets;
|
||||||
using NzbDrone.Common.NlogTargets;
|
|
||||||
|
|
||||||
namespace NzbDrone.Common
|
namespace NzbDrone.Common
|
||||||
{
|
{
|
||||||
|
@ -112,36 +111,6 @@ namespace NzbDrone.Common
|
||||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", level, fileTarget));
|
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", level, fileTarget));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RegisterRemote()
|
|
||||||
{
|
|
||||||
//if (EnviromentProvider.IsProduction)
|
|
||||||
//{
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// var exceptioneerTarget = new ExceptioneerTarget();
|
|
||||||
// LogManager.Configuration.AddTarget("Exceptioneer", exceptioneerTarget);
|
|
||||||
// LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, exceptioneerTarget));
|
|
||||||
// }
|
|
||||||
// catch (Exception e)
|
|
||||||
// {
|
|
||||||
// Console.WriteLine(e);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var remoteTarget = new RemoteTarget();
|
|
||||||
LogManager.Configuration.AddTarget("RemoteTarget", remoteTarget);
|
|
||||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, remoteTarget));
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
LogManager.ConfigurationReloaded += (sender, args) => RegisterRemote();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Reload()
|
public static void Reload()
|
||||||
{
|
{
|
||||||
LogManager.Configuration.Reload();
|
LogManager.Configuration.Reload();
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
using System.Linq;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using NLog;
|
|
||||||
using NLog.Targets;
|
|
||||||
|
|
||||||
namespace NzbDrone.Common.NlogTargets
|
|
||||||
{
|
|
||||||
public class RemoteTarget : Target
|
|
||||||
{
|
|
||||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
||||||
|
|
||||||
protected override void Write(LogEventInfo logEvent)
|
|
||||||
{
|
|
||||||
if (logEvent == null || logEvent.Exception == null) return;
|
|
||||||
|
|
||||||
logger.Trace("Sending Exception to Service.NzbDrone.com . Process Name: {0}", Process.GetCurrentProcess().ProcessName);
|
|
||||||
|
|
||||||
ReportingService.ReportException(logEvent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -59,10 +59,6 @@
|
||||||
<Reference Include="Autofac.Configuration">
|
<Reference Include="Autofac.Configuration">
|
||||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
|
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Exceptron.Client, Version=1.0.7.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\packages\Exceptron.Client.1.0.7\lib\net20\Exceptron.Client.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||||
|
@ -87,7 +83,6 @@
|
||||||
<Compile Include="ConsoleProvider.cs" />
|
<Compile Include="ConsoleProvider.cs" />
|
||||||
<Compile Include="Contract\ReportBase.cs" />
|
<Compile Include="Contract\ReportBase.cs" />
|
||||||
<Compile Include="Contract\ParseErrorReport.cs" />
|
<Compile Include="Contract\ParseErrorReport.cs" />
|
||||||
<Compile Include="NlogTargets\RemoteTarget.cs" />
|
|
||||||
<Compile Include="IISProvider.cs" />
|
<Compile Include="IISProvider.cs" />
|
||||||
<Compile Include="Model\AuthenticationType.cs" />
|
<Compile Include="Model\AuthenticationType.cs" />
|
||||||
<Compile Include="PathExtentions.cs" />
|
<Compile Include="PathExtentions.cs" />
|
||||||
|
@ -121,6 +116,7 @@
|
||||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||||
</COMReference>
|
</COMReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Exceptron.Client;
|
|
||||||
using Exceptron.Client.Configuration;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Contract;
|
using NzbDrone.Common.Contract;
|
||||||
|
|
||||||
|
@ -16,7 +14,6 @@ namespace NzbDrone.Common
|
||||||
private const string PARSE_URL = SERVICE_URL + "/ParseError";
|
private const string PARSE_URL = SERVICE_URL + "/ParseError";
|
||||||
|
|
||||||
public static RestProvider RestProvider { get; set; }
|
public static RestProvider RestProvider { get; set; }
|
||||||
public static ExceptronClient ExceptronClient { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
private static readonly HashSet<string> parserErrorCache = new HashSet<string>();
|
private static readonly HashSet<string> parserErrorCache = new HashSet<string>();
|
||||||
|
@ -57,68 +54,6 @@ namespace NzbDrone.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ReportException(LogEventInfo logEvent)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
VerifyDependencies();
|
|
||||||
|
|
||||||
var exceptionData = new ExceptionData();
|
|
||||||
|
|
||||||
exceptionData.Exception = logEvent.Exception;
|
|
||||||
exceptionData.Component = logEvent.LoggerName;
|
|
||||||
exceptionData.Message = logEvent.FormattedMessage;
|
|
||||||
exceptionData.UserId = EnvironmentProvider.UGuid.ToString().Replace("-", string.Empty);
|
|
||||||
|
|
||||||
if (logEvent.Level <= LogLevel.Info)
|
|
||||||
{
|
|
||||||
exceptionData.Severity = ExceptionSeverity.None;
|
|
||||||
}
|
|
||||||
else if (logEvent.Level <= LogLevel.Warn)
|
|
||||||
{
|
|
||||||
exceptionData.Severity = ExceptionSeverity.Warning;
|
|
||||||
}
|
|
||||||
else if (logEvent.Level <= LogLevel.Error)
|
|
||||||
{
|
|
||||||
exceptionData.Severity = ExceptionSeverity.Error;
|
|
||||||
}
|
|
||||||
else if (logEvent.Level <= LogLevel.Fatal)
|
|
||||||
{
|
|
||||||
exceptionData.Severity = ExceptionSeverity.Fatal;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ExceptronClient.SubmitException(exceptionData).RefId;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
if (!EnvironmentProvider.IsProduction)
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
if (logEvent.LoggerName != logger.Name)//prevents a recursive loop.
|
|
||||||
{
|
|
||||||
logger.WarnException("Unable to report exception. ", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void SetupExceptronDriver()
|
|
||||||
{
|
|
||||||
var config = new ExceptronConfiguration
|
|
||||||
{
|
|
||||||
ApiKey = "CB230C312E5C4FF38B4FB9644B05E60G",
|
|
||||||
ThrowExceptions = !EnvironmentProvider.IsProduction,
|
|
||||||
};
|
|
||||||
|
|
||||||
ExceptronClient = new ExceptronClient(config)
|
|
||||||
{
|
|
||||||
ApplicationVersion = new EnvironmentProvider().Version.ToString()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void VerifyDependencies()
|
private static void VerifyDependencies()
|
||||||
{
|
{
|
||||||
if (RestProvider == null)
|
if (RestProvider == null)
|
||||||
|
@ -133,19 +68,6 @@ namespace NzbDrone.Common
|
||||||
throw new InvalidOperationException("REST Provider wasn't configured correctly.");
|
throw new InvalidOperationException("REST Provider wasn't configured correctly.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExceptronClient == null)
|
|
||||||
{
|
|
||||||
if (EnvironmentProvider.IsProduction)
|
|
||||||
{
|
|
||||||
logger.Warn("Exceptron Driver wasn't provided. creating new one!");
|
|
||||||
SetupExceptronDriver();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("Exceptron Driver wasn't configured correctly.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
|
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
|
||||||
<package id="Exceptron.Client" version="1.0.7" targetFramework="net40" />
|
|
||||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
|
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
|
||||||
<package id="NLog" version="2.0.0.2000" />
|
<package id="NLog" version="2.0.0.2000" />
|
||||||
</packages>
|
</packages>
|
|
@ -56,30 +56,5 @@ namespace NzbDrone.Core.Test.Integeration
|
||||||
dailySeries.Should().NotBeEmpty();
|
dailySeries.Should().NotBeEmpty();
|
||||||
dailySeries.Should().OnlyContain(c => c > 0);
|
dailySeries.Should().OnlyContain(c => c > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_be_able_to_submit_exceptions()
|
|
||||||
{
|
|
||||||
ReportingService.SetupExceptronDriver();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ThrowException();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
var log = new LogEventInfo
|
|
||||||
{
|
|
||||||
LoggerName = "LoggerName.LoggerName.LoggerName.LoggerName",
|
|
||||||
Exception = e,
|
|
||||||
Message = "New message string. New message string.",
|
|
||||||
};
|
|
||||||
|
|
||||||
var hash = ReportingService.ReportException(log);
|
|
||||||
|
|
||||||
hash.Should().HaveLength(8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -110,7 +110,6 @@ namespace NzbDrone.Core
|
||||||
{
|
{
|
||||||
EnvironmentProvider.UGuid = container.Resolve<ConfigProvider>().UGuid;
|
EnvironmentProvider.UGuid = container.Resolve<ConfigProvider>().UGuid;
|
||||||
ReportingService.RestProvider = container.Resolve<RestProvider>();
|
ReportingService.RestProvider = container.Resolve<RestProvider>();
|
||||||
ReportingService.SetupExceptronDriver();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterQuality(IContainer container)
|
private void RegisterQuality(IContainer container)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.0.8.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
|
|
@ -47,8 +47,6 @@ namespace NzbDrone.Test.Common
|
||||||
{
|
{
|
||||||
MockedRestProvider = new Mock<RestProvider>();
|
MockedRestProvider = new Mock<RestProvider>();
|
||||||
ReportingService.RestProvider = MockedRestProvider.Object;
|
ReportingService.RestProvider = MockedRestProvider.Object;
|
||||||
ReportingService.SetupExceptronDriver();
|
|
||||||
|
|
||||||
|
|
||||||
if (Directory.Exists(TempFolder))
|
if (Directory.Exists(TempFolder))
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,9 +62,6 @@ namespace NzbDrone.Update
|
||||||
private static void InitLoggers()
|
private static void InitLoggers()
|
||||||
{
|
{
|
||||||
ReportingService.RestProvider = _container.Resolve<RestProvider>();
|
ReportingService.RestProvider = _container.Resolve<RestProvider>();
|
||||||
ReportingService.SetupExceptronDriver();
|
|
||||||
|
|
||||||
LogConfiguration.RegisterRemote();
|
|
||||||
|
|
||||||
LogConfiguration.RegisterConsoleLogger(LogLevel.Trace);
|
LogConfiguration.RegisterConsoleLogger(LogLevel.Trace);
|
||||||
LogConfiguration.RegisterUdpLogger();
|
LogConfiguration.RegisterUdpLogger();
|
||||||
|
|
|
@ -18,7 +18,6 @@ namespace NzbDrone.Web.App_Start
|
||||||
LogManager.Configuration = new XmlLoggingConfiguration(environmentProvider.GetNlogConfigPath(), false);
|
LogManager.Configuration = new XmlLoggingConfiguration(environmentProvider.GetNlogConfigPath(), false);
|
||||||
|
|
||||||
LogConfiguration.RegisterUdpLogger();
|
LogConfiguration.RegisterUdpLogger();
|
||||||
LogConfiguration.RegisterRemote();
|
|
||||||
LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Web.MvcApplication");
|
LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Web.MvcApplication");
|
||||||
LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch");
|
LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch");
|
||||||
LogConfiguration.RegisterRollingFileLogger(environmentProvider.GetLogFileName(), LogLevel.Trace);
|
LogConfiguration.RegisterRollingFileLogger(environmentProvider.GetLogFileName(), LogLevel.Trace);
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.0.8.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|
|
@ -48,12 +48,10 @@ namespace NzbDrone
|
||||||
var environmentProvider = _container.Resolve<EnvironmentProvider>();
|
var environmentProvider = _container.Resolve<EnvironmentProvider>();
|
||||||
|
|
||||||
ReportingService.RestProvider = _container.Resolve<RestProvider>();
|
ReportingService.RestProvider = _container.Resolve<RestProvider>();
|
||||||
ReportingService.SetupExceptronDriver();
|
|
||||||
|
|
||||||
LogConfiguration.RegisterRollingFileLogger(environmentProvider.GetLogFileName(), LogLevel.Info);
|
LogConfiguration.RegisterRollingFileLogger(environmentProvider.GetLogFileName(), LogLevel.Info);
|
||||||
LogConfiguration.RegisterConsoleLogger(LogLevel.Debug);
|
LogConfiguration.RegisterConsoleLogger(LogLevel.Debug);
|
||||||
LogConfiguration.RegisterUdpLogger();
|
LogConfiguration.RegisterUdpLogger();
|
||||||
LogConfiguration.RegisterRemote();
|
|
||||||
LogConfiguration.Reload();
|
LogConfiguration.Reload();
|
||||||
Logger.Info("Start-up Path:'{0}'", environmentProvider.ApplicationPath);
|
Logger.Info("Start-up Path:'{0}'", environmentProvider.ApplicationPath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue