Matt Frear
Matt Frear

Reputation: 54861

Does New Relic support ASP.NET Core's ILogger?

I'm new to New Relic. I'm using ASP.NET Core 2.2 (targeting .NET Core 2.2) hosted on an Azure App Service. I've followed the instructions here and it seems to be working, as I can see requests being logged.

Is ASP.NET Core's ILogger interface supported in New Relic? i.e. can I do logger.LogDebug("Blah") in my app and have it logged somewhere in New Relic so that I can trace requests?

Upvotes: 1

Views: 1482

Answers (1)

Derviş Kayımbaşıoğlu
Derviş Kayımbaşıoğlu

Reputation: 30625

Serilog has Serilog.Sinks.NewRelic Nuget Package. If you use serilog you can connect your application with NewRelic via Serilog.Sinks.NewRelic sink.

Serilog can be configured and used with ILogger, and the configuration can be done via ILoggerFactory

See this link for Serilog Configuration

As a side note, It is also fairly easy with Serilog to write your own Sink.

Upvotes: 1

Related Questions