Windows Azure - Custom Diagnostics and Logging with Loggly

Let me state the obvious, for any application you develop you need to log information, errors, exceptions etc that can help you and others know what’s going on with your application
When you create a new Windows Azure application using Visual Studio you will find the following snippet in your configuration file
        /span>addtype="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          /span>filtertype="" />
You have diagnostic’s right out of the box , and you can write code as below
Trace.TraceInformation(“Information to log”);
Diagnosticsare then logged to Azure blob storage.
You can now access and analyse your logs using tools like Cerebranta Azure Diagnostics manager
However, you might require to not use the default Azure diagnostics
For example , you might choose to use a service like Loggly to log and analyse your logs.
You also get added features like alerts which is why I decided to use them
To setup logging with loggy is easy
Sign up for a loggly account from their website
Download the .NET loggly API driver at
You can then implement the TraceListener abstract class
public class LogglyTraceListener:TraceListener
        public override void Write(string message)
        public override void WriteLine(string message)
            ILogger logger = new Loggly.Logger("APIKeyHere");
In you configuration file , change diagnostics to use your new trace listener
        /span>addtype="LogglyTraceListener, Logging"name="Loggly">
          /span>filtertype="" />
Now when you write Trace logs they should show up in loggly ready for you to analyse
Happy coding

Views: 310


You need to be a member of Azure User Groups to add comments!

Join Azure User Groups

Latest Activity

Profile IconKevin Rolnick, Tony Williams, Mark Sullivan and 48 more joined Azure User Groups
Sep 21, 2018
chandupatla joined Mike Holdorf's group

Dallas Azure User Group

Dallas Azure User Group - Meetings held at the Microsoft Technology Center in Las Colinas
Apr 20, 2017
Anthony.Tex.M posted a status
"We are ACTIVE on ... and open for new members!"
Feb 21, 2017
Ani Arth posted an event

Live! 360 Orlando at Loew's Royal Pacific Resort

November 17, 2014 to November 21, 2014
Live! 360 brings together five conferences, and the brightest minds in IT and Dev, to explore leading edge technologies and conquer current ones. These co-located events will incorporate knowledge transfer and networking, along with out-of-this-world education and training, as you create your own custom conference, mixing and matching sessions and workshops to best suit your needs. Whether you are a developer who uses Visual Studio, SQL Server, and SharePoint;…See More
Jun 6, 2014

© 2019   Created by Azure Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service