Nothing gets logged to WIndows Azure table

Topics: Semantic Logging Application Block
Oct 12, 2013 at 3:08 AM
I have a Web API application that uses semantic logging. Here in the Application start, I register a Windows Azure table sink and a rolling flat file sink to my event listener.

When the application is started, I do start seeing all logs in the flat files but no logs are generated in Windows azure table. The table too is not created if it does-not exist.

How do I Inspect, what's going on and why there are no logs generated azure sink ??

My App_Start Look something like this:
            this.listener = new ObservableEventListener();
            this.listener.LogToWindowsAzureTable(RoleEnvironment.CurrentRoleInstance.Id, "UseDevelopmentStorage=true", tableAddress: "MyLogs",bufferingInterval: TimeSpan.FromSeconds(5), maxBufferSize: 1000);
            this.listener.LogToRollingFlatFile(@"D:\temp.log", 512, "ddmmYY", Practices.EnterpriseLibrary.SemanticLogging.Sinks.RollFileExistsBehavior.Increment, Practices.EnterpriseLibrary.SemanticLogging.Sinks.RollInterval.Minute);

this.listener.EnableEvents(MyEventSource.Log, level);
Oct 13, 2013 at 7:00 AM
I used the above code in an Azure Web API project and it worked OK. Maybe a stupid question but are you looking at Dev Storage?

The Semantic Logging Block does have its own EventSource where errors are logged. You could try listening for those events and see if there is anything (I didn't see anything written):
var semanticListener = new ObservableEventListener();
semanticListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.LogAlways, Keywords.All);

Side note: the date format should probably be "ddMMyy" if you want it to be day/month/year.

Randy Levy
Enterprise Library support engineer
Support How-to
Oct 22, 2013 at 3:17 AM
Has this been solved?

I also have an event listener that does not seem to be responding.
            var listener = new ObservableEventListener();
            listener.EnableEvents(LogEvents.Log, EventLevel.Verbose);
            listener.LogToWindowsAzureTable("ChufdEvents", @"UseDevelopmentStorage=true",
            eventTableName, TimeSpan.FromSeconds(1));
