windows .NET 跟踪日志查看器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3529576/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
.NET Trace log viewer
提问by tgandrews
I have enabled trace logging in .NET to output the network data going back and forth so I can see the SOAP requests being sent to a web service. This seems to be the best way on a site that I can't debug or add a proxy between itself and the web service.
我在 .NET 中启用了跟踪日志记录来输出来回传输的网络数据,因此我可以看到发送到 Web 服务的 SOAP 请求。这似乎是我无法调试或在其自身与 Web 服务之间添加代理的站点上的最佳方式。
Here are the lines I've added to the web.config to enable it:
以下是我添加到 web.config 以启用它的行:
<system.diagnostics>
<trace autoflush="true"/>
<sources>
<source name="System.Net" maxdatasize="1024">
<listeners>
<add name="TraceFile"/>
</listeners>
</source>
<source name="System.Net.Sockets" maxdatasize="1024">
<listeners>
<add name="TraceFile"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="TraceFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="images/trace.log"/>
</sharedListeners>
<switches>
<add name="System.Net" value="Verbose"/>
<add name="System.Net.Sockets" value="Verbose"/>
</switches>
</system.diagnostics>
Does anyone know of a log viewer for this? My searching has come up fruitless.
有没有人知道这个的日志查看器?我的搜索没有结果。
回答by Ladislav Mrnka
If you change listener to XmlWriterTraceListener you can use SvcTraceViewer.exeto open the trace file. It is supposed to be used with WCF tracing and message logging but it works with any valid traces from XmlWriterTraceListener.
如果将侦听器更改为 XmlWriterTraceListener,则可以使用SvcTraceViewer.exe打开跟踪文件。它应该与 WCF 跟踪和消息日志记录一起使用,但它可以与来自 XmlWriterTraceListener 的任何有效跟踪一起使用。