couchbase-lite-java-ce-root
couchbase-lite-java-ce-root copied to clipboard
Warning written to log on every Database open regardless of status of File Log Sinks
Every time I open a database, I get this log message, no matter what I have set for File based logging:
W Database.log.getFile().getConfig() is now null: logging is disabled. Log files required for product support are not being generated.
This message is outright wrong in this case, as it's not null, but apparently there's a bug in the code and no matter what you'll get this message:
private void warnIfNoFileLogSink() {
final FileLogSink sink = fileLogSink;
if ((sink != null) && (sink.getLevel() != LogLevel.NONE) && !warned.getAndSet(true)) { return; }
((AbstractLogSink) new ConsoleLogSink(LogLevel.WARNING, LogDomain.DATABASE)).writeLog(
LogLevel.WARNING,
LogDomain.DATABASE,
"Database.log.getFile().getConfig() is now null: logging is disabled. "
+ "Log files required for product support are not being generated.");
}
I have several issues with this code besides this.
- If I want to disable File based logging, I should be able to do it, and not get complaints about it. If there has to be a warning, it should be on init(), not every single time I attempt to open a DB. The older version of couchbase lite mobile (2.x) did not have this issue.
- This code here creates an arbitrary console logger (which in android writes to Logcat), so there's no way to suppress it.