Oct 22, 2013 at 3:51 AM
Hi Randy,
The code was the debug version which I am running locally. and hence we see the "UseDevelopmentStorage=true" other than that, what I have observed is , despite setting the Log level to LogAlways, Only error's get logged. Not sure why that happens.
Are there any events we can hook up to in the azure table storage listener that we can listen into ?
@bcaruana, Nope, we are still working on it
Oct 22, 2013 at 6:08 AM
@sudheerkovalam, as I described above, the Semantic Logging Block does have its own EventSource where errors are logged. You could try listening for those events and see if there is anything (I didn't see anything written).

Have you run the EventSourceAnalyzer to validate the EventSource? Perhaps something is happening there?

Perhaps you can distill a sample project that demonstrates the behavior since my project using the posted code works?

Just in case it helps here is the code I'm using:
    public class MyEventSource : EventSource
        private static readonly Lazy<MyEventSource> Instance = new Lazy<MyEventSource>(() => new MyEventSource());

        private MyEventSource()

        public static MyEventSource Log
            get { return Instance.Value; }

        [Event(1, Message = "Log: {0}", Level = EventLevel.Informational)]
        public void SomeEvent(String txt)
            this.WriteEvent(1, txt);

    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit

    public class WebApiApplication : System.Web.HttpApplication
        private static ObservableEventListener listener;
        private static SinkSubscription<WindowsAzureTableSink> azureSinkSubscription;

        protected void Application_Start()


            listener = new ObservableEventListener();
            azureSinkSubscription = listener.LogToWindowsAzureTable(RoleEnvironment.CurrentRoleInstance.Id, "UseDevelopmentStorage=true", tableAddress: "MyLogs", bufferingInterval: TimeSpan.FromSeconds(5), maxBufferSize: 1000);
            listener.LogToRollingFlatFile(@"c:\Logs\azure.log", 512, "ddmmYY", RollFileExistsBehavior.Increment, RollInterval.Minute);

            listener.EnableEvents(MyEventSource.Log, EventLevel.LogAlways);

        void Application_End(object sender, EventArgs e)

            //  Code that runs on application shutdown


Randy Levy
Enterprise Library support engineer
Support How-to
Oct 22, 2013 at 9:41 AM
Hi Randy,

I have tried EventSourceAnalyser and it shows no error.
A sample code snippet (Just like the one you demonstrated ) works for me too.
Just this specific listener doesnot.
And as far as logging level is concerned, Only Error Events are logged even when the log Level is set to LogAlways
Oct 22, 2013 at 2:59 PM
Can you post a sample project?

Randy Levy
Enterprise Library support engineer
Support How-to
Nov 13, 2013 at 1:52 AM
Hi Randy,
I have tried creating the sample app as suggested.
The sample app works as expected though.
Also we have two web roles using the event source. the second web role continues to log though.
Its just the problem with the first.
Also all other kinds of logging continue.

As far as the azure Sink is concerned, I do see messages being collected in the sink.
After I Run the app and generate two events, The sink shows two cloud table entries in it. Its just that they are not written back to the table.
Nov 13, 2013 at 4:32 AM
Hi Randy,
We were able to root cause the issue due to which logging to azure table had stopped working.. The windows azure sink has a dependency on
Microsoft.Data.OData, Version=, 'Microsoft.Data.Edm, Version=, 'System.Spatial, Version=,
whereas, a nuget package update had changed this to
This resulted in the exception when the messages were written to the azure table and hence no messages were written.

This is an issue and there is no easy way to find out what's wrong. Is there a way, we can identify such dependencies upfront and not have the listener fail at run time silently.

Sudheer Kovalam
Marked as answer by sudheerkovalam on 11/12/2013 at 8:32 PM
Nov 25, 2013 at 4:05 PM

It's not OData version the problem. It is WindowsAzure.Storage version, I did a simplest testing code according to the CHM documents, with version you don't need the table created in the storage account, but with version it will throw about "CloudTable does not exists".

Without going deeper with ILSpy, I suspect the SLAB code is using a "feature" of in that if the table doesn't exist it will create it for you, but apparently this is no longer the case in

Please confirm and fix asap.


Nov 25, 2013 at 5:26 PM

So we always were on, whereas Microsoft.Data.OData, 'Microsoft.Data.Edm, & 'System.Spatial, were at
the moment we moved these to , the logging started to function .
Nov 26, 2013 at 10:50 AM
Sadly for OData stuff I have 5.6.0 and it's working for me.
Dec 11, 2013 at 8:48 AM
Having the same issues and getting this from the SemanticLoggingEventSource

ProviderId : d1ed7ec7-5701-5554-2c5e-796dc42511c5
EventId : 504
Keywords : 1
Level : Error
Message : A Windows Azure Table sink discarded 1 events due to failures while attempting to publish a batch.
Opcode : Info
Task : 65030
Version : 0
Payload : [numberOfEntries : 1]
EventName : WindowsAzureTableSinkPublishEventsFailedAndDiscardsEntriesInfo
Timestamp : 2013-12-11T08:33:43.7327365Z
Dec 11, 2013 at 11:00 AM
And when moving back to Windows.Azure.Storage and version for the dependencies everything worked fine
Feb 11, 2014 at 12:13 AM
Edited Feb 11, 2014 at 3:30 PM
We're using Windows azure storage 2.1.
I also have issue where there is silent failure. If the table exists, nothing is written there. If the table does not exist yet, it is not even created. The Nuget package appears to need Azure storage version 2.0 or greater.
Can Azure sink be released that works with Azure storage 2.1 please.
My events do show up in other sinks, just not the Azure table sink for the same listener.
I should also mention, just to get it to use 2.1, I had to add this to config,
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><!--Binding fix for Azure sink dependency on WindowsAzure.Storage assembly which should be greater than 2.0-->
    <assemblyIdentity name="Microsoft.WindowsAzure.Storage"
                      culture="neutral" />
    <bindingRedirect oldVersion=""
Feb 21, 2014 at 5:56 PM
Edited Feb 21, 2014 at 6:15 PM
I have been struggling to see any of my EventSource messages logged into a WindowsAzureTable or indeed a RollingFlatFile and I would love someone to put me on the right tracks.

Please find below code extracts of the key parts of my test harness web application.

As you can see, I am using WindowsAzure.Storage and EnterpriseLibrary.SemanticLogging.WindowsAzure 1.0.1304.1 which are the latest packages as if today.

Out of desperation, I did change my Solution recently to use the Microsoft.Diagnostics.Tracing assy and the Channel = EventChannel.Admin attribute on my EventSource methods to have the logging information logged into the local machine EventLog and I can confirm that my EventSource messages were being logged so that confirms my EventSource class is sound. I have since reverted back to using System.DIagnostics.Tracing as it is not appropriate for me to the host computer EventLog as a logging store in a production environment.


  <package id="AspNet.ScriptManager.jQuery" version="1.8.2" targetFramework="net45" />
  <package id="AspNet.ScriptManager.jQuery.UI.Combined" version="1.8.24" targetFramework="net45" />
  <package id="DotNetOpenAuth.AspNet" version="" targetFramework="net45" />
  <package id="DotNetOpenAuth.Core" version="" targetFramework="net45" />
  <package id="DotNetOpenAuth.OAuth.Consumer" version="" targetFramework="net45" />
  <package id="DotNetOpenAuth.OAuth.Core" version="" targetFramework="net45" />
  <package id="DotNetOpenAuth.OpenId.Core" version="" targetFramework="net45" />
  <package id="DotNetOpenAuth.OpenId.RelyingParty" version="" targetFramework="net45" />
  <package id="EnterpriseLibrary.SemanticLogging" version="1.0.1304.0" targetFramework="net45" />
  <package id="EnterpriseLibrary.SemanticLogging.WindowsAzure" version="1.0.1304.1" targetFramework="net45" />
  <package id="EntityFramework" version="5.0.0" targetFramework="net45" />
  <package id="jQuery" version="1.8.2" targetFramework="net45" />
  <package id="jQuery.UI.Combined" version="1.8.24" targetFramework="net45" />
  <package id="Microsoft.AspNet.FriendlyUrls" version="1.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Membership.OpenAuth" version="1.0.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.Providers.Core" version="1.2" targetFramework="net45" />
  <package id="Microsoft.AspNet.Providers.LocalDB" version="1.1" targetFramework="net45" />
  <package id="Microsoft.AspNet.ScriptManager.MSAjax" version="4.5.6" targetFramework="net45" />
  <package id="Microsoft.AspNet.ScriptManager.WebForms" version="4.5.6" targetFramework="net45" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.0.0" targetFramework="net45" />
  <package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.0.0" targetFramework="net45" />
  <package id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" />
  <package id="Microsoft.Data.OData" version="5.6.0" targetFramework="net45" />
  <package id="Microsoft.Data.Services.Client" version="5.6.0" targetFramework="net45" />
  <package id="Microsoft.Web.Infrastructure" version="" targetFramework="net45" />
  <package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
  <package id="Modernizr" version="2.6.2" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="5.0.8" targetFramework="net45" />
  <package id="System.Spatial" version="5.6.0" targetFramework="net45" />
  <package id="WebGrease" version="1.1.0" targetFramework="net45" />
  <package id="WindowsAzure.Storage" version="" targetFramework="net45" />


    public class Global : HttpApplication
        private static ObservableEventListener _listener;
        private static SinkSubscription<WindowsAzureTableSink> _azureTableSinkSubscription;

        void Application_Start(object sender, EventArgs e)
            // Code that runs on application startup

            // Initialize the listeners
            _listener = new ObservableEventListener();
            _azureTableSinkSubscription = _listener.LogToWindowsAzureTable("Global", "UseDevelopmentStorage=true;", "ApplicationInstrumentation");
            _listener.EnableEvents(MyCompanyEventSource.Log, EventLevel.LogAlways, Keywords.All);

            // Log this significant event

        void Application_End(object sender, EventArgs e)
            // Log this significant event

            if(_azureTableSinkSubscription != null)

            if (_listener != null)

        void Application_Error(object sender, EventArgs e)
            // Code that runs when an unhandled error occurs


    [EventSource(Name = "MyCompany")]
    public class MyCompanyEventSource : EventSource
        // Fields
        private static readonly Lazy<MyCompanyEventSource> instance = new Lazy<MyCompanyEventSource>(() => new MyCompanyEventSource());

        // Constructor - private to force the use of the Log Property
        private MyCompanyEventSource() { }

        // Properties
        public static MyCompanyEventSource Log { get { return instance.Value; } }

        // Event Methods
        [Event(1, Message = "Failure: {0}", Level = EventLevel.Critical, Keywords = Keywords.Diagnostic)]
        internal void Failure(string message)
            this.WriteEvent(1, message);

        [Event(2, Message = "Startup", Level = EventLevel.Informational, Keywords = Keywords.Perf)]
        internal void Startup()

        [Event(3, Message = "Shutdown", Level = EventLevel.Informational, Keywords = Keywords.Perf)]
        internal void Shutdown()

        [Event(4, Message = "PageStart: {1} | ActivityID: {0}", Level = EventLevel.Informational, Keywords = Keywords.Page, Task = Tasks.Page, Opcode = EventOpcode.Start)]
        internal void PageStart(int id, string url)
            // The IsEnabled method helps to improve performance if you are using the costly overload of the WriteMethod
                this.WriteEvent(4, id, url);

        /// <summary>
        /// Nested Class defining the supported Keywords
        /// </summary>
        public class Keywords
            public const EventKeywords Page = (EventKeywords)1;
            public const EventKeywords DataBase = (EventKeywords)2;
            public const EventKeywords Diagnostic = (EventKeywords)4;
            public const EventKeywords Perf = (EventKeywords)8;

        /// <summary>
        /// Nested Class defining the supported Tasks
        /// </summary>
        public class Tasks
            public const EventTask Page = (EventTask)1;
            public const EventTask DBQuery = (EventTask)2;
Feb 23, 2014 at 8:34 AM
You can also use EventSourceAnalyzer to also validate your EventSource:
In your case, the EventSource looks good.

I'm not sure why a RollingFlatFile sink would not be working.

However, here's what I found with the Azure sink. The latest version of WindowsStorage includes JSON support. This is now the default format. However, it looks like storage emulator 2.2 does not support the new format (which makes sense since the format is new!). When I was running with version I was getting Bad Request returned by the storage emulator. There is a Windows Azure Storage Emulator 2.2.1 Preview available for download which includes JSON support. Once I downloaded and installed the preview, the posted code was working as expected.

Randy Levy
Enterprise Library support engineer
Support How-to
Feb 24, 2014 at 10:47 AM
Randy. Thanks so much for your help here and I am very pleased to see once again my EventSource messages being logged into my Development Storage Table Store. :-)

Just a few questions which I would appreciate your feedback on...
  • To be assured of the integrity of my EventSource class, I am using which provides me with compile time feedback of most EventSource issues. It is correct for me to be using this in my Solution?
  • When I updated my Solution via, that action must have silently broken the implementation that I was using. So I guess there is a dependency on the Azure Storage Emulator also needing to be updated as part of this NuGet package update. If you agree, will you please advise the relevant parties to avoid others falling into the same situation that I found myself?
  • Just in case this happens again in the future, is there some way that I can enabled some form of Azure Storage Emulator logging so that I can observe any storage activity failures?