mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
allow to use names to set loglevel
This commit is contained in:
parent
7507596ccc
commit
f33b51832a
@ -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
|
.\"only go to stderr and are not recorded anywhere else. Specifying a logfile
|
||||||
.\"copies messages to both stderr and the logfile.
|
.\"copies messages to both stderr and the logfile.
|
||||||
.TP
|
.TP
|
||||||
.B loglevel <integer>
|
.B loglevel <integer> [...]
|
||||||
Specify the level at which debugging statements and operation
|
Specify the level at which debugging statements and operation
|
||||||
statistics should be syslogged (currently logged to the
|
statistics should be syslogged (currently logged to the
|
||||||
.BR syslogd (8)
|
.BR syslogd (8)
|
||||||
@ -523,42 +523,57 @@ are:
|
|||||||
.PD 0
|
.PD 0
|
||||||
.TP
|
.TP
|
||||||
.B 1
|
.B 1
|
||||||
|
.B (trace)
|
||||||
trace function calls
|
trace function calls
|
||||||
.TP
|
.TP
|
||||||
.B 2
|
.B 2
|
||||||
|
.B (packet)
|
||||||
debug packet handling
|
debug packet handling
|
||||||
.TP
|
.TP
|
||||||
.B 4
|
.B 4
|
||||||
|
.B (args)
|
||||||
heavy trace debugging
|
heavy trace debugging
|
||||||
.TP
|
.TP
|
||||||
.B 8
|
.B 8
|
||||||
|
.B (conns)
|
||||||
connection management
|
connection management
|
||||||
.TP
|
.TP
|
||||||
.B 16
|
.B 16
|
||||||
|
.B (BER)
|
||||||
print out packets sent and received
|
print out packets sent and received
|
||||||
.TP
|
.TP
|
||||||
.B 32
|
.B 32
|
||||||
|
.B (filter)
|
||||||
search filter processing
|
search filter processing
|
||||||
.TP
|
.TP
|
||||||
.B 64
|
.B 64
|
||||||
|
.B (config)
|
||||||
configuration file processing
|
configuration file processing
|
||||||
.TP
|
.TP
|
||||||
.B 128
|
.B 128
|
||||||
|
.B (ACL)
|
||||||
access control list processing
|
access control list processing
|
||||||
.TP
|
.TP
|
||||||
.B 256
|
.B 256
|
||||||
|
.B (stats)
|
||||||
stats log connections/operations/results
|
stats log connections/operations/results
|
||||||
.TP
|
.TP
|
||||||
.B 512
|
.B 512
|
||||||
|
.B (stats2)
|
||||||
stats log entries sent
|
stats log entries sent
|
||||||
.TP
|
.TP
|
||||||
.B 1024
|
.B 1024
|
||||||
|
.B (shell)
|
||||||
print communication with shell backends
|
print communication with shell backends
|
||||||
.TP
|
.TP
|
||||||
.B 2048
|
.B 2048
|
||||||
|
.B (parse)
|
||||||
entry parsing
|
entry parsing
|
||||||
.PD
|
.PD
|
||||||
.RE
|
.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
|
.RE
|
||||||
.TP
|
.TP
|
||||||
.B moduleload <filename>
|
.B moduleload <filename>
|
||||||
@ -644,7 +659,7 @@ during processing of LDAP Password Modify Extended Operations (RFC 3062).
|
|||||||
This string needs to be in
|
This string needs to be in
|
||||||
.BR sprintf (3)
|
.BR sprintf (3)
|
||||||
format and may include one (and only one) %s conversion.
|
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"
|
characters from [A\-Za\-z0\-9./]. For example, "%.2s"
|
||||||
provides a two character salt and "$1$%.8s" tells some
|
provides a two character salt and "$1$%.8s" tells some
|
||||||
versions of crypt(3) to use an MD5 algorithm and provides
|
versions of crypt(3) to use an MD5 algorithm and provides
|
||||||
|
@ -1965,18 +1965,69 @@ restrict_unknown:;
|
|||||||
ldap_syslog = 0;
|
ldap_syslog = 0;
|
||||||
|
|
||||||
for( i=1; i < cargc; i++ ) {
|
for( i=1; i < cargc; i++ ) {
|
||||||
int level = strtol( cargv[i], &next, 10 );
|
int level;
|
||||||
if ( next == NULL || next[0] != '\0' ) {
|
|
||||||
|
if ( isdigit( cargv[i][0] ) ) {
|
||||||
|
level = strtol( cargv[i], &next, 10 );
|
||||||
|
if ( next == NULL || next[0] != '\0' ) {
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
LDAP_LOG( CONFIG, CRIT,
|
LDAP_LOG( CONFIG, CRIT,
|
||||||
"%s: line %d: unable to parse level \"%s\" in \"loglevel <level> [...]\""
|
"%s: line %d: unable to parse level \"%s\" "
|
||||||
" line.\n", fname, lineno , cargv[i] );
|
"in \"loglevel <level> [...]\" line.\n",
|
||||||
|
fname, lineno , cargv[i] );
|
||||||
#else
|
#else
|
||||||
Debug( LDAP_DEBUG_ANY,
|
Debug( LDAP_DEBUG_ANY,
|
||||||
"%s: line %d: unable to parse level \"%s\" in \"loglevel <level> [...]\""
|
"%s: line %d: unable to parse level \"%s\" "
|
||||||
" line.\n", fname, lineno , cargv[i] );
|
"in \"loglevel <level> [...]\" line.\n",
|
||||||
|
fname, lineno , cargv[i] );
|
||||||
#endif
|
#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 <level> [...]\" line.\n",
|
||||||
|
fname, lineno , cargv[i] );
|
||||||
|
#else
|
||||||
|
Debug( LDAP_DEBUG_ANY,
|
||||||
|
"%s: line %d: unknown level \"%s\" "
|
||||||
|
"in \"loglevel <level> [...]\" line.\n",
|
||||||
|
fname, lineno , cargv[i] );
|
||||||
|
#endif
|
||||||
|
return( 1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ldap_syslog |= level;
|
ldap_syslog |= level;
|
||||||
|
Loading…
Reference in New Issue
Block a user