【发布时间】:2017-07-26 19:23:49
【问题描述】:
上下文
注意:log4net 与问题无关,只是为更多诊断事实编写上下文
我正在使用 log4net RollingFileAppender 和 DebugAppener。该应用程序可以在控制台模式下启动,也可以作为服务安装。启动 stanalone 时,所有 DebugAppener 都会转到通过 Mark Russinovich 的 DebugView 确认的 OutputDebugString。 作为服务运行时,仅写入文件日志,不输出 OutputDebugString。
诊断
- 该问题不与 log4net 或 DebugAppender 相关。一样的 纯 Debug.WriteLine("Hello world") 调用会出现问题
- 服务作为 LocalSystem 运行(所以可能不是权限问题)
- 两种情况下文件都正确写入
问题
我错过了什么?作为服务运行时如何写入 OutputDebugString(使用 log4net DebugAppender)?
【问题讨论】:
-
这确实是个骗子。对不起
标签: c# debugging windows-services outputdebugstring