SLAPD_MONITOR_LOG_NAME,
BER_BVNULL, BER_BVNULL, BER_BVNULL,
{ BER_BVC( "This subsystem contains information about logging." ),
- BER_BVC( "Set the attribute \"managedInfo\" to the desired log levels." ),
+ BER_BVC( "Set the \"monitorLogLevel\" or \"monitorDebugLevel\" attributes to the desired levels." ),
BER_BVNULL },
MONITOR_F_NONE,
monitor_subsys_log_init,
"NO-USER-MODIFICATION "
"USAGE dSAOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorConnectionOpsAsync) },
+ { "( 1.3.6.1.4.1.4203.666.1.55.32 "
+ "NAME 'monitorLogLevel' "
+ "DESC 'current slapd log level' "
+ "EQUALITY caseIgnoreMatch "
+ "SUBSTR caseIgnoreSubstringsMatch "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
+ "USAGE dSAOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
+ offsetof(monitor_info_t, mi_ad_monitorLogLevel) },
+ { "( 1.3.6.1.4.1.4203.666.1.55.33 "
+ "NAME 'monitorDebugLevel' "
+ "DESC 'current slapd debug level' "
+ "EQUALITY caseIgnoreMatch "
+ "SUBSTR caseIgnoreSubstringsMatch "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 "
+ "USAGE dSAOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
+ offsetof(monitor_info_t, mi_ad_monitorDebugLevel) },
{ NULL, 0, -1 }
};
BackendDB *be,
monitor_subsys_t *ms )
{
- ms->mss_open = monitor_subsys_log_open;
- ms->mss_modify = monitor_subsys_log_modify;
-
ldap_pvt_thread_mutex_init( &monitor_log_mutex );
+ ms->mss_modify = monitor_subsys_log_modify;
- return( 0 );
+ return monitor_subsys_log_open( be, ms );
}
/*
monitor_subsys_t *ms )
{
BerVarray bva = NULL;
+ monitor_info_t *mi = ( monitor_info_t * )be->be_private;
+ Entry *e = NULL;
- if ( loglevel2bvarray( slap_syslog_get(), &bva ) == 0 && bva != NULL ) {
- monitor_info_t *mi;
- Entry *e;
+ if ( loglevel2bvarray( slap_debug_get(), &bva ) == 0 && bva != NULL ) {
+ if ( monitor_cache_get( mi, &ms->mss_ndn, &e ) ) {
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_subsys_log_init: "
+ "unable to get entry \"%s\"\n",
+ ms->mss_ndn.bv_val );
+ ber_bvarray_free( bva );
+ return( -1 );
+ }
- mi = ( monitor_info_t * )be->be_private;
+ attr_merge_normalize( e, mi->mi_ad_monitorDebugLevel, bva, NULL );
+ ber_bvarray_free( bva );
+ bva = NULL;
+ }
- if ( monitor_cache_get( mi, &ms->mss_ndn, &e ) ) {
+ if ( loglevel2bvarray( slap_syslog_get(), &bva ) == 0 && bva != NULL ) {
+ if ( !e && monitor_cache_get( mi, &ms->mss_ndn, &e ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_log_init: "
"unable to get entry \"%s\"\n",
return( -1 );
}
- attr_merge_normalize( e, mi->mi_ad_managedInfo, bva, NULL );
+ attr_merge_normalize( e, mi->mi_ad_monitorLogLevel, bva, NULL );
ber_bvarray_free( bva );
+ }
+ if ( e )
monitor_cache_release( mi, e );
- }
return( 0 );
}
{
monitor_info_t *mi = ( monitor_info_t * )op->o_bd->be_private;
int rc = LDAP_OTHER;
- int newlevel = slap_syslog_get();
+ int newdebug, newsyslog, *newptr;
Attribute *save_attrs;
Modifications *modlist = op->orm_modlist;
Modifications *ml;
ldap_pvt_thread_mutex_lock( &monitor_log_mutex );
+ newdebug = slap_debug_get();
+ newsyslog = slap_syslog_get();
+
save_attrs = e->e_attrs;
e->e_attrs = attrs_dup( e->e_attrs );
continue;
/*
- * only the "managedInfo" attribute can be modified
+ * only the monitorDebugLevel and monitorLogLevel attributes can be modified
*/
- } else if ( mod->sm_desc != mi->mi_ad_managedInfo ) {
- rc = rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
- break;
+ } else {
+ if ( mod->sm_desc == mi->mi_ad_monitorDebugLevel ) {
+ newptr = &newdebug;
+ } else if ( mod->sm_desc == mi->mi_ad_monitorLogLevel ) {
+ newptr = &newsyslog;
+ } else {
+ rc = rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
+ break;
+ }
}
switch ( mod->sm_op ) {
case LDAP_MOD_ADD:
- rc = add_values( op, e, mod, &newlevel );
+ rc = add_values( op, e, mod, newptr );
break;
case LDAP_MOD_DELETE:
- rc = delete_values( op, e, mod, &newlevel );
+ rc = delete_values( op, e, mod, newptr );
break;
case LDAP_MOD_REPLACE:
- rc = replace_values( op, e, mod, &newlevel );
+ rc = replace_values( op, e, mod, newptr );
break;
default:
/*
* Do we need to protect this with a mutex?
*/
- slap_syslog_set( newlevel );
-
-#if 0 /* debug rather than log */
- slap_debug = newlevel;
- lutil_set_debug_level( "slapd", slap_debug );
- ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &slap_debug);
- ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &slap_debug);
- ldif_debug = slap_debug;
-#endif
+ slap_syslog_set( newsyslog );
+ slap_debug_set( newdebug );
}
cleanup:;