diff --git a/NLog.config b/NLog.config
index c47561e..2559bd8 100644
--- a/NLog.config
+++ b/NLog.config
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/Torch.Server/Views/TorchUI.xaml.cs b/Torch.Server/Views/TorchUI.xaml.cs
index b630fe2..29a8fdf 100644
--- a/Torch.Server/Views/TorchUI.xaml.cs
+++ b/Torch.Server/Views/TorchUI.xaml.cs
@@ -14,6 +14,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using NLog;
+using NLog.Targets.Wrappers;
using Sandbox;
using Torch.API;
using Torch.API.Managers;
@@ -57,7 +58,13 @@ namespace Torch.Server
private void AttachConsole()
{
- var doc = LogManager.Configuration.FindTargetByName("wpf")?.Document;
+ const string target = "wpf";
+ var doc = LogManager.Configuration.FindTargetByName(target)?.Document;
+ if (doc == null)
+ {
+ var wrapped = LogManager.Configuration.FindTargetByName(target);
+ doc = (wrapped?.WrappedTarget as FlowDocumentTarget)?.Document;
+ }
ConsoleText.Document = doc ?? new FlowDocument(new Paragraph(new Run("No target!")));
ConsoleText.TextChanged += (sender, args) => ConsoleText.ScrollToEnd();
}