Thom
Thom

Reputation: 15092

What does the number in the logcat entry mean?

I have read this: Read logcat programmatically within application as well as others and googled for answers. I find close, but no cigar.

I'm parsing a log entry from the Android log. Here's an example:

D/WifiStateMachine(  923): processMsg: ConnectedState

What is the 923? My guess is PID, but I can't verify.

Upvotes: 0

Views: 350

Answers (2)

Patrik Oldsberg
Patrik Oldsberg

Reputation: 1550

I got curious and wanted a bit more "proof" since the documentation doesn't specifically mention that that number is the PID. I looked up the source of the log formatting function, and it is indeed and unsurprisingly the PID.

switch (p_format->format) {

    ...

    case FORMAT_BRIEF:
    default:
        prefixLen = snprintf(prefixBuf, sizeof(prefixBuf),
            "%c/%-8s(%5d): ", priChar, entry->tag, entry->pid);
        strcpy(suffixBuf, "\n");
        suffixLen = 1;
        break;
}

Upvotes: 0

Larry Schiefer
Larry Schiefer

Reputation: 15775

It is the PID. See the logcat output format options for details. You can also have it show you the thread ID along with the PID.

Upvotes: 3

Related Questions