diff --git a/doc/man/man5/slapd.conf.5 b/doc/man/man5/slapd.conf.5 index d495e94000..890f18a2bb 100644 --- a/doc/man/man5/slapd.conf.5 +++ b/doc/man/man5/slapd.conf.5 @@ -512,7 +512,7 @@ continuing with the next line of the current file. .\"only go to stderr and are not recorded anywhere else. Specifying a logfile .\"copies messages to both stderr and the logfile. .TP -.B loglevel +.B loglevel [...] Specify the level at which debugging statements and operation statistics should be syslogged (currently logged to the .BR syslogd (8) @@ -523,42 +523,57 @@ are: .PD 0 .TP .B 1 +.B (trace) trace function calls .TP .B 2 +.B (packet) debug packet handling .TP .B 4 +.B (args) heavy trace debugging .TP .B 8 +.B (conns) connection management .TP .B 16 +.B (BER) print out packets sent and received .TP .B 32 +.B (filter) search filter processing .TP .B 64 +.B (config) configuration file processing .TP .B 128 +.B (ACL) access control list processing .TP .B 256 +.B (stats) stats log connections/operations/results .TP .B 512 +.B (stats2) stats log entries sent .TP .B 1024 +.B (shell) print communication with shell backends .TP .B 2048 +.B (parse) entry parsing .PD .RE +The desired log level can be input as a single integer that combines +the (ORed) desired levels, as a list of integers (that are ORed internally), +or as a list of the names that are shown between brackets. .RE .TP .B moduleload @@ -644,7 +659,7 @@ during processing of LDAP Password Modify Extended Operations (RFC 3062). This string needs to be in .BR sprintf (3) format and may include one (and only one) %s conversion. -This conversion will be substituted with a string random +This conversion will be substituted with a string of random characters from [A\-Za\-z0\-9./]. For example, "%.2s" provides a two character salt and "$1$%.8s" tells some versions of crypt(3) to use an MD5 algorithm and provides diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 9868742c96..560275d3f1 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -1965,18 +1965,69 @@ restrict_unknown:; ldap_syslog = 0; for( i=1; i < cargc; i++ ) { - int level = strtol( cargv[i], &next, 10 ); - if ( next == NULL || next[0] != '\0' ) { + int level; + + if ( isdigit( cargv[i][0] ) ) { + level = strtol( cargv[i], &next, 10 ); + if ( next == NULL || next[0] != '\0' ) { #ifdef NEW_LOGGING - LDAP_LOG( CONFIG, CRIT, - "%s: line %d: unable to parse level \"%s\" in \"loglevel [...]\"" - " line.\n", fname, lineno , cargv[i] ); + LDAP_LOG( CONFIG, CRIT, + "%s: line %d: unable to parse level \"%s\" " + "in \"loglevel [...]\" line.\n", + fname, lineno , cargv[i] ); #else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: unable to parse level \"%s\" in \"loglevel [...]\"" - " line.\n", fname, lineno , cargv[i] ); + Debug( LDAP_DEBUG_ANY, + "%s: line %d: unable to parse level \"%s\" " + "in \"loglevel [...]\" line.\n", + fname, lineno , cargv[i] ); #endif - return( 1 ); + return( 1 ); + } + + } else { + static struct { + int i; + char *s; + } int_2_level[] = { + { LDAP_DEBUG_TRACE, "Trace" }, + { LDAP_DEBUG_PACKETS, "Packets" }, + { LDAP_DEBUG_ARGS, "Args" }, + { LDAP_DEBUG_CONNS, "Conns" }, + { LDAP_DEBUG_BER, "BER" }, + { LDAP_DEBUG_FILTER, "Filter" }, + { LDAP_DEBUG_CONFIG, "Config" }, + { LDAP_DEBUG_ACL, "ACL" }, + { LDAP_DEBUG_STATS, "Stats" }, + { LDAP_DEBUG_STATS2, "Stats2" }, + { LDAP_DEBUG_SHELL, "Shell" }, + { LDAP_DEBUG_PARSE, "Parse" }, + { LDAP_DEBUG_CACHE, "Cache" }, + { LDAP_DEBUG_INDEX, "Index" }, + { 0, NULL } + }; + int j; + + for ( j = 0; int_2_level[j].s; j++ ) { + if ( strcasecmp( cargv[i], int_2_level[j].s ) == 0 ) { + level = int_2_level[j].i; + break; + } + } + + if ( int_2_level[j].s == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( CONFIG, CRIT, + "%s: line %d: unknown level \"%s\" " + "in \"loglevel [...]\" line.\n", + fname, lineno , cargv[i] ); +#else + Debug( LDAP_DEBUG_ANY, + "%s: line %d: unknown level \"%s\" " + "in \"loglevel [...]\" line.\n", + fname, lineno , cargv[i] ); +#endif + return( 1 ); + } } ldap_syslog |= level;