shadow_wxh
shadow_wxh

Reputation: 448

How to filter android logcat by exact word and space between words?

for example if I have

private String TAG ="Preview"; 
......
Log.d(TAG,"Preview Start");

and Set logcat filter to Preview then all logs contain Preview will come up "DrawPreview" "ActivityPreview" etc.What I want is just "Preview"

another case is when I have space in the TAG

    private String TAG ="Main Activity"; 
    ......
    Log.d(TAG,"Main Activity Start");

Logcat filter only recongnise the first word, other stuff after space is ignored.

Upvotes: 2

Views: 1208

Answers (3)

BitByteDog
BitByteDog

Reputation: 3524

Enter this as the logcat filter in the "Log Tag" field, make sure Regex is checked

^Main\WActivity$

That will match "Main Activity" and only that tag.

Upvotes: 1

Sivakumar
Sivakumar

Reputation: 108

You Need to Add the Unique Tags it may help you find the exact search

For Example, Refer to this one,

int random = new Random().nextInt(10)+1;
        Log.d("'Preview'", "Dice: "+random);
        Log.d("DrawPreview", "Dice: "+random);
        Log.d("ActivityPreview", "Dice: "+random);

then search debug 'preview'

you will find the extact what you need.

Upvotes: 0

shadow_wxh
shadow_wxh

Reputation: 448

To match exact word you should use pattern

^EXACT_WORLD_TO_MATCH$

in the logcat filter

I still dont know how to include space between them.

Upvotes: 2

Related Questions