[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: slapd logging



Sorry, this was supposed to go to the list, and I just
sent it to Kurt...

What I did for my Java logging was create a class that 
uses a hash map to store the requested logging by mnemonic:

Debug.DirectoryServices true
Debug.Servlet.request true
Debug.Servlet.process true
.
.
.

Anyway, something similar could be done in C.  Just keep
an array of requested logging subsystems.  Instead of
just true/false, an integer level could be maintained.
I think this is complex enough that it should be supported
in the configuration file, with overrides on the command
line.  Something like

Debug  caching=1
Debug  filter=0
Debug  acl=3
.
.
.

(I'm sure -D is taken, but whatever character is available)
slapd -D acl=4 ...

Then the Log prototype would be as you suggest.

Oh, and there's a special subsystem, All that turns on
debugging for all subsystems:  
    Debug all=5
so all subsystems would have a minimum debugging level
of 5 in this case.

> -----Original Message-----
> From: Kurt D. Zeilenga [mailto:Kurt@OpenLDAP.org]
> Sent: Tuesday, September 26, 2000 2:47 PM
> To: openldap-devel@OpenLDAP.org
> Subject: RE: slapd logging
> 
> 
> I'd like to see a well thought out logging design... (and, no,
> I'm not volunteering :-).
> 
> One approach would be to have:
> 	1) a global "level" (e.g. 
> critical,error,notice,info,debug,noise)
> 	2) per subsystem levels (same levels as above) where each
> 	library (lber,ldap,lutil,etc), each backend, plus ACL, schema
> 	etc.
> 
> Each log message would be written like:
> 	Log( LOG_SUBSYS, LOG_LEVEL, "format", ...);
> 
> The check would be:
> 	( level >= global_level || level >= subsys_level[subsys] )
> 
> and would be enabled using:
> 	-l level
> and/or
> 	-l subsys:level
> and/or
> 	-l subsysA,subsysB:levelX;subsysC:levelY;level
> and/or as multiple, combined arguments.
> 
> There are other workable alternatives...
> 
> Kurt
>