diff --git a/.gitignore b/.gitignore index e47c968bd..77debb097 100644 --- a/.gitignore +++ b/.gitignore @@ -135,3 +135,4 @@ UpdateLogs/ */test-results/* .idea/* NzbDrone.Web/* +*log.txt diff --git a/NzbDrone.Api/NancyBootstrapper.cs b/NzbDrone.Api/NancyBootstrapper.cs index 622906f5f..81a1e400a 100644 --- a/NzbDrone.Api/NancyBootstrapper.cs +++ b/NzbDrone.Api/NancyBootstrapper.cs @@ -71,7 +71,6 @@ namespace NzbDrone.Api { EnvironmentProvider.UGuid = container.Resolve().UGuid; ReportingService.RestProvider = container.Resolve(); - ReportingService.SetupExceptronDriver(); } protected override ILifetimeScope GetApplicationContainer() diff --git a/NzbDrone.Common/Instrumentation/VersionLayoutRenderer.cs b/NzbDrone.Common/Instrumentation/VersionLayoutRenderer.cs new file mode 100644 index 000000000..a9236acd9 --- /dev/null +++ b/NzbDrone.Common/Instrumentation/VersionLayoutRenderer.cs @@ -0,0 +1,21 @@ +using System.Linq; +using System.Reflection; +using System.Text; +using NLog; +using NLog.Config; +using NLog.LayoutRenderers; + +namespace NzbDrone.Common.Instrumentation +{ + [ThreadAgnostic] + [LayoutRenderer("version")] + public class VersionLayoutRenderer : LayoutRenderer + { + private static readonly string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + + protected override void Append(StringBuilder builder, LogEventInfo logEvent) + { + builder.Append(version); + } + } +} diff --git a/NzbDrone.Common/LogConfiguration.cs b/NzbDrone.Common/LogConfiguration.cs deleted file mode 100644 index ebea74d87..000000000 --- a/NzbDrone.Common/LogConfiguration.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using NLog; -using NLog.Config; -using NLog.Targets; -using NzbDrone.Common.NlogTargets; - -namespace NzbDrone.Common -{ - public static class LogConfiguration - { - static LogConfiguration() - { - if (EnvironmentProvider.IsProduction) - { - LogManager.ThrowExceptions = false; - } - else - { - LogManager.ThrowExceptions = true; - } - - if (LogManager.Configuration == null) - { - LogManager.Configuration = new LoggingConfiguration(); - } - } - - - private static FileTarget GetBaseTarget() - { - var fileTarget = new FileTarget(); - fileTarget.AutoFlush = true; - fileTarget.ConcurrentWrites = true; - fileTarget.KeepFileOpen = false; - fileTarget.ConcurrentWriteAttemptDelay = 50; - fileTarget.ConcurrentWriteAttempts = 200; - - fileTarget.Layout = @"${date:format=yy-M-d HH\:mm\:ss.f}|${replace:searchFor=NzbDrone.:replaceWith=:inner=${logger}}|${level}|${message}|${exception:format=ToString}"; - - return fileTarget; - } - - public static void RegisterFileLogger(string fileName, LogLevel level) - { - var fileTarget = GetBaseTarget(); - fileTarget.FileName = fileName; - - LogManager.Configuration.AddTarget(Guid.NewGuid().ToString(), fileTarget); - LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", level, fileTarget)); - } - - public static void RegisterRollingFileLogger(string fileName, LogLevel level) - { - var fileTarget = GetBaseTarget(); - fileTarget.FileName = fileName; - fileTarget.ArchiveAboveSize = 512000; //500K x 2 - fileTarget.MaxArchiveFiles = 1; - fileTarget.EnableFileDelete = true; - fileTarget.ArchiveNumbering = ArchiveNumberingMode.Rolling; - - LogManager.Configuration.AddTarget(Guid.NewGuid().ToString(), 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() - { - LogManager.Configuration.Reload(); - LogManager.ReconfigExistingLoggers(); - } - } -} diff --git a/NzbDrone.Common/NlogTargets/RemoteTarget.cs b/NzbDrone.Common/NlogTargets/RemoteTarget.cs deleted file mode 100644 index 30c219bf7..000000000 --- a/NzbDrone.Common/NlogTargets/RemoteTarget.cs +++ /dev/null @@ -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); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Common/NzbDrone.Common.csproj b/NzbDrone.Common/NzbDrone.Common.csproj index 8e721a14e..0be6f8fd4 100644 --- a/NzbDrone.Common/NzbDrone.Common.csproj +++ b/NzbDrone.Common/NzbDrone.Common.csproj @@ -61,10 +61,6 @@ False ..\packages\Autofac.3.0.1\lib\net40\Autofac.Configuration.dll - - False - ..\packages\Exceptron.Client.1.0.7\lib\net20\Exceptron.Client.dll - ..\packages\Nancy.0.16.1\lib\net40\Nancy.dll @@ -115,18 +111,17 @@ + - - diff --git a/NzbDrone.Common/PathExtentions.cs b/NzbDrone.Common/PathExtentions.cs index 004f39e19..5edc05e6a 100644 --- a/NzbDrone.Common/PathExtentions.cs +++ b/NzbDrone.Common/PathExtentions.cs @@ -156,16 +156,6 @@ namespace NzbDrone.Common return Path.Combine(environmentProvider.GetUpdateSandboxFolder(), UPDATE_LOG_FOLDER_NAME); } - public static string GetLogFileName(this EnvironmentProvider environmentProvider) - { - return Path.Combine(environmentProvider.ApplicationPath, "nzbdrone.log.txt"); - } - - public static string GetArchivedLogFileName(this EnvironmentProvider environmentProvider) - { - return Path.Combine(environmentProvider.ApplicationPath, "nzbdrone.log.0.txt"); - } - public static string GetConfigBackupFile(this EnvironmentProvider environmentProvider) { return Path.Combine(environmentProvider.GetAppDataPath(), BACKUP_ZIP_FILE); diff --git a/NzbDrone.Common/ReportingService.cs b/NzbDrone.Common/ReportingService.cs index 84ba0b528..139ca7f09 100644 --- a/NzbDrone.Common/ReportingService.cs +++ b/NzbDrone.Common/ReportingService.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Exceptron.Client; -using Exceptron.Client.Configuration; using NLog; using NzbDrone.Common.Contract; @@ -16,7 +14,6 @@ namespace NzbDrone.Common private const string PARSE_URL = SERVICE_URL + "/ParseError"; public static RestProvider RestProvider { get; set; } - public static ExceptronClient ExceptronClient { get; set; } private static readonly HashSet parserErrorCache = new HashSet(); @@ -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() { if (RestProvider == null) @@ -133,19 +68,6 @@ namespace NzbDrone.Common 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."); - } - } } } } diff --git a/NzbDrone.Common/packages.config b/NzbDrone.Common/packages.config index 979bafbd0..4013a3317 100644 --- a/NzbDrone.Common/packages.config +++ b/NzbDrone.Common/packages.config @@ -1,7 +1,6 @@  - diff --git a/NzbDrone.Core.Test/Datastore/BaiscRepositoryFixture.cs b/NzbDrone.Core.Test/Datastore/BaiscRepositoryFixture.cs new file mode 100644 index 000000000..a32dd9c08 --- /dev/null +++ b/NzbDrone.Core.Test/Datastore/BaiscRepositoryFixture.cs @@ -0,0 +1,90 @@ +using System; +using System.Linq; +using FizzWare.NBuilder; +using FluentAssertions; +using NUnit.Framework; +using NzbDrone.Core.Datastore; +using NzbDrone.Core.Test.Framework; + +namespace NzbDrone.Core.Test.Datastore +{ + + public class SampleType : ModelBase + { + public string Name { get; set; } + public string Tilte { get; set; } + public string Address { get; set; } + } + + [TestFixture] + public class BaiscRepositoryFixture : ObjectDbTest,SampleType> + { + private SampleType sampleType; + + + [SetUp] + public void Setup() + { + sampleType = Builder + .CreateNew() + .With(c => c.Id = 0) + .Build(); + + } + + [Test] + public void should_be_able_to_add() + { + Subject.Insert(sampleType); + Subject.All().Should().HaveCount(1); + } + + + + [Test] + public void should_be_able_to_delete_model() + { + Subject.Insert(sampleType); + Subject.All().Should().HaveCount(1); + + Subject.Delete(sampleType.Id); + Subject.All().Should().BeEmpty(); + } + + [Test] + public void should_be_able_to_find_by_id() + { + Subject.Insert(sampleType); + Subject.Get(sampleType.Id) + .ShouldHave() + .AllProperties() + .EqualTo(sampleType); + } + + [Test] + public void should_be_able_to_update_existing_model() + { + Subject.Insert(sampleType); + + sampleType.Address = "newAddress"; + + Subject.Update(sampleType); + + Subject.Get(sampleType.Id).Address.Should().Be(sampleType.Address); + + } + + [Test] + public void getting_model_with_invalid_id_should_throw() + { + Assert.Throws(() => Subject.Get(12)); + } + + + [Test] + public void get_all_with_empty_db_should_return_empty_list() + { + Subject.All().Should().BeEmpty(); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Instrumentation/DatabaseTarget.cs b/NzbDrone.Core/Instrumentation/DatabaseTarget.cs index 7c99b58ac..7d15b947f 100644 --- a/NzbDrone.Core/Instrumentation/DatabaseTarget.cs +++ b/NzbDrone.Core/Instrumentation/DatabaseTarget.cs @@ -22,7 +22,6 @@ namespace NzbDrone.Core.Instrumentation LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, this)); LogManager.ConfigurationReloaded += (sender, args) => Register(); - LogConfiguration.Reload(); } diff --git a/NzbDrone.Test.Common/LoggingTest.cs b/NzbDrone.Test.Common/LoggingTest.cs index 93765a35e..f510ac796 100644 --- a/NzbDrone.Test.Common/LoggingTest.cs +++ b/NzbDrone.Test.Common/LoggingTest.cs @@ -22,7 +22,6 @@ namespace NzbDrone.Test.Common LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", consoleTarget)); RegisterExceptionVerification(); - LogConfiguration.Reload(); } } diff --git a/NzbDrone.Test.Common/TestBase.cs b/NzbDrone.Test.Common/TestBase.cs index 1bd571559..7844e818c 100644 --- a/NzbDrone.Test.Common/TestBase.cs +++ b/NzbDrone.Test.Common/TestBase.cs @@ -53,7 +53,6 @@ namespace NzbDrone.Test.Common MockedRestProvider = new Mock(); ReportingService.RestProvider = MockedRestProvider.Object; - ReportingService.SetupExceptronDriver(); Directory.CreateDirectory(TempFolder); } diff --git a/NzbDrone.Update/NLog.config b/NzbDrone.Update/NLog.config new file mode 100644 index 000000000..1bcb823d5 --- /dev/null +++ b/NzbDrone.Update/NLog.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/NzbDrone.Update/NLog.xsd b/NzbDrone.Update/NLog.xsd new file mode 100644 index 000000000..2203f4ede --- /dev/null +++ b/NzbDrone.Update/NLog.xsd @@ -0,0 +1,2585 @@ + + + + + + + + + + + + + + Watch config file for changes and reload automatically. + + + + + Print internal NLog messages to the console. Default value is: false + + + + + Print internal NLog messages to the console error output. Default value is: false + + + + + Write internal NLog messages to the specified file. + + + + + Log level threshold for internal log messages. Default value is: Info. + + + + + Global log level threshold for application log messages. Messages below this level won't be logged.. + + + + + Pass NLog internal exceptions to the application. Default value is: false. + + + + + + + + + + + + + + Make all targets within this section asynchronous (creates additional threads but the calling thread isn't blocked by any target writes). + + + + + + + + + + + + + + + + + Prefix for targets/layout renderers/filters/conditions loaded from this assembly. + + + + + Load NLog extensions from the specified file (*.dll) + + + + + Load NLog extensions from the specified assembly. Assembly name should be fully qualified. + + + + + + + + + + Name of the logger. May include '*' character which acts like a wildcard. Allowed forms are: *, Name, *Name, Name* and *Name* + + + + + Comma separated list of levels that this rule matches. + + + + + Minimum level that this rule matches. + + + + + Maximum level that this rule matches. + + + + + Level that this rule matches. + + + + + Comma separated list of target names. + + + + + Ignore further rules if this one matches. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the file to be included. The name is relative to the name of the current config file. + + + + + Ignore any errors in the include file. + + + + + + + Variable name. + + + + + Variable value. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Limit on the number of requests in the lazy writer thread request queue. + + + + + Time in milliseconds to sleep between batches. + + + + + Number of log events that should be processed in a batch by the lazy writer thread. + + + + + Action to be taken when the lazy writer thread request queue count exceeds the set limit. + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to use sliding timeout. + + + + + Number of log events to be buffered. + + + + + Timeout (in milliseconds) after which the contents of buffer will be flushed if there's no write in the specified period of time. Use -1 to disable timed flushes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to append newline at the end of log message. + + + + + Instance of that is used to format log messages. + + + + + Action that should be taken if the message is larger than maxMessageSize. + + + + + Maximum message size in bytes. + + + + + Encoding to be used. + + + + + Size of the connection cache (number of connections which are kept alive). + + + + + Network address. + + + + + Indicates whether to keep connection open whenever possible. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + AppInfo field. By default it's the friendly name of the current AppDomain. + + + + + NDC item separator. + + + + + Indicates whether to include stack contents. + + + + + Indicates whether to include NLog-specific extensions to log4j schema. + + + + + Indicates whether to include dictionary contents. + + + + + + + + + + + + + + + + + + + + Layout that should be use to calcuate the value for the parameter. + + + + + Viewer parameter name. + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Footer. + + + + + Header. + + + + + Indicates whether to send the log messages to the standard error instead of the standard output. + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Database user name. If the ConnectionString is not provided this value will be used to construct the "User ID=" part of the connection string. + + + + + Name of the database provider. + + + + + Indicates whether to use database transactions. Some data providers require this. + + + + + Name of the connection string (as specified in <connectionStrings> configuration section. + + + + + Connection string. When provided, it overrides the values specified in DBHost, DBUserName, DBPassword, DBDatabase. + + + + + Indicates whether to keep the database connection open between the log events. + + + + + Database name. If the ConnectionString is not provided this value will be used to construct the "Database=" part of the connection string. + + + + + Database password. If the ConnectionString is not provided this value will be used to construct the "Password=" part of the connection string. + + + + + Database host name. If the ConnectionString is not provided this value will be used to construct the "Server=" part of the connection string. + + + + + Connection string using for installation and uninstallation. If not provided, regular ConnectionString is being used. + + + + + Text of the SQL command to be run on each log level. + + + + + + + + + + + + + + + + + + + + + + + Type of the command. + + + + + Connection string to run the command against. If not provided, connection string from the target is used. + + + + + Indicates whether to ignore failures. + + + + + Command text. + + + + + + + + + + + + + + Layout that should be use to calcuate the value for the parameter. + + + + + Database parameter name. + + + + + Database parameter precision. + + + + + Database parameter scale. + + + + + Database parameter size. + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to return to the first target after any successful write. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + File encoding. + + + + + Line ending mode. + + + + + Size in bytes above which log files will be automatically archived. + + + + + Maximum number of archive files that should be kept. + + + + + Name of the file to be used for an archive. + + + + + Way file archives are numbered. + + + + + Indicates whether to automatically archive log files every time the specified time passes. + + + + + Indicates whether to replace file contents on each write instead of appending log message at the end. + + + + + File attributes (Windows only). + + + + + Name of the file to write to. + + + + + Indicates whether to delete old log file on startup. + + + + + Indicates whether to enable log file(s) to be deleted. + + + + + Indicates whether to create directories if they don't exist. + + + + + Indicates whether concurrent writes to the log file by multiple processes on the same host. + + + + + Maximum number of seconds that files are kept open. If this number is negative the files are not automatically closed after a period of inactivity. + + + + + Number of files to be kept open. Setting this to a higher value may improve performance in a situation where a single File target is writing to many files (such as splitting by level or by logger). + + + + + Indicates whether concurrent writes to the log file by multiple processes on different network hosts. + + + + + Delay in milliseconds to wait before attempting to write to the file again. + + + + + Number of times the write is appended on the file before NLog discards the log message. + + + + + Log file buffer size in bytes. + + + + + Indicates whether to automatically flush the file buffers after each log message. + + + + + Indicates whether to keep log file open instead of opening and closing it on each logging event. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Condition expression. Log events who meet this condition will be forwarded to the wrapped target. + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Message box title. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Method name. The method must be public and static. + + + + + Class name. + + + + + + + + + + + + + + Layout that should be use to calcuate the value for the parameter. + + + + + Name of the parameter. + + + + + Type of the parameter. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Action that should be taken if the message is larger than maxMessageSize. + + + + + Indicates whether to append newline at the end of log message. + + + + + Layout used to format log messages. + + + + + Maximum message size in bytes. + + + + + Encoding to be used. + + + + + Size of the connection cache (number of connections which are kept alive). + + + + + Indicates whether to keep connection open whenever possible. + + + + + Network address. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to append newline at the end of log message. + + + + + Instance of that is used to format log messages. + + + + + Action that should be taken if the message is larger than maxMessageSize. + + + + + Maximum message size in bytes. + + + + + Encoding to be used. + + + + + Size of the connection cache (number of connections which are kept alive). + + + + + Network address. + + + + + Indicates whether to keep connection open whenever possible. + + + + + Indicates whether to include source info (file name and line number) in the information sent over the network. + + + + + Indicates whether to include call site (class and method name) in the information sent over the network. + + + + + AppInfo field. By default it's the friendly name of the current AppDomain. + + + + + NDC item separator. + + + + + Indicates whether to include stack contents. + + + + + Indicates whether to include NLog-specific extensions to log4j schema. + + + + + Indicates whether to include dictionary contents. + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to perform layout calculation. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + Name of the target. + + + + + Default filter to be applied when no specific rule matches. + + + + + + + + + + + + + Condition to be tested. + + + + + Resulting filter to be applied when the condition matches. + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + + Name of the target. + + + + + Number of times to repeat each log message. + + + + + + + + + + + + + + + + Name of the target. + + + + + Time to wait between retries in milliseconds. + + + + + Number of retries that should be attempted on the wrapped target in case of a failure. + + + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + Name of the target. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Web service URL. + + + + + Encoding. + + + + + Protocol to be used when calling web service. + + + + + Web service namespace. + + + + + Web service method name. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Body layout (can be repeated multiple times). + + + + + Footer layout. + + + + + Header layout. + + + + + Quoting mode. + + + + + Quote Character. + + + + + Indicates whether CVS should include header. + + + + + Custom column delimiter value (valid when ColumnDelimiter is set to 'Custom'). + + + + + Column delimiter. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Layout of the column. + + + + + Name of the column. + + + + + + + + + + + + Layout text. + + + + + + + + + + + + + + + + Body layout (can be repeated multiple times). + + + + + Header layout. + + + + + Footer layout. + + + + + + + + + + + + + + + + + + + + + + Condition expression. + + + + + Action to be taken when filter matches. + + + + + + + + + + + + + + + + + + + + + + + + + + Layout to be used to filter log messages. + + + + + Substring to be matched. + + + + + Action to be taken when filter matches. + + + + + Indicates whether to ignore case when comparing strings. + + + + + + + + + + + + + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + Action to be taken when filter matches. + + + + + String to compare the layout to. + + + + + + + + + + + + + + + + + Layout to be used to filter log messages. + + + + + Substring to be matched. + + + + + Action to be taken when filter matches. + + + + + Indicates whether to ignore case when comparing strings. + + + + + + + + + + + + + + + + + Indicates whether to ignore case when comparing strings. + + + + + Layout to be used to filter log messages. + + + + + Action to be taken when filter matches. + + + + + String to compare the layout to. + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to use the XML format when serializing message. + + + + + Encoding to be used when writing text to the queue. + + + + + Layout used to format log messages. + + + + + Indicates whether to use recoverable messages (with guaranteed delivery). + + + + + Indicates whether to create the queue if it doesn't exists. + + + + + Label to associate with each message. + + + + + Name of the queue to write to. + + + + + + + + + + + + + + + + + Name of the target. + + + + + Maximum number of log events that the buffer can keep. + + + + + Indicates whether buffer should grow as needed. + + + + + Number of log events to be buffered. + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + Name of the target. + + + + + Indicates whether to add <!-- --> comments around all written texts. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Text to be rendered. + + + + + Header. + + + + + Footer. + + + + + Indicates whether to use default row highlighting rules. + + + + + Indicates whether the error stream (stderr) should be used instead of the output stream (stdout). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Background color. + + + + + Condition that must be met in order to set the specified foreground and background color. + + + + + Foreground color. + + + + + + + + + + + + + + + Background color. + + + + + Foreground color. + + + + + Indicates whether to ignore case when comparing texts. + + + + + Regular expression to be matched. You must specify either text or regex. + + + + + Text to be matched. You must specify either text or regex. + + + + + Indicates whether to match whole words only. + + + + + + + + + + + + + + + Name of the target. + + + + + Footer. + + + + + Text to be rendered. + + + + + Header. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Name of the machine on which Event Log service is running. + + + + + Value to be used as the event Source. + + + + + Layout that renders event Category. + + + + + Layout that renders event ID. + + + + + Name of the Event Log to write to. This can be System, Application or any user-defined name. + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Indicates whether log text should be appended to the text of the control instead of overwriting it. + + + + + Name of control to which NLog will log write log text. + + + + + Name of the Form on which the control is located. + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Username to change context to. + + + + + User account password. + + + + + Indicates whether to revert to the credentials of the process instead of impersonating another user. + + + + + Required impersonation level. + + + + + Windows domain name to change context to. + + + + + Logon Type. + + + + + Type of the logon provider. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Header. + + + + + Footer. + + + + + Text to be rendered. + + + + + Indicates whether to send message as HTML instead of plain text. + + + + + Indicates whether to add new lines between log entries. + + + + + Encoding to be used for sending e-mail. + + + + + Mail subject. + + + + + Recipients' email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + BCC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + CC email addresses separated by semicolons (e.g. john@domain.com;jane@domain.com). + + + + + Sender's email address (e.g. joe@domain.com). + + + + + Mail message body (repeated for each log message send in one mail). + + + + + Username used to connect to SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + Indicates whether SSL (secure sockets layer) should be used when communicating with SMTP server. + + + + + Password used to authenticate against SMTP server (used when SmtpAuthentication is set to "basic"). + + + + + SMTP Authentication mode. + + + + + SMTP Server to be used for sending. + + + + + Port number that SMTP Server is listening on. + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Performance counter instance name. + + + + + Counter help text. + + + + + Performance counter type. + + + + + Indicates whether performance counter should be automatically created. + + + + + Name of the performance counter category. + + + + + Name of the performance counter. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + Initial height of the form with rich text box. + + + + + Indicates whether scroll bar will be moved automatically to show most recent log entries. + + + + + Maximum number of lines the rich text box will store (or 0 to disable this feature). + + + + + Indicates whether the created form will be initially minimized. + + + + + Indicates whether the created window will be a tool window. + + + + + Name of RichTextBox to which Nlog will write. + + + + + Name of the Form on which the control is located. If there is no open form of a specified name than NLog will create a new one. + + + + + Initial width of the form with rich text box. + + + + + Indicates whether to use default coloring rules. + + + + + + + + + + + + + + + + + + + + + + + + + + + Background color. Names are identical with KnownColor enum extended with Empty value which means that background color won't be changed. + + + + + Font color. Names are identical with KnownColor enum extended with Empty value which means that font color won't be changed. + + + + + Indicates whether to ignore case when comparing texts. + + + + + Regular expression to be matched. You must specify either text or regex. + + + + + Font style of matched text. Possible values are the same as in FontStyle enum in System.Drawing. + + + + + Text to be matched. You must specify either text or regex. + + + + + Indicates whether to match whole words only. + + + + + + + + + + + + + Background color. + + + + + Condition that must be met in order to set the specified font color. + + + + + Font color. + + + + + Font style of matched text. + + + + + + + + + + + + + Name of the target. + + + + + Layout used to format log messages. + + + + + + + + + + + + + + + + + + + + Name of the target. + + + + + Name of the endpoint configuration in WCF configuration file. + + + + + Endpoint address. + + + + + Indicates whether to use binary message encoding. + + + + + Client ID. + + + + + Indicates whether to include per-event properties in the payload sent to the server. + + + + + + \ No newline at end of file diff --git a/NzbDrone.Update/NzbDrone.Update.csproj b/NzbDrone.Update/NzbDrone.Update.csproj index 3648baaed..e7d397d25 100644 --- a/NzbDrone.Update/NzbDrone.Update.csproj +++ b/NzbDrone.Update/NzbDrone.Update.csproj @@ -45,6 +45,13 @@ False ..\packages\Autofac.3.0.1\lib\net40\Autofac.Configuration.dll + + False + ..\packages\Exceptron.Client.1.0.20\lib\net20\Exceptron.Client.dll + + + ..\packages\Exceptron.Nlog.1.0.11\lib\net20\Exceptron.NLog.dll + ..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll @@ -62,6 +69,12 @@ + + Always + + + Designer + diff --git a/NzbDrone.Update/Program.cs b/NzbDrone.Update/Program.cs index 66eb95c11..08d6ce2c8 100644 --- a/NzbDrone.Update/Program.cs +++ b/NzbDrone.Update/Program.cs @@ -31,7 +31,9 @@ namespace NzbDrone.Update builder.RegisterAssemblyTypes(typeof(UpdateProvider).Assembly).SingleInstance(); builder.RegisterAssemblyTypes(typeof(RestProvider).Assembly).SingleInstance(); _container = builder.Build(); - InitLoggers(); + + ReportingService.RestProvider = _container.Resolve(); + logger.Info("Updating NzbDrone to version {0}", _container.Resolve().Version); _container.Resolve().Start(args); @@ -59,18 +61,6 @@ namespace NzbDrone.Update } } - private static void InitLoggers() - { - ReportingService.RestProvider = _container.Resolve(); - ReportingService.SetupExceptronDriver(); - - LogConfiguration.RegisterRemote(); - - var logPath = Path.Combine(new EnvironmentProvider().GetSandboxLogFolder(), DateTime.Now.ToString("yyyy.MM.dd-H-mm") + ".txt"); - LogConfiguration.RegisterFileLogger(logPath, LogLevel.Info); - - LogConfiguration.Reload(); - } public void Start(string[] args) { diff --git a/NzbDrone.Update/packages.config b/NzbDrone.Update/packages.config index 78ca540ff..c7925bcf8 100644 --- a/NzbDrone.Update/packages.config +++ b/NzbDrone.Update/packages.config @@ -1,5 +1,9 @@  + + + + \ No newline at end of file diff --git a/NzbDrone.ncrunchsolution b/NzbDrone.ncrunchsolution index 6cb47a29a..444b34b1d 100644 --- a/NzbDrone.ncrunchsolution +++ b/NzbDrone.ncrunchsolution @@ -2,6 +2,7 @@ 1 False true + true UseDynamicAnalysis Disabled Disabled diff --git a/NzbDrone/CentralDispatch.cs b/NzbDrone/CentralDispatch.cs index eff74a6d5..5268090a5 100644 --- a/NzbDrone/CentralDispatch.cs +++ b/NzbDrone/CentralDispatch.cs @@ -17,7 +17,7 @@ namespace NzbDrone var builder = new ContainerBuilder(); BindKernel(builder); container = builder.Build(); - InitilizeApp(); + InitializeApp(); } public static IContainer Container @@ -37,16 +37,12 @@ namespace NzbDrone builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()); } - private static void InitilizeApp() + private static void InitializeApp() { var environmentProvider = container.Resolve(); ReportingService.RestProvider = container.Resolve(); - ReportingService.SetupExceptronDriver(); - LogConfiguration.RegisterRollingFileLogger(environmentProvider.GetLogFileName(), LogLevel.Info); - LogConfiguration.RegisterRemote(); - LogConfiguration.Reload(); logger.Info("Start-up Path:'{0}'", environmentProvider.ApplicationPath); } } diff --git a/NzbDrone/NLog.config b/NzbDrone/NLog.config index 61c6ca938..830802407 100644 --- a/NzbDrone/NLog.config +++ b/NzbDrone/NLog.config @@ -1,6 +1,17 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + autoReload="true" + internalLogLevel="Info" + throwExceptions="true" + internalLogToConsole="false" + internalLogToConsoleError="true" + internalLogFile="nlog.txt"> + + + + + @@ -9,9 +20,16 @@ ${exception:format=ToString} + + + + \ No newline at end of file diff --git a/NzbDrone/NzbDrone.Console.csproj b/NzbDrone/NzbDrone.Console.csproj index a5730ad8f..d06c1fce9 100644 --- a/NzbDrone/NzbDrone.Console.csproj +++ b/NzbDrone/NzbDrone.Console.csproj @@ -72,11 +72,12 @@ False ..\packages\Autofac.3.0.1\lib\net40\Autofac.Configuration.dll - - True + + False + ..\packages\Exceptron.Client.1.0.20\lib\net20\Exceptron.Client.dll - - True + + ..\packages\Exceptron.Nlog.1.0.11\lib\net20\Exceptron.NLog.dll False diff --git a/NzbDrone/packages.config b/NzbDrone/packages.config index b257e3b6d..bcfe36c81 100644 --- a/NzbDrone/packages.config +++ b/NzbDrone/packages.config @@ -1,6 +1,8 @@  + +