C
C#14mo ago
Mango

❔ Configuring ILogger to log to database.

Does this look right to have ILogger configured to log to database? https://learn.microsoft.com/en-us/answers/questions/805842/how-to-save-logs-into-db
How to save logs into db - Microsoft Q&A
I m running Microsoft ILogger in my asp.net core webapi project. The logs are running perfect and also generating log files but log files are really hard to scan and read.
I want to save the logs into db and then run some query and find out the issues…
8 Replies
Mango
MangoOP14mo ago
Also is it anti-pattern to have multiple logging locations? ApplicationInsights + DB + Serilog + whatever
Omnissiah
Omnissiah14mo ago
i would say it's normal to have multiple loggers, but also usually they have different purposes, so for examples you could send information level to a file or to elastic, errors and fatals to a monitoring service, and so on
Mango
MangoOP14mo ago
Ok yeah that’s what I was wondering about Not technically different logging providers, just destinations.
JakenVeina
JakenVeina14mo ago
often called "sinks" but in the context of Microsoft.Extensions.Logging provider is actually correct is there a database logger provider that you've found that you can use? if not, you'll have to write your own, and I'm going to plug myself from the last time I did exactly that, for the purpose of logging to a database hmm, well, okay, I guess I got rid of it at one point, I put a bunch of shared logic for that project into a standalone NuGet package, but I think I got rid of that you can look at this, though, this was one of the two projects that were using that shared lib.
JakenVeina
JakenVeina14mo ago
GitHub
GitHub - JakenVeina/SeqLoggerProvider: An implementation of ILogger...
An implementation of ILoggerProvider, from the Microsoft.Extensions.Logging.Abstractions framework, for writing log events to a Seq server. - GitHub - JakenVeina/SeqLoggerProvider: An implementatio...
JakenVeina
JakenVeina14mo ago
the other was a database logger, but it was for work, so not on github
Omnissiah
Omnissiah14mo ago
we use a serilog sink for elasticsearch
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server