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.
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
I've added Microsoft-ServiceFabric to this list, but this just gets me much more logging but still not my output messages.
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.
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.
I'm running Win10, VS2015 Enterprise x64.
[Edit]
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.
(repeat for the other nodes)
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With