Wednesday, November 5, 2025

Android Studio: using Logcat and filter

 

LevelPriorityUse Case
Log.v()Verbose (V)Everything. Detailed tracing of functions, variable values, lifecycle events.
Log.d()Debug (D)General debugging messages useful for development.
Log.i()Info (I)Important business logic messages, typical user actions, system state changes.
Log.w()Warn (W)Use of deprecated APIs, non-critical errors that can be recovered.
Log.e()Error (E)Critical errors that cause a failure or stop a feature from working.
Log.wtf()Assert (A)What a Terrible Failure. Reserved for conditions that should never happen.

Option to filter in Andorid Studio Logcat

  1. tag: Filters messages by a specific log tag.
    Example: tag:MyActivity
  2. level: Filters messages at the specified log level or higher. Levels include VERBOSE (V), DEBUG (D), INFO (I), WARN (W), ERROR (E), and ASSERT (A).
    Example: level:ERROR (shows ERROR and ASSERT logs)
  3. process: Filters messages by the process name or process ID (PID).
    Example: process:1234 or process:com.example.app
  4. age: Filters messages by how recent they are. The value is a number followed by a unit of time: s (seconds), m (minutes), h (hours), or d (days).
    Example: age:5m (shows messages from the last 5 minutes)
  5. is: Can be used with crash to filter only crash logs.
    Example: is:crash
  6. package: A convenient shortcut to filter logs only from the currently running application's package. 

Logical operation can be use in Logcat Filter

  1. && (AND): Requires both conditions to be true.
    Example: package:mine && level:WARN
  2. | (OR): Requires at least one condition to be true.
    Example: tag:Tag1 | tag:Tag2
  3. - (NOT/Exclude): Excludes logs matching the condition. Place the hyphen before the key.
    Example: -tag:ExcludedTag

Example usage Logcat filter:

  1. package:mine level:INFO "user data" -tag:network
  2. tag:MyTag && level:DEBUG || is:crash 

Credit: Table conversion to html online http://the-mostly.ru/online_html_table_generator.html