Why is Timber logger not working consistently in my Android app? (Kotlin)

103 Views Asked by At

I'm developing an app on Android and Timber is only logging in some places and not on others.

I tried logging in the same places with Log.e() and it worked on all places, meanwhile Timber didn't log on those same locations. For example, I have an implementation of Network Service Discovery, and in the onDiscoveryStarted() Timber fails to log where Log.e() does not:

override fun onDiscoveryStarted(regType: String) {
                // Called as soon as service discovery begins.
                Timber.e("Service discovery started: $regType") // does not appear in Logcat
                Log.e("nsdhelper", "SERVICE DISCOVERY STARTED $regType") // appears in Logcat
            }

same thing happens on my ViewModel init{} block:

init {
        Timber.e("==================================================================")
        Log.d("mainviewmodel", "==================================================")
...
}

I did create a timber instance in case you are curious, and it does work in most other places. It's just frustrating how inconsistent it is and I need to log to debug some issues. Any idea what I might be doing wrong?

        if (BuildConfig.DEBUG) {
            Timber.plant(Timber.DebugTree())
        }
0

There are 0 best solutions below