Search code examples
azureweb-applicationsasp.net-coreelmah

ELMAH for asp.net core


I am working on asp.net core webapp hosted on azure and I want to write my Elmah logs to my azure table storage .Many of the examples I looked into are using "API_KEY" and "logbucketId" but I am not sure what they are. For instance as per elmah docs here https://docs.elmah.io/logging-to-elmah-io-from-aspnet-core/

app.UseElmahIo(
    "API_KEY", 
    new Guid("LOG_ID"),

After installing nuget package, I don't see any API_KEY or LogBucketId in my appsettings.json file.

Where I can find my API_KEY and LogBucket_Id ?


Solution

  • ELMAH doesn't work with ASP.NET Core, since ASP.NET Core doesn't work with HttpModules and HttpHandlers (ELMAH stands for Error Logging Modules And Handlers). ASP.NET Core does include a new (pre-release) diagnostic tool called ELM (Error Logging Middleware - creative, right?). You can find its source and samples here: https://github.com/aspnet/Diagnostics/tree/release/1.1/src/Microsoft.AspNetCore.Diagnostics.Elm

    Another option similar to ELMAH (and ELM) but with more capabilities is Glimpse: http://getglimpse.com/

    I realize neither of these directly answers your question but hopefully you'll find one or both of these alternative tools useful.