You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to use the logger on an Android 6 device and receive an exception:
FATAL EXCEPTION: main
Process: <package>, PID: 10196
java.lang.RuntimeException: Unable to start activity ComponentInfo{<package>/<package>.LoginActivity}: java.lang.IllegalArgumentException: Log tag "<package>.LoginViewModel" exceeds limit of 23 characters
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2520)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5466)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.IllegalArgumentException: Log tag "<package>.LoginViewModel" exceeds limit of 23 characters
at android.util.Log.isLoggable(Native Method)
at io.github.oshai.internal.KLoggerAndroid.<init>(KLoggerAndroid.kt:104)
at io.github.oshai.KotlinLogging.logger(KotlinLogging.kt:34)
at io.github.oshai.KotlinLogging.logger(KotlinLogging.kt:13)
at <package>.LoginViewModel.<init>(LoginViewModel.kt:25)
...
I removed the full package name and replaced it with . The package + class name (LoginViewModel) has 46 characters.
what version of kotlin-logging are you using? the default we use is slf4j (in v5) which can be redirect to logback which will handle this (unless add -Dkotlin-logging-to-android-native).
Sorry my fault, we were still using the 4.0.0-beta-27 version. After upgrading to 5.0.0 it works as expected. The logs are sent to slf4j / logback-android and the tag is shortened.
Thanks for your quick help!
I tried to use the logger on an Android 6 device and receive an exception:
I removed the full package name and replaced it with . The package + class name (LoginViewModel) has 46 characters.
Android documentation:
https://developer.android.com/reference/android/util/Log.html#isLoggable(java.lang.String,%20int)
It seems like Logback for Android handles the character limit:
https://github.com/tony19/logback-android/blob/d6ed2017fb87e30e8b32d794523ac29c24123c87/logback-android/src/main/java/ch/qos/logback/classic/android/LogcatAppender.java#L46
Is there any workaround we could use?
The text was updated successfully, but these errors were encountered: