Aspnetcore.docs: How to write a custom logging provider

Created on 4 Apr 2019  Â·  10Comments  Â·  Source: dotnet/AspNetCore.Docs

One reason for needing a new doc about writing custom logging providers: no built-in logging providers are available that can be used to follow the advice in the No asynchronous logger methods section. See #11801


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Source - Docs.ms doc-idea

Most helpful comment

This article is pretty long-winded but gets the job done, so it could maybe be adapted for MS docs? https://www.codeproject.com/Articles/1556475/How-to-Write-a-Custom-Logging-Provider-in-ASP-NET

Edit: this one is a lot more concise https://asp.net-hacker.rocks/2017/05/05/add-custom-logging-in-aspnetcore.html

All 10 comments

It would also be nice if this example showed how to pass a dependency to the custom logging provider.

I'm trying to figure out how to implement an ILogger that prints to my GUI.

This article is pretty long-winded but gets the job done, so it could maybe be adapted for MS docs? https://www.codeproject.com/Articles/1556475/How-to-Write-a-Custom-Logging-Provider-in-ASP-NET

Edit: this one is a lot more concise https://asp.net-hacker.rocks/2017/05/05/add-custom-logging-in-aspnetcore.html

@IanKemp Thanks for sharing my post here as an example.

If it's okay for you all, I would be glad to write that documentation. :-)

@JuergenGutsch let me know what I can do to help. If you want to create a PR with the content, I can clean it up or assign someone to do that.

This is tracked in #16174

@serpent5 can you add a link to additional resources

* [How to add custom logging in ASP.NET Core](https://asp.net-hacker.rocks/2017/05/05/add-custom-logging-in-aspnetcore.html)

The sample looks solid to me.

@JuergenGutsch let me know if you'd like to provide a sample. We can help you through the PR process.

The easiest way to do this is:

  • Create a PR with a 3.1 sample, ie AspNetCore.Docs/aspnetcore/fundamentals/logging/loggermessage/samples/3.1/CustomLogger
  • Add a _readme.txt_ file in that folder. You can copy/paste the HTML output from your blog.

I'll then migrate your readme.txt file to this logging MD file.

Feel free to add the instructions directly to the Content Source: aspnetcore/fundamentals/logging/index.md and I'll edit your PR.

Hey @Rick-Anderson
Sorry, for being that late. Unfortunately I had some completely different priorities the last months :-(

I'm going to start adding the sample later today :-)

@JuergenGutsch awesome. Let me know what I can do to help.

@Rick-Anderson I just created the PR (#18252)

Was this page helpful?
0 / 5 - 0 ratings