CCJ
CCJ

Reputation: 1719

Use adb shell to disable spam logs with priority ERROR

I'm stuck using a closed-source library whose developers decided it would be wise to log every operation, no matter how trivial, with priority ERROR. Many of these operations occur in continuous loops. I can filter the output in logcat, but there is so much that relevant messages disappear faster than I can read them in DDMS's logcat viewer.

So far I've tried the following:

stop
setprop <tag> 7 //it looks like setprop expects the pri level as a string, so this won't
start           //work

stop
setprop <tag> INFO //I think this allows for INFO pri logs and above, so that doesn't
start              //help

logcat <tag>:S //should suppress all logs from the given tag, but has no effect on
               //logs in logcat and starts cloning logcat output to the shell for some
               //reason
logcat *:S //tried just to see if it would work -- it printed the beginning of new
           //empty log session to the shell and then never returned control of the shell.
           //logcat output in Eclipse was unaffected

as root, but none of these suppressed the ERROR spam. Do I need to specify a target VM running on the device to which the above commands should apply or are they system-wide? If I do need to specify a VM, how do I do so? The only official documentation I've found that's at all relevant is this for logcat filtering. Are there any comprehensive setprop manuals around, preferably from Google?

Main Question: Is there any way to disable/suppress all logs with a given tag, even if the priority level is ERROR?

it can't be turned off... but it does break easily

Upvotes: 1

Views: 870

Answers (1)

nkz
nkz

Reputation: 144

One way is to filter out the messages from the command line and store them in an error file. You can try the following command:

adb logcat :W | grep -v "^E" > error.log

.

*:W

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

grep -v "^E"*

filters out all the Error messages.

> error.log

Saves all these messages in a file.

Hope this helps.

Upvotes: 1

Related Questions