是否可以在 Visual Studio 2017 调试窗口中显示 NLog(或内置调试器)正在记录的内容?
我已将 NLog 设置为输出到文件,但对于开发来说,能够在调试窗口中查看调试消息将非常方便。我可以看到有关如何使用控制台执行此操作的文章,但对于 ASP.NET 项目,没有任何控制台输出,只有调试窗口。
简单的解决方案就是使用OutputDebugString
-target(Net Core 支持)
https://github.com/NLog/NLog/wiki/OutputDebugString-target https://github.com/NLog/NLog/wiki/OutputDebugString-target
例子:
<targets>
<target name="debugger" xsi:type="OutputDebugString" layout="${logger}::${message}"/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="debugger" />
</rules>
另一种可以使用xsi:type="debugger"
:
https://github.com/NLog/NLog/wiki/Debugger-target https://github.com/NLog/NLog/wiki/Debugger-target
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)