Adding Version Information to your Log

Thomas Ardal, March 29, 2016

Time for a new crisp feature on elmah.io. All software applications have a version number (or at least should have). Being able to distinguish one version from the other is important. That's why we have implemented version number support on elmah.io.

Basically, there's a new version property on the message details:

Error Details with Version Number

The idea here is that you set this version number to the current version number of your application through appSettings, assembly version or similar.

Having a version number on all messages, lets you do funky searches like this:

Search for Versions

To add a version number on all of the messages logged to elmah.io, add the following code somewhere during initialization:

Elmah.ErrorLog.GetDefault(null); // Forces creation of logger client
var logger = ErrorLog.Client;
logger.OnMessage += (sender, args) =>
{
    args.Message.Version = "1.2.3"; // Requires elmah.io.core version >= 2.0.26
}

I addition to setting the version number through the OnMessage event, there are alternatives as well as support for logging frameworks like log4net, NLog and Serilog. Check out the Adding Version Information article on our documentation site for more details.


This post was brought to you by the elmah.io team. elmah.io is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening and help you fix errors fast.

Monitor your website



Comments