The Great Descartes
The Great Descartes

Reputation: 101

How to substring Android logcat output and show only the message itself

I would like to use logcat and output only the messages themselves. Not the method name, not the time, not the tag - just the message.

Example, from this message:

D/ConnectivityService( 471): Setting tx/rx TCP buffers to 524288,1048576,2097152,262144,524288,1048576

I only want the

Setting tx/rx TCP buffers to 524288,1048576,2097152,262144,524288,1048576

Is that possible ?

Upvotes: 1

Views: 910

Answers (4)

Wills
Wills

Reputation: 61

Yes, you can do adb logcat -v raw to get rid of the tags and use pipe | grep -i "" to substring that output if you know what you're searching for. Otherwise, ephemient's answer is perfect. Does that answer your questions (as it seemed to be twofold)?

Upvotes: 0

hsm59
hsm59

Reputation: 2074

After opening your Logcat (Inside Android Studio), on the left side you will see menu icons, select the Settings one and you can check which information you would like to see in the Logcat.

You can see this image for reference.

Upvotes: 1

ephemient
ephemient

Reputation: 204668

Logcat has a format parameter, one of which is the message alone with no metadata.

adb logcat -v raw

You can still apply filters after this, e.g. *:S ConnectivityService:D, even though the tag is no longer part of the output.

Upvotes: 5

azizbekian
azizbekian

Reputation: 62189

Have a look at Jake Wharton's Pidcat.

enter image description here

Upvotes: 0

Related Questions