Samba debug

Martin Schwenke martin at meltin.net
Mon Nov 28 04:08:50 UTC 2016


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.

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?  :-)

peace & happiness,
martin



More information about the samba-technical mailing list