Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • openldap/openldap
  • hyc/openldap
  • ryan/openldap
  • iboukris/openldap
  • ondra/openldap
  • sshanks-kx/openldap
  • blaggacao/openldap
  • pbrezina/openldap
  • quanah/openldap
  • dragos_h/openldap
  • lorenz/openldap
  • tsaarni/openldap
  • fei.ding/openldap
  • orent/openldap
  • arrowplum/openldap
  • barchiesi/openldap
  • jotik/openldap
  • hamano/openldap
  • ingovoss/openldap
  • henson/openldap
  • jlrine2/openldap
  • howeverAT/openldap
  • nivanova/openldap
  • orbea/openldap
  • rdubner/openldap
  • smckinney/openldap
  • jklowden/openldap
  • dpa-openldap/openldap
  • rouzier/openldap
  • orgads/openldap
  • ffontaine/openldap
  • jiaqingz/openldap
  • dcoutadeur/openldap
  • begeragus/openldap
  • pubellit/openldap
  • glandium/openldap
  • facboy/openldap
  • thesamesam/openldap
  • Johan/openldap
  • fkooman/openldap
  • gburd/openldap
  • h-homma/openldap
  • sgallagher/openldap
  • ahmed_zaki/openldap
  • gnoe/openldap
  • mid/openldap
  • clan/openldap
