ASP.NET Core Status

Thomas Ardal, August 3, 2016

We know that we talk a lot about our integration for ASP.NET Core. But things are moving (and changing) very fast at Microsoft, in the community and @ elmah.io. A month ago we released support for ASP.NET Core and today we take things a step further. The month old release contained an implementation of a logger for Microsoft.Extensions.Logging, able to run on Windows, Linux and Mac. The amount of data logged where limited to a date, a title and a few other properties. With todays release, we offer almost the same experience for ASP.NET Core applications like good old MVC and Web API apps.

Be aware that the integration still remains a prerelease. Both Elmah.Io.Extensions.Logger and Elmah.Io.AspNetCore contains an implementation of a Microsoft.Extensions.Logging logger. This will probably change in the future by using dependencies between the two packages.

To start logging, install the Elmah.Io.AspNetCore:

Install-Package Elmah.Io.AspNetCore -Pre

Tell ASP.NET Core to use elmah.io:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory fac)
{
    app.UseElmahIo("API_KEY", new Guid("LOG_ID"));
}

The following code is no longer nessecary. Check out Logging to elmah.io from ASP.NET Core for updated documentation.

Finally, register IHttpContextAccessor to make sure that elmah.io receives all of the data it needs to help you debug the errors later:

public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
    ...
}

For more information, check out the Logging from ASP.NET Core article and the example project on GitHub.


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