ElmahLog.NetCore.Common
3.0.0
dotnet add package ElmahLog.NetCore.Common --version 3.0.0
NuGet\Install-Package ElmahLog.NetCore.Common -Version 3.0.0
<PackageReference Include="ElmahLog.NetCore.Common" Version="3.0.0" />
<PackageVersion Include="ElmahLog.NetCore.Common" Version="3.0.0" />
<PackageReference Include="ElmahLog.NetCore.Common" />
paket add ElmahLog.NetCore.Common --version 3.0.0
#r "nuget: ElmahLog.NetCore.Common, 3.0.0"
#:package ElmahLog.NetCore.Common@3.0.0
#addin nuget:?package=ElmahLog.NetCore.Common&version=3.0.0
#tool nuget:?package=ElmahLog.NetCore.Common&version=3.0.0
This project is licensed under the terms of the Apache License 2.0.
ElmahLog.NetCore
ELMAH for ASP.NET Core (.NET Standard 2.0 / .NET 8+)
Forked from ElmahCore/ElmahCore and republished as
ElmahLog.NetCorev3.0.0 with updated dependencies, security fixes, and .NET 8/10 support.
Installation
Install the main NuGet package:
dotnet add package ElmahLog.NetCore
Optional storage providers:
| Package | Storage |
|---|---|
| ElmahLog.NetCore.Sql | MS SQL Server |
| ElmahLog.NetCore.MySql | MySQL |
| ElmahLog.NetCore.Postgresql | PostgreSQL |
Supported Frameworks
- .NET Standard 2.0 (compatible with .NET Framework 4.6.1+, .NET Core 2.0+)
- .NET 8.0 and above
Simple Usage
Program.cs (minimal hosting, .NET 6+):
builder.Services.AddElmah(); // in service registration
app.UseElmah(); // in middleware pipeline
Startup.cs (traditional):
// ConfigureServices
services.AddElmah();
// Configure - must be after UseExceptionHandler / UseDeveloperExceptionPage
app.UseElmah();
Default Elmah path: ~/elmah
Change URL Path
services.AddElmah(options => options.Path = "errors")
Restrict Access
services.AddElmah(options =>
{
options.OnPermissionCheck = context => context.User.Identity.IsAuthenticated;
});
Note: app.UseElmah() must come after app.UseAuthentication() and app.UseAuthorization().
Change Error Log Type
Implement your own:
class MyErrorLog : ErrorLog { ... }
Built-in options:
MemoryErrorLog— in-memory (default)XmlFileErrorLog— XML files on diskSqlErrorLog— MS SQL Server (requiresElmahLog.NetCore.Sql)MySqlErrorLog— MySQL (requiresElmahLog.NetCore.MySql)PgsqlErrorLog— PostgreSQL (requiresElmahLog.NetCore.Postgresql)
services.AddElmah<XmlFileErrorLog>(options =>
{
options.LogPath = "~/log"; // or options.LogPath = @"C:\errors";
});
services.AddElmah<SqlErrorLog>(options =>
{
options.ConnectionString = "connection_string";
options.SqlServerDatabaseSchemaName = "Errors"; // default: dbo
options.SqlServerDatabaseTableName = "ElmahError"; // default: ELMAH_Error
});
Raise Exception Manually
public IActionResult Test()
{
HttpContext.RaiseError(new InvalidOperationException("Test"));
...
}
Microsoft.Extensions.Logging Support
Since v2.0, ElmahLog.NetCore integrates with Microsoft.Extensions.Logging.
Source Preview
Since v2.0.1 — configure source file paths:
services.AddElmah(options =>
{
options.SourcePaths = new[]
{
@"D:\src\MyProject",
@"D:\src\MyProject.Mvc"
};
});
Log the Request Body
Since v2.0.5, ElmahLog.NetCore can log the HTTP request body.
SQL Query Logging
Since v2.0.6, ElmahLog.NetCore intercepts and logs SQL commands via DiagnosticSource.
Method Parameter Logging
Since v2.0.6:
using ElmahCore;
public void TestMethod(string p1, int p2)
{
this.LogParams((nameof(p1), p1), (nameof(p2), p2));
// ...
}
Developer Exception Page
if (app.Environment.IsDevelopment())
{
// app.UseDeveloperExceptionPage();
app.UseElmahExceptionPage();
}
Notifiers
Implement IErrorNotifier or IErrorNotifierWithId and register:
services.AddElmah<XmlFileErrorLog>(options =>
{
options.Notifiers.Add(new ErrorMailNotifier("Email", emailOptions));
});
Filters
XML-based or code-based error filtering:
services.AddElmah<XmlFileErrorLog>(options =>
{
options.FiltersConfig = "elmah.xml";
options.Filters.Add(new MyFilter());
});
XML filter example:
<?xml version="1.0" encoding="utf-8" ?>
<elmah>
<errorFilter>
<notifiers>
<notifier name="Email"/>
</notifiers>
<test>
<and>
<greater binding="HttpStatusCode" value="399" type="Int32" />
<lesser binding="HttpStatusCode" value="500" type="Int32" />
</and>
</test>
</errorFilter>
</elmah>
See more at elmah.github.io.
Search and Filters
Since v2.2.0 — full-text search and multi-column filtering.
Currently supported by Memory and XmlFile error logs only.
Demo Projects
| Project | Framework | Description |
|---|---|---|
Demos/ElmahCore.DemoCore8 |
.NET 8 | Startup.cs + SqlErrorLog |
Demos/ElmahCore.DemoCore10 |
.NET 10 | Minimal hosting + XmlFileErrorLog + Notifiers + Filters |
License
Apache License 2.0 — Copyright 2018 ElmahCore, Portions Copyright © 2026 Lawrence Shen
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.WebUtilities (>= 2.2.0)
- Microsoft.Extensions.Options (>= 8.0.2)
- System.Text.Json (>= 8.0.6)
-
net8.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on ElmahLog.NetCore.Common:
| Package | Downloads |
|---|---|
|
ElmahLog.NetCore.Sql
ELMAH for ASP.NET Core - MS SQL Server error log storage |
|
|
ElmahLog.NetCore.Postgresql
ELMAH for ASP.NET Core - PostgreSQL error log storage |
|
|
ElmahLog.NetCore
ELMAH for ASP.NET Core - Error Logging Modules and Handlers |
|
|
ElmahLog.NetCore.MySql
ELMAH for ASP.NET Core - MySQL error log storage (MIT-licensed MySqlConnector) |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 278 | 5/5/2026 |