deo*_*oll 7 c# mono trace ms-tracing-eventsource
这是我的项目结构:
.
|-- app.config
|-- bin
| `-- Debug
|-- NLog.config
|-- NLog.xsd
|-- obj
| `-- Debug
|-- packages.config
|-- Program.cs
|-- Properties
| `-- AssemblyInfo.cs
|-- ServiceClient.csproj
`-- Web References
`-- TestSvc
|-- Reference.cs
|-- Reference.map
|-- TestService.disco
`-- TestService.wsdl
7 directories, 14 files
Run Code Online (Sandbox Code Playgroud)
我使用下面的mcs命令手动编译了项目:
mcs -d:TRACE -d:DEBUG -r:System.Web.Services.dll -out:./bin/Debug/ServiceClient.exe Web\ References/TestSvc/Reference.cs Program.cs
Run Code Online (Sandbox Code Playgroud)
我甚app.config至将目标文件夹复制为ServiceClient.exe.config
下面是配置的样子:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<sharedListeners>
<add name="console" type="System.Diagnostics.ConsoleTraceListener"/>
<add name="nlog" type="NLog.NLogTraceListener,Nlog"/>
</sharedListeners>
<sources>
<source name="System.Net" switchValue="All">
<listeners>
<add name="nlog"/>
</listeners>
</source>
<source name="System.Net.Sockets" switchValue="All">
<listeners>
<add name="nlog"/>
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
Run Code Online (Sandbox Code Playgroud)
但是当我跑步时:
mono ServiceClient.exe "hello world"
Run Code Online (Sandbox Code Playgroud)
我看不到跟踪输出......
小智 0
请尝试Mono 日志分析器。
基本上你需要像这样运行你的应用程序:
mono --profile=log ServiceClient.exe "hello world"
Run Code Online (Sandbox Code Playgroud)
它将output.mlpd在同一目录中生成一个文件。看见了:
mprof-report output.mlpd
Run Code Online (Sandbox Code Playgroud)