Azure ServiceFabric示例未记录到ETW [英] Azure ServiceFabric samples not logging to ETW
问题描述
我正在运行ServiceFabric的第一个示例(预览版1.4.87):
I'm running the very first sample of ServiceFabric (Preview version 1.4.87): https://azure.microsoft.com/en-us/documentation/articles/service-fabric-create-your-first-application-in-visual-studio/ , to create a stateful service, and although the sample is running correctly, I'm not seeing the ETW output log information in the diagnostics window.
对ServiceEventSource.Current.ServiceMessage(...)
进行了日志调用,但是运行此方法(在ServiceEventSource.cs中实现)时,对this.IsEnabled()
的调用返回false,因此不编写任何诊断信息.如果我在调试中绕过IsEnabled()
调用,则仍然没有任何内容写入诊断窗口,该窗口仅包含应用程序的启动消息.
The calls to log are made to ServiceEventSource.Current.ServiceMessage(...)
, but when this method (implemented in ServiceEventSource.cs) runs, the call to this.IsEnabled()
returns false so no diagnostics are written. If I bypass the IsEnabled()
call in debug, still nothing is written to the diagnostics window, which just contains the application's startup messages.
诊断"中配置的提供者是默认提供者:
The providers configured in the Diagnostics are the default ones:
Microsoft-ServiceFabric-Actors
Microsoft-ServiceFabric-Services
cbd93bc2-71e5-4566-b3a7-595d8eeca6e8:5:0x4000000000000000
我已将Microsoft-ServiceFabric添加到此列表中,但这使我获得了更多的日志记录,但仍然不是我的输出消息.
I've added Microsoft-ServiceFabric to this list, but this just gets me much more logging but still not my output messages.
我还运行过PerfView,然后查看可用的提供程序,上面的前两个不存在:Microsoft-ServiceFabric-Actors和Microsoft-ServiceFabric-Services.
I've also ran PerfView, and then looking at the available providers, the first two above are not there: Microsoft-ServiceFabric-Actors and Microsoft-ServiceFabric-Services.
有什么主意吗?这似乎是纯粹的ETW问题,也可能是安装程序中出现某种ServiceFabric错误,而诊断窗口中的提供者规格可能不正确.
Any idea? This seems to be either a pure ETW issue or some kind of ServiceFabric error in setup, with maybe incorrect Provider specs in the diagnostics window.
我正在运行Win10,VS2015 Enterprise x64.
I'm running Win10, VS2015 Enterprise x64.
Program.cs中的ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(MyStatefulService).Name)
调用也不会写入任何内容.我仅有的消息是:
The call ServiceEventSource.Current.ServiceTypeRegistered(Process.GetCurrentProcess().Id, typeof(MyStatefulService).Name)
in Program.cs also doesn't write anything out. The only messages I have are:
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').
To see events from your EventSource you need to add its name to the list of providers in the Diagnostics window. Look at the ServiceEventSource definition, it will have an [EventSource(Name="xxx")] attribute on it. That is the name ('xxx') you need to be on the list of providers.
启动Diagnostics Windows时,Visual Studio通常会自动检测解决方案中的EventSource.不确定为什么它不适合您,但是手动添加应该可以解决问题.
Visual Studio will usually take care of automatically detecting EventSources in your solution when Diagnostics Windows is launched; not sure why it is not working for you, but adding it manually should do the trick.
这篇关于Azure ServiceFabric示例未记录到ETW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!