[Klaus Schmidinger] [vdr] Process id in syslog

Klaus Schmidinger Klaus.Schmidinger at cadsoft.de
Sun Jan 8 15:18:08 CET 2006


Patrick Cernko wrote:
> Klaus Schmidinger wrote:
> ...
>>What I want is that a call like
>>
>>  openlog("vdr", LOG_PID | LOG_CONS, LOG_USER);
>>
>>followed by
>>
>>  syslog(LOG_INFO, "some log message");
>>
>>writes to the log file
>>
>>  Jan  7 12:25:52 video vdr[7457]: some log message
>>
>>where [7457] should be the pid of the actual thread, not that
>>of the main thread.
>>
>>For instance, on a non-NPTL system, the log looks like this:
>>
>>
>>Dec 10 14:38:51 video vdr[709]: VDR version 1.3.38 started
>>Dec 10 14:38:51 video vdr[709]: loading /video/setup.conf
>>...
>>Dec 10 14:38:51 video vdr[711]: video directory scanner thread started
>>(pid=711, tid=711)
>>
>>
>>while on an NPTL system I get:
>>
>>
>>Jan  7 12:25:51 video vdr[7457]: VDR version 1.3.38 started
>>Jan  7 12:25:51 video vdr[7457]: loading /video/setup.conf
>>...
>>Jan  7 12:25:52 video vdr[7457]: video directory scanner thread started
>>(pid=7457, tid=7459)
>>
>>
>>As you can see, in the first case there is vdr[709] for the main thread
>>and vdr[711] for the second thread. In the second case there is vdr[7457]
>>for both threads, while I would like the second thread to show vdr[7459].
>>
>>Here's a manually created example of how this should look:
>>
>>
>>Jan  7 12:25:51 video vdr[7457]: VDR version 1.3.38 started
>>Jan  7 12:25:51 video vdr[7457]: loading /video/setup.conf
>>...
>>Jan  7 12:25:52 video vdr[7459]: video directory scanner thread started
>>(pid=7457, tid=7459)
>>
> 
> 
> Hi Klaus,
> 
> a short look into the documentation gave me the impression, that your
> wish is not yet supported by the glibc, at least on my Debian Sarge
> system. An idea might be to check, what happens if you do the openlog
> call for testing in the desired thread, e.g. for testing before every
> syslog call. If this does not produce to much load and solves the
> problem, I would say "Just do it!" and post a according bug report to
> the glibc-Developers. :-)

I tried opening the log separately in each thread (and even didn't
open it in the main thread), but it still logs everything with the
main thread's id :-(

Klaus



More information about the vdr mailing list