I am trying to log the ETW events by enabling Azure Diagnostics in my cloud service. After deployment, if I check in the Diagnostics Configuration dialog, ETW logs seems to enabled. Also, all the WAD* tables get created but my custom ETW tables specified in diagnostics.wadcgfx file are not created at all. Here is the logging code -
public sealed class VstsEventSourceWriter : EventSource
{
public void LogException(int eventId, string ErrorMessage, string ExceptionType, string ExceptionMessage, string Stacktrace)
{
if (IsEnabled())
{
WriteEvent(eventId, ErrorMessage, ExceptionType, ExceptionMessage, Stacktrace);
}
}
}
code in diagnostics.wadcfgx -
<EtwProviders>
<EtwEventSourceProviderConfiguration provider="VstsEventSourceWriter" scheduledTransferPeriod="PT5M">
<Event id="1" eventDestination="Table1" />
<Event id="2" eventDestination="Table2" />
<Event id="3" eventDestination="Table3" />
<DefaultEvents eventDestination="DefaultTable" />
</EtwEventSourceProviderConfiguration>
</EtwProviders>
If I debug in the service, isEnabled()
is always False. So WriteEvent
is never gets called. I am using Azure 2.9 SDK with .NET framework 4.5. What should I check for this logging to work? I have enabled the Diagnostics for Worker Role from its Properties in VS and specified the Storage Account details to store the diagnostics results.