CBLite 2.0.0DB22 Logging


#1

Under previous versions (< db022) of CBL 2.0 I was able to re-route the text log messages to SeriLog using:
Couchbase.Lite.Logging.Log.AddLoggerProvider(new Serilog.Extensions.Logging.SerilogLoggerProvider(Log.Logger));

This has been removed in db022. How do I do this now?


#2

Unfortunately, the ability to support custom logging providers has been removed from DB022 . The decision was a culmination of several factors , among them being the desire to have a consistent solution that worked across all platforms. That will be revisited post CBM 2.0.

But for now, all logs will be redirected to log cat on Android, NSlog on iOS and so on…

I will feed this internally as a enhancement ticket for tracking purposes.

FYI : https://github.com/couchbase/couchbase-lite-net/issues/964


#3

The main problem, apart from wanting custom logging, is that Couchbase will now write its logs to the default location, in AppContext.BaseDirectory. On Windows for installed applications this means writing logs to the Program Files application folder. It’s definitely not where I want logs to go, and creates problems with permission to write files there. If they have to go somewhere where I can’t control them, I much prefer them somewhere in a system directory like AppData/Local or ProgramData… or TMP.


#4

Or perhaps there is a way to turn off logs? Setting all domains to None using:
Database.SetLogLevel(Couchbase.Lite.Logging.LogLevel.None);
doesn’t seem to turn them off completely, and still creates a Logs directory.