【发布时间】:2015-12-07 17:01:10
【问题描述】:
Nlog 中是否有办法仅在 Exception 不为 null 时才输出某些字符。例如我的布局是:
layout="${longdate}|${callsite:skipFrames=1}|${message}|${exception:format=tostring}"
如果我调用NLog.Debug("Hello"),输出将是:
2015-12-07 11:50:00.5114|MyDll.MyClass.MyMethod|Hello|
正在打印最后一个字符|。有没有办法防止这种情况发生,并且只有在打印实际异常时才将其打印出来?
【问题讨论】: