none
Unable to Log errors in Windows Azure Table stoarge with Windows Azure Diagnostics

    Question

  • Hi

     I have to use Windows Azure Table stoarge for error logging, with following configurations 

    <

     

     

    ServiceConfiguration serviceName="LoggingDemo" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">

    <

     

     

     

    Role name="WebRole1">

    <

     

     

     

    Instances count="1" />

    <

     

     

     

    ConfigurationSettings>

    <

     

     

     

    Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=xxxx;AccountKey=xxxx" />

    </

     

     

     

    ConfigurationSettings>

    </

     

     

     

    Role>

    <

     

     

     

    Role name="WorkerRole1">

    <

     

     

     

    Instances count="1" />

    <

     

     

     

    ConfigurationSettings>

    <

     

     

     

    Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=xxxx;AccountKey=xxxx==" />

    </

     

     

     

    ConfigurationSettings>

    </

     

     

     

    Role>

    </

     

     

     

    ServiceConfiguration>

     

     

     

     

    And webRole.cs

    public

     

     

    override bool OnStart()

     

     

    // For information on handling configuration changes

     

     

    // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

     

     

    DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();

    dmc.Logs.ScheduledTransferPeriod =

     

     

    TimeSpan.FromMinutes(1);

    dmc.Logs.ScheduledTransferLogLevelFilter =

     

     

    LogLevel.Information;

     

     

     

    DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", dmc);

     

     

    return base.OnStart();

     

     

    public override void Run()

     

     

    int count = 0;

     

     

     

    for (; ; )

     

     

    Trace.WriteLine("Message: " + count, "Information");

     

     

     

    Thread.Sleep(TimeSpan.FromSeconds(10));

     

     

     Still table(waddlog) is not created in Windows Azure Storage.

    Please suggest me

     

    Thanks

     


    Seema Patre

    }

    }

     

    {

    count++;

     

    {

     

    }

     

     

     

    {

     

    Thursday, February 03, 2011 12:05 PM

Answers

  • Hi Seema,

    I believe you have copied your actual storage credentials in the post above. Please remove these ASAP and regenerate the keys. Also take a look at this blog post from Andy: http://blog.bareweb.eu/2011/01/implementing-azure-diagnostics-with-sdk-v1-3/ as there have been some changes in implementing diagnostics with SDK 1.3. Hopefully this blog post will give you some ideas as to why the logs are not being transferred.

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

     

    • Marked as answer by Mog Liang Thursday, February 10, 2011 8:30 AM
    Thursday, February 03, 2011 12:40 PM
  • On first glance, given the formatting issue, everything looks fine. You should probably go through the Debuggin an Application in the Cloud HOL in the Azure Platform Training Kit.
    • Marked as answer by Mog Liang Thursday, February 10, 2011 8:29 AM
    Thursday, February 03, 2011 7:18 PM
    Answerer
  • Hi Seema,

     

    The problem may be that you're not Tracing logs to a valid TraceListener. When you are in WebRole.cs, there are two TraceListeners in the System.Diagnostics.Trace.Listeners collection, DefaultTraceListener and Microsoft.ServiceHosting.Tools.DevelopmentFabric.Runtime.DevelopmentFabricTraceListener

    Neither of these trace listeners output to Windows Azure Diagnostics - the DefaultTraceListeners does little and the DevelopmentFabricTraceListener puts the output in the Azure Compute Emulator UI. 

    In order to start Tracing to those tables, you need a DiagnosticMonitorTraceListener in the System.Diagnostics.Trace.Listeners collection for the appDomain that is doing the Logging. 

    If you have such a TraceListener defined in web.config, then you can do this tracing ANYWHERE APART FROM WEBROLE.CS inside your WebRole. Try tracing from default.aspx or global.asax for instance. 

    I suggest you put a breakpoint on any of your Trace statements, and QuickWatch to System.Diagnostics.Trace.Listeners collection, and inspect its members.

    I blogged about this recently, although my blog regards the reverse problem-  tracing to the Compute Emulator from within the Web Role. http://blog.bareweb.eu/2011/01/tracing-to-azure-compute-emulator-sdk-v1-3/ The concept is the same however - you need to make sure you have the right TraceListeners in your collection before anything will be added to your WAD table, and thus before it is created.

    Andy


    http://blog.bareweb.eu
    • Marked as answer by Mog Liang Thursday, February 10, 2011 8:29 AM
    Thursday, February 03, 2011 9:22 PM

All replies

  • Hi Seema,

    I believe you have copied your actual storage credentials in the post above. Please remove these ASAP and regenerate the keys. Also take a look at this blog post from Andy: http://blog.bareweb.eu/2011/01/implementing-azure-diagnostics-with-sdk-v1-3/ as there have been some changes in implementing diagnostics with SDK 1.3. Hopefully this blog post will give you some ideas as to why the logs are not being transferred.

    Hope this helps.

    Thanks

    Gaurav Mantri

    Cerebrata Software

    http://www.cerebrata.com

     

    • Marked as answer by Mog Liang Thursday, February 10, 2011 8:30 AM
    Thursday, February 03, 2011 12:40 PM
  • On first glance, given the formatting issue, everything looks fine. You should probably go through the Debuggin an Application in the Cloud HOL in the Azure Platform Training Kit.
    • Marked as answer by Mog Liang Thursday, February 10, 2011 8:29 AM
    Thursday, February 03, 2011 7:18 PM
    Answerer
  • Hi Seema,

     

    The problem may be that you're not Tracing logs to a valid TraceListener. When you are in WebRole.cs, there are two TraceListeners in the System.Diagnostics.Trace.Listeners collection, DefaultTraceListener and Microsoft.ServiceHosting.Tools.DevelopmentFabric.Runtime.DevelopmentFabricTraceListener

    Neither of these trace listeners output to Windows Azure Diagnostics - the DefaultTraceListeners does little and the DevelopmentFabricTraceListener puts the output in the Azure Compute Emulator UI. 

    In order to start Tracing to those tables, you need a DiagnosticMonitorTraceListener in the System.Diagnostics.Trace.Listeners collection for the appDomain that is doing the Logging. 

    If you have such a TraceListener defined in web.config, then you can do this tracing ANYWHERE APART FROM WEBROLE.CS inside your WebRole. Try tracing from default.aspx or global.asax for instance. 

    I suggest you put a breakpoint on any of your Trace statements, and QuickWatch to System.Diagnostics.Trace.Listeners collection, and inspect its members.

    I blogged about this recently, although my blog regards the reverse problem-  tracing to the Compute Emulator from within the Web Role. http://blog.bareweb.eu/2011/01/tracing-to-azure-compute-emulator-sdk-v1-3/ The concept is the same however - you need to make sure you have the right TraceListeners in your collection before anything will be added to your WAD table, and thus before it is created.

    Andy


    http://blog.bareweb.eu
    • Marked as answer by Mog Liang Thursday, February 10, 2011 8:29 AM
    Thursday, February 03, 2011 9:22 PM