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 .β¦