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: 267


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

Join Azure User Groups

Latest Activity

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
Ani Arth posted an event

Visual Studio Live! DC at Washington Marriott at Metro Center

October 6, 2014 to October 9, 2014
To Boldly Code where No Visual Studio Live! has ever Coded Before!That's right. We are transporting Visual Studio Live! to our nation's capital for the first time in 21 years. From Oct 6 – 9, 2014, developer, software architect, engineer and designer pioneers will gather in our country's headquarters for 4 days of cutting-edge education on the Microsoft Platform. Join us on this special journey to explore topics covering all-things WCF, ALM, Web Development, Data Management, Visual Studio and…See More
Mar 31, 2014
Ani Arth posted events
Jan 28, 2014
Mike McKeown is now a member of Azure User Groups
Jun 4, 2013

© 2017   Created by Azure Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service