From 2e511fba839e86d9393e5eeb10795f1b0aed7ce0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 20 Sep 2013 21:04:14 -0400 Subject: support run as service --- .../BaseApplicationHost.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'MediaBrowser.Common.Implementations/BaseApplicationHost.cs') diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index f333eb22c..c0ac6a4b3 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -1,6 +1,5 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Events; -using MediaBrowser.Common.Implementations.Logging; using MediaBrowser.Common.Implementations.NetworkManagement; using MediaBrowser.Common.Implementations.ScheduledTasks; using MediaBrowser.Common.Implementations.Security; @@ -71,7 +70,7 @@ namespace MediaBrowser.Common.Implementations /// Gets the application paths. /// /// The application paths. - protected TApplicationPathsType ApplicationPaths = new TApplicationPathsType(); + protected TApplicationPathsType ApplicationPaths { get; private set; } /// /// The container @@ -153,11 +152,12 @@ namespace MediaBrowser.Common.Implementations /// /// Initializes a new instance of the class. /// - protected BaseApplicationHost() + protected BaseApplicationHost(TApplicationPathsType applicationPaths, ILogManager logManager) { FailedAssemblies = new List(); - LogManager = new NlogManager(ApplicationPaths.LogDirectoryPath, LogFilePrefixName); + ApplicationPaths = applicationPaths; + LogManager = logManager; ConfigurationManager = GetConfigurationManager(); } @@ -172,7 +172,10 @@ namespace MediaBrowser.Common.Implementations Logger = LogManager.GetLogger("App"); - LogManager.ReloadLogger(ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging ? LogSeverity.Debug : LogSeverity.Info); + LogManager.LogSeverity = ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging + ? LogSeverity.Debug + : LogSeverity.Info; + OnLoggerLoaded(); DiscoverTypes(); @@ -211,12 +214,6 @@ namespace MediaBrowser.Common.Implementations /// IEnumerable{Assembly}. protected abstract IEnumerable GetComposablePartAssemblies(); - /// - /// Gets the name of the log file prefix. - /// - /// The name of the log file prefix. - protected abstract string LogFilePrefixName { get; } - /// /// Gets the configuration manager. /// -- cgit v1.2.3