Adding Version Information to your Log

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.

elmah.io: Error logging and Uptime Monitoring for your web apps

This blog post is brought to you by elmah.io. elmah.io is error logging, uptime monitoring, deployment tracking, and service heartbeats for your .NET and JavaScript applications. Stop relying on your users to notify you when something is wrong or dig through hundreds of megabytes of log files spread across servers. With elmah.io, we store all of your log messages, notify you through popular channels like email, Slack, and Microsoft Teams, and help you fix errors fast.

See how we can help you monitor your website for crashes Monitor your website