Semantic logging (SLAB) for MVC Azure Webapp

338 views Asked by At

Am trying to implement SLAB for my Azure Web app (In Process) and my listner is Azure table Storage (table conection string) , the problem am facing is -“EventSource.IsEnabled() = always returns false” (Am running the application from VS2013 with IIS express)

my code

————global.asax

var listener2 = new ObservableEventListener();
listener2.EnableEvents(SBEvents.Log, EventLevel.Verbose,Keywords.All);
listener2.LogToWindowsAzureTable(“sdf”, “DefaultEndpointsProtocol=https;AccountName=********;AccountKey=****************);

———-Event Source

Public class SBEvents :EventSource {
public class keywords{...}
public class Tasks {..}

private static readonly Lazy Instance = new Lazy(() => new SBEvents());
public static SBEvents Log { get { return Instance.Value; } }

[Event(102, Message = “Bike started with Bike ID :{0}”, Keywords =    Keywords.Application, Level = EventLevel.Informational)]
public void BikeStarted(String BikeID){
if (this.IsEnabled()) //// = always returns false
this.WriteEvent(102,BikeID);
1

There are 1 answers

0
Pragmatic On

It looks like 'Azure Web Apps' cannot listen to ETW events.

https://azure.microsoft.com/en-in/documentation/articles/choose-web-site-cloud-service-vm/

Areas of diagnostics logging and tracing that aren't available to web applications on Azure are Windows ETW events, and common Windows event logs (e.g. System, Application and Security event logs). Since ETW trace information can potentially be viewable machine-wide (with the right ACLs), read and write access to ETW events are blocked. Developers might notice that API calls to read and write ETW events and common Windows event logs appear to work, but that is because WEb Apps is "faking" the calls so that they appear to succeed. In reality, the web app code has no access to this event data

Thanks