How to save logs to Couchbase from ASP Net Core 3.1 or 5.0? Any logging framework like Serilog or NLog.
Hi @prem111 ,
Have you check out the documentation on this: Collecting Information and Logging in the .NET SDK with Couchbase Server | Couchbase Docs
Thanks for the reply.
As per this link, Serilog logs to a file (txt). But my requirement is to save the errors and warnings to Couchbase.
How do I do that?
Oh, sorry, I didn’t read carefully enough
I believe there are some libraries out there that support Serilog and NLog using Couchbase as a sink. It doesn’t look like they’ve been updated recently, and they are community projects (not officially supported by Couchbase Inc).
If you wanted to simply have your logging provider write to Couchbase, then it wouldn’t be too difficult to roll your own
ILogger using Couchbase as the back end store.
Note that I have an example (in addition to the docs) of plugging in a different logger recently:
As an aside, I’d be very careful writing a logger that sends logs from ILoggerFactory to Couchbase. The Couchbase SDK also generates logs into the ILoggerFactory. If you aren’t careful to filter out those logs, you could easily create an infinite loop where SDK errors generate logs that generate more SDK errors, and on, and on, and on.