asn at samba.org
Mon Nov 28 09:47:27 UTC 2016
On Monday, 28 November 2016 15:08:50 CET Martin Schwenke wrote:
> Amitay and I are in the process of moving to (more directly) use
> Samba's debug support. At the moment we are doing file and syslog
> logging using CTDB's own backends, which are hooked into debug.[ch]
> using the DEBUG_CALLBACK support.
thanks for looking into this mess!
> We have come across (at least!) a couple of idiosyncrasies in
> debug.[ch]... :-)
> * Headers and messages can be interleaved in file logging
> Header and message are written using 2 separate write() calls (via
> dbghdrclass(), dbgtext()). So, if 2 processes are writing to the same
> log file, then you can get <header1>, <header2>, <message1>,
> <message2>... or other variations.
> This could be improved if the above 2 functions added to the buffer
> and a single write() was then used.
> * When logging to syslog, header information is duplicated
> That is the date and time (and maybe PID, progname), are present in
> the output of dbghdrclass() and syslog adds them as well.
> All the backends other than file (syslog, systemd, lttng,
> GPFS) probably add their own timestamps.
> This could be improved by having dbghdrclass() omit these items and
> have the file backend add those that are configured.
> For CTDB logging we only really want single-line messages, with an
> appropriate non-redundant header. For file we want a header
> (date, time, progname, pid). For syslog we want to send just a bare
> message and have syslog do the rest.
> Suggestions? Ideas? :-)
Please take a look into the options:
debug prefix timestamp
They are related and are totally broken.
The suggestion I have is that we need tests for the debug system. We have
features which do not work and nobody notices.
Testing debug is possible using the Mock object  support in cmocka .
Andreas Schneider GPG-ID: CC014E3D
Samba Team asn at samba.org
More information about the samba-technical