Logging for Java and/or Android version of CouchbaseLite


#1

In the iOS implementation of Couchbase lite a developer can control logging categories and verbosity by adding arguments via Xcode’s build arguments as shown here:

This is a very useful feature as logging can be adjusted without requiring code changes.

In the Java and/or Android versions of CouchbaseLite is Manager.enableLogging the only method of adjusting logging output or is there a similar capability via environment, configuration, or JVM options to control logging output?

Thanks


#2

There are a few options.

By default, CBL feeds through to the default Android logging system. This, in turn, feeds through Logcat, which has several ways to apply filtering.

You could add meta-data to your Android manifest and use that to configure logging.

In the most extreme case, CBL on Android hooks via a factory through to a class SimpleLogger. You could replace that class. That can be done either by changing the class used in the Java core part, or by replacing the class in the Android specific code. The Android specific code is relatively small, so that might be the easier approach.