【发布时间】:2012-09-19 16:18:06
【问题描述】:
我的NLog配置如下
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="file" xsi:type="File" fileName="${basedir}/log${shortdate}.txt" archiveAboveSize="500000" archiveEvery="Day" archiveNumbering="Rolling" maxArchiveFiles="10" layout="${date:format=s}|${level}|${callsite}|${identity}|${message}|${exception:format=stacktrace}"/>
<!--<target name="console" xsi:type="Console" />-->
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="file" />
<!--<logger name="*" minlevel="Debug" writeTo="console" />-->
</rules>
</nlog>
但是发生异常时没有记录堆栈跟踪。 NLog 有 bug 吗?
我已经创建了一个围绕 Nlog 的包装器,我的日志记录如下
public void Error(string message, Exception ex)
{
logger.Error(message, ex);
}
我在日志中得到消息,但没有堆栈跟踪。
提前致谢
【问题讨论】:
-
TrustyCoder - 你能把代码贴在你使用 NLog 输出异常的地方吗?你还在 NLog 中得到任何输出吗?
标签: c# logging stack-trace nlog