Android ADB Logcat: colon tag

How can I filter the output adb logcatfor a tag with a colon in it (only with logcat, not using grepor identical tools)?

eg:.

adb logcat "SomeApp:Something:* *:S"

where "SomeApp:Something"is the specified tag.

I know that this symbol should not be used in the tag, but, unfortunately, this is third-party code, not ours ...

Thank you in advance!

+5
source share
2 answers

I have to say this is a good question. I checked the code for logcat and found out the parsing code for the filter expression in logcat.cpp.

int android_log_addFilterRule(AndroidLogFormat *p_format,
        const char *filterExpression)
{
    size_t i=0;
    size_t tagNameLength;
    android_LogPriority pri = ANDROID_LOG_DEFAULT;

    tagNameLength = strcspn(filterExpression, ":");

    if (tagNameLength == 0) {
        goto error;
    }

    if(filterExpression[tagNameLength] == ':') {
        pri = filterCharToPri(filterExpression[tagNameLength+1]);

        if (pri == ANDROID_LOG_UNKNOWN) {
            goto error;
        }
    }

    ...

    return 0;
error:
    return -1;
}

logcat strcspn (filterExpression, ":" ) , , , logcat. .

, DDMS eclipse , RE, .

"SomeApp\:Something:* *:S"

OR, :

^Something1$|^Something2$

eclipse, . script, , . , .

+2

, grep:

adb logcat | grep SomeApp

, TAG AudioPolicyManager "APM:: AudioPolicyManager", :

adb logcat *: V | grep APM

0

All Articles