Joã*_*ins 9 etw azure-service-fabric
我正在运行ServiceFabric的第一个样本(预览版本1.4.87):https://azure.microsoft.com/en-us/documentation/articles/service-fabric-create-your-first-application-in- visual-studio /,用于创建有状态服务,虽然示例运行正常,但我没有在诊断窗口中看到ETW输出日志信息.
对日志进行调用ServiceEventSource.Current.ServiceMessage(...),但是当此方法(在ServiceEventSource.cs中实现)运行时,调用this.IsEnabled()返回false,因此不会写入任何诊断信息.如果我IsEnabled()在调试中绕过调用,仍然没有任何内容写入诊断窗口,该窗口只包含应用程序的启动消息.
诊断程序中配置的提供程序是默认提供程序:
Microsoft-ServiceFabric-Actors
Microsoft-ServiceFabric-Services
cbd93bc2-71e5-4566-b3a7-595d8eeca6e8:5:0x4000000000000000
Run Code Online (Sandbox Code Playgroud)
我已将Microsoft-ServiceFabric添加到此列表中,但这只会让我获得更多日志记录,但仍然不是我的输出消息.
我还运行了PerfView,然后查看可用的提供程序,上面的前两个不在那里:Microsoft-ServiceFabric-Actors和Microsoft-ServiceFabric-Services.
任何的想法?这似乎是纯ETW问题或设置中的某种ServiceFabric错误,诊断窗口中的提供程序规范可能不正确.
我正在运行Win10,VS2015 Enterprise x64.
[编辑]ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(MyStatefulService).Name) Program.cs中
的调用也不会写出任何内容.我唯一的消息是:
Service Created: Service fabric:/MyApplication/MyStatefulService partition 9505f2b3-dee5-4ea7-96b7-c861407b5283 of ServiceType MyStatefulServiceType created in Application fabric:/MyApplication ApplicationType MyApplicationType.
RunAsync has been invoked for a stateful service replica. Application Type Name: MyApplicationType, Application Name: fabric:/MyApplication, Service Type Name: MyStatefulServiceType, Service Name: fabric:/MyApplication/MyStatefulService, Partition Id: 9505f2b3-dee5-4ea7-96b7-c861407b5283, Replica Id: 130996049833056865",
The Resource Balancer completed the Creation phase and consequently issued the action -- Add on Service -- fabric:/MyApplication/MyStatefulService Partition -- 9505f2b3-dee5-4ea7-96b7-c861407b5283 with (if relevant) SourceNode -- N/A and TargetNode -- Node.2.
Run Code Online (Sandbox Code Playgroud)
(重复其他节点)
小智 15
要查看EventSource中的事件,您需要将其名称添加到"诊断"窗口中的提供程序列表中.查看ServiceEventSource定义,它将具有[EventSource(Name ="xxx")]属性.这是您需要在提供者列表中的名称('xxx').
启动诊断Windows时,Visual Studio通常会自动检测解决方案中的EventSources; 不知道为什么它不适合你,但手动添加它应该可以解决问题.