JakeWharton / timber

A logger with a small, extensible API which provides utility on top of Android's normal Log class.
https://jakewharton.github.io/timber/docs/5.x/
Apache License 2.0
10.46k stars 962 forks source link

Synthetic stacktrace didn't have enough elements #375

Closed romanbsd closed 3 years ago

romanbsd commented 4 years ago

I'm not sure that it's a bug, but here's what's happening. This happens in one specific scenario. We have a JNI component that calls callback methods. In debug it works fine, however in release timber trows "IllegalStateException: Synthetic stacktrace didn't have enough elements". The proguard is in fact used. Currently we work around this issue by doing Timber.tag("something") to specify an explicit tag. It's not clear what might be the reason why it crashes only in this scenario (the JNI attached thread has less stack frames, perhaps) and how to workaround or fix this properly (since getTag() is final). Please advise.

antonkovalyov351 commented 4 years ago

up

ganfra commented 4 years ago

@romanbsd, not sure it's still relevant for you, but make sure you don't have any DebugTree planted in release.

mhartvick commented 4 years ago

up

amitav13 commented 3 years ago

@romanbsd, not sure it's still relevant for you, but make sure you don't have any DebugTree planted in release.

Any specific reason for this? I've extended it to made my own CrashlyticsTree in which I log to Crashlytics, it's been working fine for me.

JakeWharton commented 3 years ago

Should be fixed by ef261be00863845f58fda50b640c8f895f68dc61 which selects first non-library frame