LogException或任何派生函数(例如ErrorException等)似乎完全忽略了传入的异常参数.
LogException or any of the derived functions like ErrorException etc. seem to totally ignore the exception parameter passed in.
我在nlog.config文件中缺少格式属性吗? 我正在使用Nlog在VS中安装的模板中的样板.
Am I missing a format attribute in my nlog.config file? I am using the boilerplate from the template that Nlog installs in VS.
我希望将来自异常对象和内部异常的信息添加到日志文件中.但是,添加到日志文件的唯一信息是传递给函数的字符串参数.
I would expect information from the exception object AND inner exceptions to be added to the log file. Yet the only information added to the log file is the string parameter passed to the function.
事实证明,ErrorException()实际上没有Error()
Turns out that ErrorException() is actually less useful than Error()
如何获得更多的深度报告.特别是所有内部Exceptions的Message属性的完整递归转储?
How can I get more in depth reporting. Particularly a full recursive dump of the Message property of all inner Exceptions?
推荐答案在布局配置中将${exception}标签添加或替换为${exception:format=tostring}
Add or replace the ${exception} tag in the layout config to ${exception:format=tostring}
<targets> <target name="errorLogFile" xsi:type="File" fileName="errors.txt" layout="${message} ${exception:format=tostring}"/> </targets>更多推荐
NLog LogException似乎忽略了该异常
发布评论