From:  Valentin Gosu <valentin.gosu@gmail.com>
Date:  23 Oct 2012 04:46:57 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.tech.network
Subject:  

Re: Logging events in Necko

NNTP-Posting-Host:  63.245.216.66

On 10/15/12 2:05 PM, Jason Duell wrote:
> On 10/15/2012 12:20 PM, Brian Smith wrote:
>> Jason Duell wrote:
>>> Our setup also is less than ideal with multiple processes: see
>>>
>>>     https://bugzilla.mozilla.org/show_bug.cgi?id=638375
>>>
>>>     https://bugzilla.mozilla.org/show_bug.cgi?id=534764
>> Regarding multi-process NSPR logging, don't we just need to send the 
>> log output of child processes to a pipe that is consumed by the 
>> parent process, and then have the parent process PR_LOG() what it 
>> received with some information tacked on (child process ID)?
>
> Sure, a pipe would be one solution.  Some sort of IPC communication is 
> needed.
>
>> NSPR_LOG_FILE should NOT work for child processes anyway, because 
>> child processes aren't allowed to do disk I/O.
>
> Right--that's how we're doing it now, and it's not viable long-term.

I'm moving forward with implementing NetLog - for logging events in the 
networking layer.
I'm currently using an nsObserverService to do all of the actual 
notifying. However, nsObserverService methods are meant to be called 
from the main thread. My current implementation posts the LOG calls to 
the main thread, but this is obviously not good for performance.
My thinking is that I could extend nsObserverService to allow calls from 
any thread, and use another separate thread to call the observer 
methods. This thread could be created and active only while logging is 
enabled.

Feedback is appreciated.
Thanks