Vinoth
Vinoth

Reputation: 5785

Android - adb logcat without debug logs

I don't want to see debug logs from adb logcat command. There are tons of debug logs from my phone and I don't want to see them.

adb logcat --help says " *:I " will output only info logs but is there any option to filter all logs except debug.

Upvotes: 79

Views: 139868

Answers (7)

Grant
Grant

Reputation: 6309

If you're on zsh like on Catalina OSX instead of bash you may need to perform the following commands:

Use:
noglob adb logcat *:E
Replace the E as required.

Alternatively:
adb logcat '*:E'
(Include single quotes)


V: Verbose
D: Debug
I: Info
W: Warning
E: Error
F: Fatal
S: Silent

The reason being that Zsh interprets the wildcard as you wanting to expand files ending in that letter without the quotes wrapping around or the noglob prefix.

Upvotes: 12

Bo Kristensen
Bo Kristensen

Reputation: 1650

If you have a specific application you are looking for eg. a flutter application you can string the parameter commands together like adb logcat *:s flutter:* *:w

this states that:

*:s all should be silenced

flutter:* show everything related to "flutter"

*:w show all warnings and up.

Upvotes: 0

brianestey
brianestey

Reputation: 8302

From the docs here, when you specify a log level filter, it will show all messages at that level and higher. The levels are specified as:

The tag of a log message is a short string indicating the system component from which the message originates (for > example, "View" for the view system).

The priority is one of the following character values, ordered from lowest to highest priority:

  • V: Verbose (lowest priority)
  • D: Debug
  • I: Info
  • W: Warning
  • E: Error
  • F: Fatal
  • S: Silent (highest priority, on which nothing is ever printed)

...

The following filter expression displays all log messages with priority level "warning" and higher, on all tags:

adb logcat *:W

So with this in mind, passing the filter you mentioned *:I will log everything but Verbose and Debug logs.

Unless your intention is to show Verbose as well as the other log levels, I don't think you can do that because specifying Verbose includes anything above Verbose.

If that is the case, it might be useful for you to filter on a specific tag instead of a specific log level, or some combination of both.

Upvotes: 165

AbePralle
AbePralle

Reputation: 992

logcat won't let you show Debug only but you can show Debug and higher (Debug, Info, Warning, Error, Fatal) with:

adb logcat YourLogTag:D *:S

The *:S suppresses logs from other apps.

You can pipe the result through grep to only show Debug:

adb logcat YourLogTag:D *:S | grep "D YourLogTag"

Upvotes: 7

Rajesh
Rajesh

Reputation: 15774

adb logcat *:I will display all logs with priority INFO and higher.

The priority is one of the following character values, ordered from lowest to highest priority:

  • V — Verbose (lowest priority)
  • D — Debug
  • I — Info
  • W — Warning
  • E — Error
  • F — Fatal
  • S — Silent (highest priority, on which nothing is ever printed)

The above information is available in Write and View Logs with Logcat

Upvotes: 23

Iman Marashi
Iman Marashi

Reputation: 5753

To enable logging on some Huawei devices:

  • Dial *#*#2846579#*#*

  • Select 'ProjectMenu'

  • Select 'Background Setting'

  • Select 'Log Setting'

  • Select 'Log Switch'

  • Enable 'LOG on'

  • Select 'Log level setting'

  • Enable 'DEBUG'

  • Press the 'Back' key

  • Select 'Dump and Log'

  • Enable 'Open Dump and Log'

  • Press 'Back' key 5 times to return to home screen.

  • Reboot the phone.

LogCat should now work.

Upvotes: 7

Chrishan
Chrishan

Reputation: 4106

You can create a filter for a specific application using its package name.

Upvotes: -1

Related Questions