[Samba 4] Default logging format isn't optimal

Dan Shearer dan at shearer.org
Fri Aug 31 14:51:57 GMT 2007


On Fri, Aug 31, 2007 at 12:44:02PM +0200, Matthias Dieter Walln?fer wrote:
> Hi all!
> 
> I noticed in bugzilla someone who writes, that the logging format in 
> SAMBA 4 isn't such good.
> 
> The default logging format is kind of sucky right now. The main issue is 
> that each event is spread across two lines.

The developer functionality isn't ideal either. We've hit this in OpenChange
and need to find a solution. Hopefully the process of fixing that would also
fix issues like the one you raise. We've talked about it in OpenChange, I'll
summarise here.

Problems:

1. There is no choice, you have to call DEBUG() even when you mean LOG(). So
Samba logs are a mess, with developer messages mixed up with administrative
messages.

2. There has not always been a defined list of debuglevels with their meaning,
so it is not possible to precisely split off a stream of messages with a
particular meaning. 

3. Doesn't take callbacks.

The callback idea means code can register a function with the logging system,
and a log event calls that function with a Samba-formatted string. The calling
code can do what it likes with that message. Other forms destinations could be
used as well without change. 

This is what callbacks would allow:

4. Samba third-party DSOs to report Samba error messages in whatever format the
plugin's users expect. 

5. Samba library users to use do the same, in our case libmapi. libmapi needs a
logging system and we'll be using it to generate our own sorts of messages, but
it would be really really nice if the same system also handled Samba log
messages. This code is going to end up on end-user computers all over the place
running on a variety of operating systems, and traditional Samba-style logging
will often make no sense.

6. code that links against libraries that link against Samba can *also* receive
Samba messages. In our case, groupware applications that link against libmapi.
For example, some GUI application on some operating system calls mapi_log_init,
registering a callback. mapi_log_init calls Samba's samba_log_ini, registering
a callback to libmapi. The _init functions also pass a starting loglevel (which
can be modified later on.) When a Samba library calls DEBUG, the loglevel is
checked, the string is formatted, then passed back to libmapi. libmapi checks
its own loglevel, modifies the formatting if required, and passes it back to
the GUI application. Which means that when required, an IT support person can
sit at an end-user's desk and see a level 9 Samba DEBUG message in a nice
scrollbox.

It means OC doesn't need any logging code in-tree. And we'd be helping
to improve Samba's logging.

BTW It would be good if Samba could log to EventLog as well as syslog. I
think we know how to do that reliably now, just has to be integrated.

-- 
Dan Shearer
dan at shearer.org


More information about the samba-technical mailing list