【发布时间】:2016-06-01 14:10:57
【问题描述】:
我安装了 stackify(它在另一个项目中运行良好)并且无法让它报告该项目的任何内容。所有配置文件/等完全匹配。我错过了什么明显的东西吗?
配置文件:
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<add key="Stackify.AppName" value="[app name]" />
<add key="Stackify.Environment" value="Development" />
<add key="Stackify.ProxyServer" value="" />
<add key="Stackify.ApiKey" value="[key]" />
<nlog>
<extensions>
<add assembly="StackifyLib.nLog" />
</extensions>
<targets>
<target name="stackify" type="StackifyTarget" globalContextKeys="" mappedContextKeys="" callContextKeys="" logMethodNames="true" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="stackify" />
</rules>
</nlog>
调用它(没有调用工作,只是一个例子):
LogManager.GetCurrentClassLogger().Log(LogLevel.Error, ex);
据我所知,它与工作项目完全相同,只是它不起作用。我错过了什么吗?
谢谢, 詹姆斯
【问题讨论】:
-
我花了几个小时基本上确定它只会在单步执行应用程序时写入 - 如果你只是运行它,它不会记录,如果你在调试中单步执行,它会。我刚刚切换到标准 nLog,效果很好。
-
James,您可以在应用关闭之前添加
StackifyLib.Logger.Shutdown();。