Configure Error Log types
masterElmahCore supports several error log implementations. You can specify the log type via the generic parameter in AddElmah<T>.
Available built-in logs:
MemoryErrorLog: Stores errors in memory (default).XmlFileErrorLog: Stores errors in XML files.SqlErrorLog: Stores errors in MS SQL (requiresElmahCore.Sqlpackage).MysqlErrorLog: Stores errors in MySQL (requiresElmahCore.MySqlpackage).PgsqlErrorLog: Stores errors in PostgreSQL (requiresElmahCore.Postgresqlpackage).
You can also implement your own by inheriting from ErrorLog.
// Example: XML File Logging
services.AddElmah<XmlFileErrorLog>(options =>
{
options.LogPath = "~/log"; // Or absolute path like "C:\errors"
});
// Example: SQL Server Logging
services.AddElmah<SqlErrorLog>(options =>
{
options.ConnectionString = "connection_string";
options.SqlServerDatabaseSchemaName = "Errors"; // Defaults to dbo
options.SqlServerDatabaseTableName = "ElmahError"; // Defaults to ELMAH_Error
});