[patch] make the logging header customisable

Matthieu Patou mat at samba.org
Thu Jun 6 00:23:03 MDT 2013

On 06/05/2013 04:28 AM, Jeremy Allison wrote:
> On Sun, May 19, 2013 at 10:06:26AM -0700, Matthieu Patou wrote:
>> Hello,
>> Find attached an updated version of this, feedback and review welcome.
>> On 06/12/2012 01:27 AM, Matthieu Patou wrote:
>>> Hello Volker & all,
>>> A couple of months ago we briefly discussed on the possibility to
>>> have a header printed even if we log on the stdout because with
>>> more than 1 process logging it can be a bit tedious sometime to
>>> understand who print what.
>>> My understanding was that you were more or less ok with this idea
>>> but that instead of adding a simple boolean to say "add headers
>>> also when logging to stdout" you proposed me (at least that was my
>>> understanding) to be able to specify the header that we want to
>>> have.
>>> I've been working on this lately and come with the following patch
>>> for the 3.5.x branch, it seems to work ok as if the "debug header
>>> template" parameter is not specified the header is as it was
>>> (which means no header in case of logging to stdout) but if you
>>> specify it then it will be as specified.
>>> For the moment the patch is for 3.5.14 as it's what we use at my
>>> work and it helps us during the QA and dev debug, it didn't apply
>>> yet to master but I'll do the job of front port if the idea of the
>>> patch is ok (and if it's also at least mostly ok).
> Can you do a forward port to master so I can help
> work on it ?
It's patch made on master, I just pull master and tried to reapply and 
it works
>   I think this is a good idea but I'm not
> 100% happy with the implementation (the char [200] fixed
> size buffer on the stack makes me nervous :-)
Well I wanted to avoid dynamic memory allocation and tried to be very 
cautious about the overflow (and I actually did some testing to check 
that no matter we truncate), we could use a static buffer as well where 
the stack is not easily accessible.
Note that the previous version has also this 200 buffer in the stack.
>   and I
> don't have time to do my own forward port right now.
> I certainly think this is along the right lines though.
Thanks for the feedback, much appreciated that you came back to me !


Matthieu Patou
Samba Team

More information about the samba-technical mailing list