我正在运行ServiceFabric(预览版1.4.87)的第一个示例:https://azure.microsoft.com/en-us/documentation/articles/service-fabric-create-your-first-application-in-visual-studio/,以创建有状态服务,尽管该示例运行正常,但在诊断窗口中没有看到ETW输出日志信息。

对logt的调用是对ServiceEventSource.Current.ServiceMessage(...)进行的,但是运行此方法(在ServiceEventSource.cs中实现)时,对this.IsEnabled()的调用将返回false,因此不会编写任何诊断信息。如果我在调试中绕过了IsEnabled()调用,则仍然没有任何内容写入诊断窗口,该窗口仅包含应用程序的启动消息。

“诊断”中配置的提供者是默认提供者:

Microsoft-ServiceFabric-Actors
Microsoft-ServiceFabric-Services
cbd93bc2-71e5-4566-b3a7-595d8eeca6e8:5:0x4000000000000000

我已经将Microsoft-ServiceFabric添加到此列表中,但这只是为我提供了更多日志记录,但仍不是我的输出消息。

我还运行了PerfView,然后查看了可用的提供程序,上面的前两个不存在:Microsoft-ServiceFabric-Actors和Microsoft-ServiceFabric-Services。

任何想法?这似乎是纯粹的ETW问题,也可能是安装过程中出现的某种ServiceFabric错误,而诊断窗口中的提供者规范可能不正确。

我正在运行Win10,VS2015 Enterprise x64。

[编辑]
Program.cs中的ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(MyStatefulService).Name)调用也不会写入任何内容。我仅有的消息是:
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.

(为其他节点重复)

最佳答案

要查看您的EventSource中的事件,您需要在“诊断”窗口中将其名称添加到提供程序列表中。查看ServiceEventSource定义,它将在其上具有[EventSource(Name =“xxx”)]属性。这是您需要在提供程序列表中使用的名称('xxx')。

启动Diagnostics Windows时,Visual Studio通常会自动检测解决方案中的EventSource。不知道为什么它不适合您,但是手动添加应该可以解决问题。

关于etw - Azure ServiceFabric示例未记录到ETW,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35323790/

10-10 02:57