Gue*_*lla 4 nlog asp.net-core visual-studio-2017
是否可以在 Visual Studio 2017 调试窗口中显示 NLog(或内置调试器)正在记录的内容?
我已将 NLog 设置为输出到文件,但对于开发而言,能够在调试窗口中查看调试消息会非常方便。我可以看到有关如何使用控制台执行此操作的文章,但是对于 asp.net 项目,没有任何控制台输出,只有调试窗口。
简单的解决方案就是使用OutputDebugString-target(NetCore 支持)
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>
Run Code Online (Sandbox Code Playgroud)
另一种可以使用xsi:type="debugger":
https://github.com/NLog/NLog/wiki/Debugger-target
| 归档时间: |
|
| 查看次数: |
2489 次 |
| 最近记录: |