Menu

Android Logging in Kotlin: Logcat, Log Levels, Device Logs and Remote Logging
πŸ“°

Android Logging in Kotlin: Logcat, Log Levels, Device Logs and Remote Logging

DEV Community: kotlinΒ·Elisha SterngoldΒ·10 days ago
#vac9UhTt
#devtokotlin#devto#dev#logcat#android
Long article (1960 words) β€” no AI summary yet.
Reading 0:00
15s threshold

On your desk, Android logging feels solved. You call Log.d , the line shows up in Logcat, and you move on.

Then a user reports a bug you can't reproduce, and you find out what Android logging actually is: a set of ring buffers inside one phone. They're small, they overwrite themselves, and since Android 4.1 no other app on that phone may read your app's lines. The log that explains the bug exists. It's just in the one place you can't reach.

This guide covers every place Android logs live: writing them, filtering them in Android Studio, pulling them off a device, the system and event buffers, what to do in release builds, and how to get them from your users' phones.

Writing Logs: the Log Class and Its Levels

Everything starts with android.util.Log . Each call takes a tag β€” a short string that says where the line came from β€” and a message:

private const val TAG = "CheckoutViewModel"

Log . v ( TAG , "Recomposing cart, ${items.size} items" ) // Verbose Log .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.