private void ConfigureCaptureTarget() { captureTarget = new CaptureTarget { Layout = "${date}|${level:uppercase=true}|${logger}|${message}${onexception:inner=${newline}${exception:format=tostring}}" }; captureTarget.LogReceived += target_LogReceived; var asyncWrapper = new AsyncTargetWrapper { Name = "CaptureTargetWrapper", WrappedTarget = captureTarget }; LogManager.Configuration.AddTarget(asyncWrapper.Name, asyncWrapper); currentLogLevel = NLog.LogLevel.Info; loggingRule = new LoggingRule("*", currentLogLevel, asyncWrapper); LogManager.Configuration.LoggingRules.Insert(0, loggingRule); LogManager.ReconfigExistingLoggers(); PropertyChanged += OnPropertyChanged; #if DEBUG DebugEnabled = true; #endif }