0

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())
        }
Synth
  • 21
  • 1
  • 4
  • Please make sure you are not filtering log messages with a tag name. Timber will find out which class it is been called and will add that as its tag. So it can vary. – Atick Faisal May 27 '23 at 20:31
  • @AtickFaisal The only filter present is the default `package:mine`. But even when removing all filters, Timber literally does not print those particular messages. – Synth May 28 '23 at 00:26

0 Answers0