ASP.NET Core Status
A lot changed since we wrote this post and the integration is no longer in prerelease. To make sure you get the most updated documentation, check out Logging to elmah.io from ASP.NET Core.
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 was limited to a date, a title, and a few other properties. With today's 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 projects on GitHub.