aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Common.Implementations/Logging/NlogManager.cs2
-rw-r--r--MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs11
-rw-r--r--MediaBrowser.ServerApplication/MainWindow.xaml.cs25
3 files changed, 24 insertions, 14 deletions
diff --git a/MediaBrowser.Common.Implementations/Logging/NlogManager.cs b/MediaBrowser.Common.Implementations/Logging/NlogManager.cs
index c5296dcfb..ec93fbd8e 100644
--- a/MediaBrowser.Common.Implementations/Logging/NlogManager.cs
+++ b/MediaBrowser.Common.Implementations/Logging/NlogManager.cs
@@ -68,7 +68,7 @@ namespace MediaBrowser.Common.Implementations.Logging
/// </summary>
/// <param name="target">The target.</param>
/// <param name="level">The level.</param>
- private void AddLogTarget(Target target, LogSeverity level)
+ public void AddLogTarget(Target target, LogSeverity level)
{
var config = LogManager.Configuration;
config.AddTarget(target.Name, target);
diff --git a/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs b/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs
index 226cd8e87..31739577f 100644
--- a/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs
+++ b/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs
@@ -42,13 +42,14 @@ namespace MediaBrowser.ServerApplication.Logging
/// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
void LogWindow_Loaded(object sender, RoutedEventArgs e)
{
- var target = new TraceTarget
+ ((NlogManager)_logManager).RemoveTarget("LogWindowTraceTarget");
+
+ ((NlogManager)_logManager).AddLogTarget(new TraceTarget
{
- Layout = "${longdate}, ${level}, ${logger}, ${message}"
- };
+ Layout = "${longdate}, ${level}, ${logger}, ${message}",
+ Name = "LogWindowTraceTarget"
- ((NlogManager)_logManager).RemoveTarget("LogWindowTraceTarget");
- AddLogTarget(target, "LogWindowTraceTarget");
+ }, LogSeverity.Debug);
}
/// <summary>
diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml.cs b/MediaBrowser.ServerApplication/MainWindow.xaml.cs
index 8306ec541..80f959b8b 100644
--- a/MediaBrowser.ServerApplication/MainWindow.xaml.cs
+++ b/MediaBrowser.ServerApplication/MainWindow.xaml.cs
@@ -80,7 +80,7 @@ namespace MediaBrowser.ServerApplication
{
DataContext = this;
- Instance_ConfigurationUpdated(null, EventArgs.Empty);
+ UpdateButtons();
_logManager.LoggerLoaded += LoadLogWindow;
_configurationManager.ConfigurationUpdated += Instance_ConfigurationUpdated;
@@ -93,6 +93,21 @@ namespace MediaBrowser.ServerApplication
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
void Instance_ConfigurationUpdated(object sender, EventArgs e)
{
+ UpdateButtons();
+
+ Dispatcher.InvokeAsync(() =>
+ {
+ var logWindow = App.Instance.Windows.OfType<LogWindow>().FirstOrDefault();
+
+ if ((logWindow == null && _configurationManager.Configuration.ShowLogWindow) || (logWindow != null && !_configurationManager.Configuration.ShowLogWindow))
+ {
+ _logManager.ReloadLogger(_configurationManager.Configuration.EnableDebugLevelLogging ? LogSeverity.Debug : LogSeverity.Info);
+ }
+ });
+ }
+
+ private void UpdateButtons()
+ {
Dispatcher.InvokeAsync(() =>
{
var developerToolsVisibility = _configurationManager.Configuration.EnableDeveloperTools
@@ -102,13 +117,6 @@ namespace MediaBrowser.ServerApplication
separatorDeveloperTools.Visibility = developerToolsVisibility;
cmdReloadServer.Visibility = developerToolsVisibility;
cmOpenExplorer.Visibility = developerToolsVisibility;
-
- var logWindow = App.Instance.Windows.OfType<LogWindow>().FirstOrDefault();
-
- if ((logWindow == null && _configurationManager.Configuration.ShowLogWindow) || (logWindow != null && !_configurationManager.Configuration.ShowLogWindow))
- {
- _logManager.ReloadLogger(_configurationManager.Configuration.EnableDebugLevelLogging ? LogSeverity.Debug : LogSeverity.Info);
- }
});
}
@@ -120,6 +128,7 @@ namespace MediaBrowser.ServerApplication
void LoadLogWindow(object sender, EventArgs args)
{
CloseLogWindow();
+
Dispatcher.InvokeAsync(() =>
{
// Add our log window if specified