47 results
Show changes
Commits on Source (3)
...@@ -180,6 +180,19 @@ messages exposed by the ...@@ -180,6 +180,19 @@ messages exposed by the
configuration parameter. Specifying a logfile copies messages to both stderr configuration parameter. Specifying a logfile copies messages to both stderr
and the logfile. and the logfile.
.TP .TP
.B logfile-only on | off
Specify that debug messages should only go to the configured logfile, and
not to stderr.
.TP
.B logfile-rotate <max> <Mbytes> <hours>
Specify automatic rotation for the configured logfile as the maximum
number of old logfiles to retain, a maximum size in megabytes to allow a
logfile to grow before rotation, and a maximum age in hours for a logfile
to be used before rotation. The maximum number must be in the range 1-99.
Setting Mbytes or hours to zero disables the size or age check, respectively.
At least one of Mbytes or hours must be non-zero. By default no automatic
rotation will be performed.
.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
......
...@@ -157,6 +157,8 @@ enum { ...@@ -157,6 +157,8 @@ enum {
CFG_CONCUR, CFG_CONCUR,
CFG_THREADS, CFG_THREADS,
CFG_LOGFILE, CFG_LOGFILE,
CFG_LOGFILE_ONLY,
CFG_LOGFILE_ROTATE,
CFG_MIRRORMODE, CFG_MIRRORMODE,
CFG_IOTHREADS, CFG_IOTHREADS,
CFG_MAXBUF_CLIENT, CFG_MAXBUF_CLIENT,
...@@ -292,6 +294,16 @@ static ConfigTable config_back_cf_table[] = { ...@@ -292,6 +294,16 @@ static ConfigTable config_back_cf_table[] = {
&config_generic, &config_generic,
NULL, NULL, NULL NULL, NULL, NULL
}, },
{ "logfile-only", "on|off", 2, 2, 0,
ARG_ON_OFF|ARG_MAGIC|CFG_LOGFILE_ONLY,
&config_generic,
NULL, NULL, NULL
},
{ "logfile-rotate", "max> <Mbyte> <hours", 4, 4, 0,
ARG_MAGIC|CFG_LOGFILE_ROTATE,
&config_generic,
NULL, NULL, NULL
},
{ "loglevel", "level", 2, 0, 0, { "loglevel", "level", 2, 0, 0,
ARG_MAGIC, ARG_MAGIC,
&config_loglevel, &config_loglevel,
...@@ -859,6 +871,8 @@ static ConfigOCs lloadocs[] = { ...@@ -859,6 +871,8 @@ static ConfigOCs lloadocs[] = {
}; };
#endif /* BALANCER_MODULE */ #endif /* BALANCER_MODULE */
static int config_syslog;
static int static int
config_generic( ConfigArgs *c ) config_generic( ConfigArgs *c )
{ {
...@@ -1026,10 +1040,57 @@ config_generic( ConfigArgs *c ) ...@@ -1026,10 +1040,57 @@ config_generic( ConfigArgs *c )
} break; } break;
case CFG_LOGFILE: { case CFG_LOGFILE: {
if ( logfileName ) ch_free( logfileName ); int rc = logfile_open( c->value_string );
logfileName = c->value_string; ch_free( c->value_string );
logfile = fopen( logfileName, "w" ); return rc;
if ( logfile ) lutil_debug_file( logfile ); } break;
case CFG_LOGFILE_ONLY:
slap_debug = slap_debug_orig;
if ( c->value_int ) {
slap_debug |= config_syslog;
ldap_syslog = 0;
} else {
ldap_syslog = config_syslog;
}
logfile_only = c->value_int;
break;
case CFG_LOGFILE_ROTATE: {
unsigned lf_max, lf_mbyte, lf_hour;
if ( lutil_atoux( &lf_max, c->argv[1], 0 ) != 0 ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"invalid max value \"%s\"",
c->argv[0], c->argv[1] );
goto fail;
}
if ( !lf_max || lf_max > 99 ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"invalid max value \"%s\" must be 1-99",
c->argv[0], c->argv[1] );
goto fail;
}
if ( lutil_atoux( &lf_mbyte, c->argv[2], 0 ) != 0 ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"invalid Mbyte value \"%s\"",
c->argv[0], c->argv[2] );
goto fail;
}
if ( lutil_atoux( &lf_hour, c->argv[3], 0 ) != 0 ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"invalid hours value \"%s\"",
c->argv[0], c->argv[3] );
goto fail;
}
if ( !lf_mbyte && !lf_hour ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"Mbyte and hours cannot both be zero",
c->argv[0] );
goto fail;
}
logfile_max = lf_max;
logfile_fslimit = lf_mbyte * 1048576; /* Megabytes to bytes */
logfile_age = lf_hour * 3600; /* hours to seconds */
} break; } break;
case CFG_RESCOUNT: case CFG_RESCOUNT:
...@@ -2062,15 +2123,9 @@ loglevel_print( FILE *out ) ...@@ -2062,15 +2123,9 @@ loglevel_print( FILE *out )
loglevel_ops[i].word.bv_val, mask, mask ); loglevel_ops[i].word.bv_val, mask, mask );
} }
fprintf( out,
"\nNOTE: custom log subsystems may be later installed "
"by specific code\n\n" );
return 0; return 0;
} }
static int config_syslog;
static int static int
config_loglevel( ConfigArgs *c ) config_loglevel( ConfigArgs *c )
{ {
...@@ -2080,24 +2135,6 @@ config_loglevel( ConfigArgs *c ) ...@@ -2080,24 +2135,6 @@ config_loglevel( ConfigArgs *c )
loglevel_init(); loglevel_init();
} }
if ( c->op == SLAP_CONFIG_EMIT ) {
/* Get default or commandline slapd setting */
if ( ldap_syslog && !config_syslog ) config_syslog = ldap_syslog;
return loglevel2bvarray( config_syslog, &c->rvalue_vals );
} else if ( c->op == LDAP_MOD_DELETE ) {
if ( !c->line ) {
config_syslog = 0;
} else {
i = verb_to_mask( c->line, loglevel_ops );
config_syslog &= ~loglevel_ops[i].mask;
}
if ( slapMode & SLAP_SERVER_MODE ) {
ldap_syslog = config_syslog;
}
return 0;
}
for ( i = 1; i < c->argc; i++ ) { for ( i = 1; i < c->argc; i++ ) {
int level; int level;
...@@ -2126,7 +2163,12 @@ config_loglevel( ConfigArgs *c ) ...@@ -2126,7 +2163,12 @@ config_loglevel( ConfigArgs *c )
config_syslog = 0; config_syslog = 0;
} }
if ( slapMode & SLAP_SERVER_MODE ) { if ( slapMode & SLAP_SERVER_MODE ) {
ldap_syslog = config_syslog; if ( logfile_only ) {
slap_debug = slap_debug_orig | config_syslog;
ldap_syslog = 0;
} else {
ldap_syslog = config_syslog;
}
} }
return 0; return 0;
} }
......
...@@ -2448,26 +2448,36 @@ sortval_reject: ...@@ -2448,26 +2448,36 @@ sortval_reject:
if ( lutil_atoux( &lf_max, c->argv[1], 0 ) != 0 ) { if ( lutil_atoux( &lf_max, c->argv[1], 0 ) != 0 ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> " snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"invalid max value \"%s\"", c->argv[0], c->argv[1] ); "invalid max value \"%s\"", c->argv[0], c->argv[1] );
Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
c->log, c->cr_msg );
return 1; return 1;
} }
if ( !lf_max || lf_max > 99 ) { if ( !lf_max || lf_max > 99 ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> " snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"invalid max value \"%s\" must be 1-99", c->argv[0], c->argv[1] ); "invalid max value \"%s\" must be 1-99", c->argv[0], c->argv[1] );
Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
c->log, c->cr_msg );
return 1; return 1;
} }
if ( lutil_atoux( &lf_mbyte, c->argv[2], 0 ) != 0 ) { if ( lutil_atoux( &lf_mbyte, c->argv[2], 0 ) != 0 ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> " snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"invalid Mbyte value \"%s\"", c->argv[0], c->argv[1] ); "invalid Mbyte value \"%s\"", c->argv[0], c->argv[2] );
Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
c->log, c->cr_msg );
return 1; return 1;
} }
if ( lutil_atoux( &lf_hour, c->argv[3], 0 ) != 0 ) { if ( lutil_atoux( &lf_hour, c->argv[3], 0 ) != 0 ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> " snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"invalid hours value \"%s\"", c->argv[0], c->argv[2] ); "invalid hours value \"%s\"", c->argv[0], c->argv[3] );
Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
c->log, c->cr_msg );
return 1; return 1;
} }
if ( !lf_mbyte && !lf_hour ) { if ( !lf_mbyte && !lf_hour ) {
snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> " snprintf( c->cr_msg, sizeof( c->cr_msg ), "<%s> "
"Mbyte and hours cannot both be zero", c->argv[0] ); "Mbyte and hours cannot both be zero", c->argv[0] );
Debug( LDAP_DEBUG_ANY, "%s: %s.\n",
c->log, c->cr_msg );
return 1; return 1;
} }
logfile_max = lf_max; logfile_max = lf_max;
......