private void ConfigureCaptureTarget() { this.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 }; NLog.LogManager.Configuration.AddTarget(asyncWrapper.Name, asyncWrapper); currentLogLevel = NLog.LogLevel.Info; loggingRule = new LoggingRule("*", currentLogLevel, asyncWrapper); NLog.LogManager.Configuration.LoggingRules.Insert(0, loggingRule); NLog.LogManager.ReconfigExistingLoggers(); this.PropertyChanged += OnPropertyChanged; #if DEBUG this.DebugEnabled = true; #endif }