Change to MOZ_LOG output formatting coming: Thread identifiers will include the PID (process id)

Right now MOZ_LOG's default output does not include process identifiers, 
so messages from different processes look misleadingly similar:

[Main Thread]: D/nsBlah Message Message
[Main Thread]: D/nsBlah Message Message

They will soon instead look like:

[4372:Main Thread]: D/nsBlah Message Message
[4452:Main Thread]: D/nsBlah Message Message

If you mainly interact with things through mach, you may be thinking, 
"Hey!  What about those PIDs things get tagged with?":

GECKO(3972) | [Main Thread]: D/nsBlah Message Message
GECKO(3972) | [Main Thread]: D/nsBlah Message Message

AFAICT, mach and/or its helpers are doing a best-effort tagging of the 
stdout/stderr of the spawned parent process.  Since the content 
processes inherit the descriptors of the parent, mach/friends are unable 
to magically figure out the true writer without additional machinery to 
give each content process its own descriptors that are pushed out to 
mach via sendmsg or something else fancy.  So everything gets labeled 
with the parent PID.  It would be cool to have a mechanism so that the 
structured logging output could be properly labeled, but that arguably 
is a different bug.

The change to add the PID is tracked on so if you have 
thoughts/proposals/patches, please chime in there.  This change will 
likely land sometime late today or tomorrow otherwise.  This may break 
log parsers that use very specific regexps, although the location was 
chosen to leverage the enclosing "[]" and the one I know about is fine[1].

If you would like to learn more about Gecko logging in general, please 

If you're wondering why this didn't seem to be a problem for Necko's 
cool about:networking logging as documented at 
it's because MOZ_LOG did already have a mechanism for partitioning log 
files by labeled process, see



1/10/2018 4:36:32 PM 6457 articles. 0 followers. Post Follow

0 Replies

Similar Articles

[PageSpeed] 46