From b7631218d5fa118aae223370e1ddda66d93168e2 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Wed, 7 Sep 2016 11:52:12 -0400
Subject: [PATCH] Ticket48978 - refactor LDAPDebug()

Description: Refectored LDAPDebug function calls to use the new
             severity level.

https://fedorahosted.org/389/ticket/48978

Reviewed by: ?
---
 ldap/servers/plugins/acl/aclutil.c                 |   4 +-
 ldap/servers/plugins/bitwise/bitwise.c             |   8 +-
 ldap/servers/plugins/collation/collate.c           |  18 +-
 ldap/servers/plugins/collation/config.c            |  10 +-
 ldap/servers/plugins/collation/orfilter.c          |  32 +-
 ldap/servers/plugins/cos/cos.c                     |  20 +-
 ldap/servers/plugins/cos/cos_cache.c               | 220 ++++++------
 ldap/servers/plugins/http/http_client.c            |  36 +-
 ldap/servers/plugins/http/http_impl.c              |  50 +--
 ldap/servers/plugins/presence/presence.c           | 114 +++---
 .../plugins/replication/windows_connection.c       | 154 ++++-----
 ldap/servers/plugins/replication/windows_private.c |   2 +-
 .../plugins/replication/windows_protocol_util.c    |  58 ++--
 ldap/servers/plugins/retrocl/retrocl_trim.c        |   4 +-
 ldap/servers/plugins/syntaxes/bin.c                |  16 +-
 ldap/servers/plugins/syntaxes/bitstring.c          |   4 +-
 ldap/servers/plugins/syntaxes/ces.c                |   8 +-
 ldap/servers/plugins/syntaxes/cis.c                |  28 +-
 ldap/servers/plugins/syntaxes/deliverymethod.c     |   4 +-
 ldap/servers/plugins/syntaxes/dn.c                 |   4 +-
 ldap/servers/plugins/syntaxes/facsimile.c          |   4 +-
 ldap/servers/plugins/syntaxes/guide.c              |   8 +-
 ldap/servers/plugins/syntaxes/int.c                |   4 +-
 ldap/servers/plugins/syntaxes/nameoptuid.c         |   4 +-
 ldap/servers/plugins/syntaxes/numericstring.c      |   4 +-
 ldap/servers/plugins/syntaxes/sicis.c              |   4 +-
 ldap/servers/plugins/syntaxes/string.c             |  18 +-
 ldap/servers/plugins/syntaxes/tel.c                |   4 +-
 ldap/servers/plugins/syntaxes/teletex.c            |   4 +-
 ldap/servers/plugins/syntaxes/telex.c              |   4 +-
 ldap/servers/plugins/syntaxes/value.c              |   2 +-
 ldap/servers/slapd/abandon.c                       |  10 +-
 ldap/servers/slapd/add.c                           |  24 +-
 ldap/servers/slapd/attrsyntax.c                    |  12 +-
 ldap/servers/slapd/auth.c                          |  22 +-
 ldap/servers/slapd/ava.c                           |   2 +-
 ldap/servers/slapd/back-ldbm/ancestorid.c          |  24 +-
 ldap/servers/slapd/back-ldbm/archive.c             |  32 +-
 ldap/servers/slapd/back-ldbm/cache.c               |  18 +-
 ldap/servers/slapd/back-ldbm/cleanup.c             |   6 +-
 ldap/servers/slapd/back-ldbm/close.c               |  10 +-
 ldap/servers/slapd/back-ldbm/dbhelp.c              |  66 ++--
 ldap/servers/slapd/back-ldbm/dblayer.c             | 382 ++++++++++-----------
 ldap/servers/slapd/back-ldbm/dbversion.c           |   6 +-
 ldap/servers/slapd/back-ldbm/dn2entry.c            |  12 +-
 ldap/servers/slapd/back-ldbm/filterindex.c         |  90 ++---
 ldap/servers/slapd/back-ldbm/findentry.c           |  24 +-
 ldap/servers/slapd/back-ldbm/id2entry.c            |  16 +-
 ldap/servers/slapd/back-ldbm/idl.c                 |  98 +++---
 ldap/servers/slapd/back-ldbm/idl_new.c             |  30 +-
 ldap/servers/slapd/back-ldbm/import-threads.c      |  62 ++--
 ldap/servers/slapd/back-ldbm/import.c              |  18 +-
 ldap/servers/slapd/back-ldbm/index.c               |  72 ++--
 ldap/servers/slapd/back-ldbm/init.c                |  20 +-
 ldap/servers/slapd/back-ldbm/instance.c            |  18 +-
 ldap/servers/slapd/back-ldbm/ldbm_add.c            |  48 +--
 ldap/servers/slapd/back-ldbm/ldbm_attr.c           |  16 +-
 ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c      |  98 +++---
 .../slapd/back-ldbm/ldbm_attrcrypt_config.c        |   8 +-
 ldap/servers/slapd/back-ldbm/ldbm_config.c         |  50 +--
 ldap/servers/slapd/back-ldbm/ldbm_delete.c         |  66 ++--
 ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c       |   2 +-
 ldap/servers/slapd/back-ldbm/ldbm_index_config.c   |  26 +-
 .../servers/slapd/back-ldbm/ldbm_instance_config.c |  34 +-
 ldap/servers/slapd/back-ldbm/ldbm_modify.c         |  18 +-
 ldap/servers/slapd/back-ldbm/ldbm_modrdn.c         |  52 +--
 ldap/servers/slapd/back-ldbm/ldbm_search.c         |  26 +-
 ldap/servers/slapd/back-ldbm/ldif2ldbm.c           | 122 +++----
 ldap/servers/slapd/back-ldbm/misc.c                |  12 +-
 ldap/servers/slapd/back-ldbm/nextid.c              |  10 +-
 ldap/servers/slapd/back-ldbm/parents.c             |   2 +-
 ldap/servers/slapd/back-ldbm/rmdb.c                |   4 +-
 ldap/servers/slapd/back-ldbm/seq.c                 |  10 +-
 ldap/servers/slapd/back-ldbm/sort.c                |  10 +-
 ldap/servers/slapd/back-ldbm/start.c               |  58 ++--
 ldap/servers/slapd/back-ldbm/uniqueid2entry.c      |   4 +-
 ldap/servers/slapd/back-ldbm/upgrade.c             |  18 +-
 ldap/servers/slapd/back-ldbm/vlv.c                 | 102 +++---
 ldap/servers/slapd/back-ldbm/vlv_srch.c            |   2 +-
 ldap/servers/slapd/back-ldif/add.c                 |  14 +-
 ldap/servers/slapd/back-ldif/bind.c                |   4 +-
 ldap/servers/slapd/back-ldif/close.c               |   8 +-
 ldap/servers/slapd/back-ldif/compare.c             |   4 +-
 ldap/servers/slapd/back-ldif/config.c              |  18 +-
 ldap/servers/slapd/back-ldif/delete.c              |  10 +-
 ldap/servers/slapd/back-ldif/init.c                |  10 +-
 ldap/servers/slapd/back-ldif/modify.c              |  18 +-
 ldap/servers/slapd/back-ldif/modrdn.c              |  14 +-
 ldap/servers/slapd/back-ldif/search.c              |   4 +-
 ldap/servers/slapd/backend_manager.c               |   4 +-
 ldap/servers/slapd/bind.c                          |  16 +-
 ldap/servers/slapd/compare.c                       |   6 +-
 ldap/servers/slapd/config.c                        |  52 +--
 ldap/servers/slapd/connection.c                    |  64 ++--
 ldap/servers/slapd/conntable.c                     |   6 +-
 ldap/servers/slapd/control.c                       |  24 +-
 ldap/servers/slapd/counters.c                      |   4 +-
 ldap/servers/slapd/daemon.c                        | 140 ++++----
 ldap/servers/slapd/defbackend.c                    |  14 +-
 ldap/servers/slapd/delete.c                        |   4 +-
 ldap/servers/slapd/detach.c                        |  14 +-
 ldap/servers/slapd/dn.c                            |  20 +-
 ldap/servers/slapd/dse.c                           |   2 +-
 ldap/servers/slapd/dynalib.c                       |   6 +-
 ldap/servers/slapd/entry.c                         |  94 ++---
 ldap/servers/slapd/entrywsi.c                      |  22 +-
 ldap/servers/slapd/errormap.c                      |   4 +-
 ldap/servers/slapd/extendop.c                      |  26 +-
 ldap/servers/slapd/factory.c                       |  16 +-
 ldap/servers/slapd/filter.c                        |  68 ++--
 ldap/servers/slapd/filtercmp.c                     |  10 +-
 ldap/servers/slapd/filterentry.c                   |  80 ++---
 ldap/servers/slapd/init.c                          |   4 +-
 ldap/servers/slapd/libglobs.c                      |  10 +-
 ldap/servers/slapd/localhost.c                     |  18 +-
 ldap/servers/slapd/lock.c                          |   4 +-
 ldap/servers/slapd/log.c                           |  42 +--
 ldap/servers/slapd/main.c                          | 146 ++++----
 ldap/servers/slapd/mapping_tree.c                  |  76 ++--
 ldap/servers/slapd/modify.c                        |  12 +-
 ldap/servers/slapd/modrdn.c                        |  16 +-
 ldap/servers/slapd/modutil.c                       |  14 +-
 ldap/servers/slapd/operation.c                     |   8 +-
 ldap/servers/slapd/opshared.c                      |   6 +-
 ldap/servers/slapd/passwd_extop.c                  |  36 +-
 ldap/servers/slapd/pblock.c                        |  40 +--
 ldap/servers/slapd/plugin.c                        |  84 ++---
 ldap/servers/slapd/plugin_acl.c                    |   2 +-
 ldap/servers/slapd/plugin_mr.c                     |  10 +-
 ldap/servers/slapd/plugin_syntax.c                 |  58 ++--
 ldap/servers/slapd/poll_using_select.c             |  12 +-
 ldap/servers/slapd/protect_db.c                    |  30 +-
 ldap/servers/slapd/psearch.c                       |  16 +-
 ldap/servers/slapd/pw.c                            |  14 +-
 ldap/servers/slapd/referral.c                      |   4 +-
 ldap/servers/slapd/result.c                        |  70 ++--
 ldap/servers/slapd/sasl_io.c                       |  26 +-
 ldap/servers/slapd/sasl_map.c                      |  52 +--
 ldap/servers/slapd/saslbind.c                      |  76 ++--
 ldap/servers/slapd/schema.c                        |  52 +--
 ldap/servers/slapd/schemaparse.c                   |   4 +-
 ldap/servers/slapd/search.c                        |   2 +-
 ldap/servers/slapd/snmp_collator.c                 |   6 +-
 ldap/servers/slapd/ssl.c                           |  14 +-
 ldap/servers/slapd/str2filter.c                    |   8 +-
 ldap/servers/slapd/stubs.c                         |   2 +-
 ldap/servers/slapd/task.c                          | 116 +++----
 ldap/servers/slapd/tools/mmldif.c                  |  48 +--
 ldap/servers/slapd/unbind.c                        |   2 +-
 ldap/servers/slapd/util.c                          |  36 +-
 ldap/servers/slapd/value.c                         |   2 +-
 ldap/servers/slapd/valueset.c                      |   4 +-
 ldap/servers/slapd/vattr.c                         |  22 +-
 153 files changed, 2365 insertions(+), 2365 deletions(-)

diff --git a/ldap/servers/plugins/acl/aclutil.c b/ldap/servers/plugins/acl/aclutil.c
index 5915e88..047f532 100644
--- a/ldap/servers/plugins/acl/aclutil.c
+++ b/ldap/servers/plugins/acl/aclutil.c
@@ -765,7 +765,7 @@ acl_match_macro_in_target( const char *ndn, char * match_this,
 	/* we know it's got a $(dn) */
 	tmp_ptr = PL_strcasestr(macro_prefix, ACL_TARGET_MACRO_DN_KEY);	
 	if (!tmp_ptr) {
-		LDAPDebug(LDAP_DEBUG_ACL,"acl_match_macro_in_target: "
+		LDAPDebug(LDAP_DEBUG_ACL, LOG_DEBUG,"acl_match_macro_in_target: "
 				"Target macro DN key \"%s\" not found in \"%s\".\n",
 				ACL_TARGET_MACRO_DN_KEY, macro_prefix, 0);
 		slapi_ch_free_string(&macro_prefix);
@@ -1463,7 +1463,7 @@ acl_ht_display_entry(PLHashEntry *he, PRIntn i, void *arg)
 	PLHashNumber aci_index = (PLHashNumber)he->key;
     char *matched_val = (char *)he->value;
 	
-	LDAPDebug(LDAP_DEBUG_ACL,"macro ht entry: key='%d' matched_val='%s'"
+	LDAPDebug(LDAP_DEBUG_ACL, LOG_DEBUG,"macro ht entry: key='%d' matched_val='%s'"
 								"keyhash='%d'\n", 
 				aci_index, (matched_val ? matched_val: "NULL"),
 				(PLHashNumber)he->keyHash);
diff --git a/ldap/servers/plugins/bitwise/bitwise.c b/ldap/servers/plugins/bitwise/bitwise.c
index 377981e..2a3ff8f 100644
--- a/ldap/servers/plugins/bitwise/bitwise.c
+++ b/ldap/servers/plugins/bitwise/bitwise.c
@@ -163,7 +163,7 @@ bitwise_filter_create (Slapi_PBlock* pb)
 	} else if (strcmp(mrOID, "1.2.840.113556.1.4.804") == 0) {
 	    slapi_pblock_set (pb, SLAPI_PLUGIN_MR_FILTER_MATCH_FN, (void*)bitwise_filter_match_or);
 	} else { /* this oid not handled by this plugin */
-	    LDAPDebug (LDAP_DEBUG_FILTER, "=> bitwise_filter_create OID (%s) not handled\n", mrOID, 0, 0);
+	    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> bitwise_filter_create OID (%s) not handled\n", mrOID, 0, 0);
 	    return rc;
 	}
 	bmc = new_bitwise_match_cb(mrTYPE, mrVALUE);
@@ -171,9 +171,9 @@ bitwise_filter_create (Slapi_PBlock* pb)
 	slapi_pblock_set (pb, SLAPI_PLUGIN_DESTROY_FN, (void*)bitwise_filter_destroy);
 	rc = LDAP_SUCCESS;
     } else {
-	LDAPDebug (LDAP_DEBUG_FILTER, "=> bitwise_filter_create missing parameter(s)\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> bitwise_filter_create missing parameter(s)\n", 0, 0, 0);
     }
-    LDAPDebug (LDAP_DEBUG_FILTER, "<= bitwise_filter_create %i\n", rc, 0, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= bitwise_filter_create %i\n", rc, 0, 0);
     return LDAP_SUCCESS;
 }
 
@@ -189,6 +189,6 @@ bitwise_init (Slapi_PBlock* pb)
     if ( rc == 0 ) {
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&pdesc );
     }
-    LDAPDebug (LDAP_DEBUG_FILTER, "bitwise_init %i\n", rc, 0, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "bitwise_init %i\n", rc, 0, 0);
     return rc;
 }
diff --git a/ldap/servers/plugins/collation/collate.c b/ldap/servers/plugins/collation/collate.c
index 483a132..6edf427 100644
--- a/ldap/servers/plugins/collation/collate.c
+++ b/ldap/servers/plugins/collation/collate.c
@@ -60,7 +60,7 @@ collation_config (size_t cargc, char** cargv,
 	/* ignore - not needed anymore with ICU - was used to get path for NLS_Initialize */
     } else if (!strcasecmp (cargv[0], "collation")) {
 	if ( cargc < 7 ) {
-	    LDAPDebug (LDAP_DEBUG_ANY,
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		       "%s: line %lu ignored: only %lu arguments (expected "
 		       "collation language country variant strength decomposition oid ...)\n",
 		       fname, (unsigned long)lineno, (unsigned long)cargc );
@@ -76,7 +76,7 @@ collation_config (size_t cargc, char** cargv,
 	      case 3: profile->strength = UCOL_TERTIARY; break;
 	      case 4: profile->strength = UCOL_IDENTICAL; break;
 	      default: profile->strength = UCOL_SECONDARY;
- 		LDAPDebug (LDAP_DEBUG_ANY,
+ 		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			   "%s: line %lu: strength \"%s\" not supported (will use 2)\n",
 			   fname, (unsigned long)lineno, cargv[4]);
 		break;
@@ -86,7 +86,7 @@ collation_config (size_t cargc, char** cargv,
 	      case 2: profile->decomposition = UCOL_DEFAULT; /* no break here? fall through? wtf? */
 	      case 3: profile->decomposition = UCOL_ON; break;
 	      default: profile->decomposition = UCOL_DEFAULT;
-		LDAPDebug (LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			   "%s: line %lu: decomposition \"%s\" not supported (will use 2)\n",
 			   fname, (unsigned long)lineno, cargv[5]);
 		break;
@@ -326,7 +326,7 @@ collation_index (indexer_t* ix, struct berval** bvec, struct berval** prefixes)
 		    }
 		    memcpy(bk->bv_val + prefixLen, key, realLen);
 		    bk->bv_val[bk->bv_len] = '\0';
-		    LDAPDebug (LDAP_DEBUG_FILTER, "collation_index(%.*s) %lu bytes\n",
+		    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "collation_index(%.*s) %lu bytes\n",
 			       bk->bv_len, bk->bv_val, (unsigned long)bk->bv_len);
 		    keys = (struct berval**)
 			slapi_ch_realloc ((void*)keys, sizeof(struct berval*) * (keyn + 2));
@@ -425,13 +425,13 @@ collation_indexer_create (const char* oid)
 		    ix = (indexer_t*) slapi_ch_calloc (1, sizeof (indexer_t));
 		    ucol_setAttribute (coll, UCOL_STRENGTH, profile->strength, &err);
 		    if (U_FAILURE(err)) {
-		    	LDAPDebug (LDAP_DEBUG_ANY, "collation_indexer_create: could not "
+		    	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "collation_indexer_create: could not "
 				   "set the collator strength for oid %s to %d: err %d\n",
 				   oid, profile->strength, err);
 		    }
 		    ucol_setAttribute (coll, UCOL_DECOMPOSITION_MODE, profile->decomposition, &err);
 		    if (U_FAILURE(err)) {
-		    	LDAPDebug (LDAP_DEBUG_ANY, "collation_indexer_create: could not "
+		    	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "collation_indexer_create: could not "
 				   "set the collator decomposition mode for oid %s to %d: err %d\n",
 				   oid, profile->decomposition, err);
 		    }
@@ -442,7 +442,7 @@ collation_indexer_create (const char* oid)
 		    	}
 		    }
             if (!*id) {
-                LDAPDebug (LDAP_DEBUG_ANY, "collation_indexer_create: id not found\n", 0, 0, 0);
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "collation_indexer_create: id not found\n", 0, 0, 0);
                 goto error;
             }
 
@@ -454,12 +454,12 @@ collation_indexer_create (const char* oid)
 		    /* free (etc); */
 		    /* free (ix); */
 		} else if (err == U_USING_DEFAULT_WARNING) {
-		    LDAPDebug (LDAP_DEBUG_FILTER, "collation_indexer_create: could not "
+		    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "collation_indexer_create: could not "
 			       "create an indexer for OID %s for locale %s and could not "
 			       "use default locale\n",
 			       oid, (locale ? locale : "(default)"), NULL);
 		} else { /* error */
-		    LDAPDebug (LDAP_DEBUG_FILTER, "collation_indexer_create: could not "
+		    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "collation_indexer_create: could not "
 			       "create an indexer for OID %s for locale %s: err = %d\n",
 			       oid, (locale ? locale : "(default)"), err);
 		}
diff --git a/ldap/servers/plugins/collation/config.c b/ldap/servers/plugins/collation/config.c
index a317a0c..42aa1fd 100644
--- a/ldap/servers/plugins/collation/config.c
+++ b/ldap/servers/plugins/collation/config.c
@@ -83,7 +83,7 @@ fp_parse_line(
 	for ( token = strtok_quote( line, " \t" ); token != NULL;
 	    token = strtok_quote( NULL, " \t" ) ) {
 		if ( *argcp == MAXARGS ) {
-			LDAPDebug( LDAP_DEBUG_ANY, "Too many tokens (max %d)\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Too many tokens (max %d)\n",
 			    MAXARGS, 0, 0 );
 			exit( 1 );
 		}
@@ -156,13 +156,13 @@ collation_read_config( char *fname )
 
     fp = fopen( fname, "r" );
     if ( fp == NULL ) {
-	LDAPDebug( LDAP_DEBUG_ANY,
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		  "could not open config file \"%s\" - absolute path?\n",
 		  fname, 0, 0 );
 	return; /* Do not exit */
     }
 
-    LDAPDebug( LDAP_DEBUG_CONFIG, "reading config file %s\n", fname, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "reading config file %s\n", fname, 0, 0 );
 
     fp_getline_init( &lineno );
     while ( (line = fp_getline( fp, &lineno )) != NULL ) {
@@ -170,10 +170,10 @@ collation_read_config( char *fname )
 	if ( line[0] == '#' || line[0] == '\0' ) {
 	    continue;
 	}
-	LDAPDebug( LDAP_DEBUG_CONFIG, "line %d: %s\n", lineno, line, 0 );
+	LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "line %d: %s\n", lineno, line, 0 );
 	fp_parse_line( line, &cargc, cargv );
 	if ( cargc < 1 ) {
-	    LDAPDebug( LDAP_DEBUG_ANY,
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		      "%s: line %d: bad config line (ignored)\n",
 		      fname, lineno, 0 );
 	    continue;
diff --git a/ldap/servers/plugins/collation/orfilter.c b/ldap/servers/plugins/collation/orfilter.c
index a6d374d..4a22ee3 100644
--- a/ldap/servers/plugins/collation/orfilter.c
+++ b/ldap/servers/plugins/collation/orfilter.c
@@ -64,7 +64,7 @@ static int
 or_filter_destroy (Slapi_PBlock* pb)
 {
     auto or_filter_t* or = or_filter_get (pb);
-    LDAPDebug (LDAP_DEBUG_FILTER, "or_filter_destroy(%p)\n", (void*)or, 0, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "or_filter_destroy(%p)\n", (void*)or, 0, 0);
     if (or != NULL) {
     slapi_ch_free((void**)&or->or_type);
     slapi_ch_free((void**)&or->or_oid);
@@ -473,7 +473,7 @@ or_filter_create (Slapi_PBlock* pb)
 	auto struct berval bv;
 	auto int reusable = MRF_ANY_TYPE;
 
-	LDAPDebug (LDAP_DEBUG_FILTER, "=> or_filter_create(oid %s; type %s)\n",
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> or_filter_create(oid %s; type %s)\n",
 		   mrOID, mrTYPE, 0);
 	if (len > 1 && (ix = indexer_create (mrOID)) != NULL) {
 	    auto char* val = mrVALUE->bv_val;
@@ -535,7 +535,7 @@ or_filter_create (Slapi_PBlock* pb)
 	    {
 		auto struct berval** val = or->or_values;
 		if (val) for (; *val; ++val) {
-		    LDAPDebug (LDAP_DEBUG_FILTER, "value \"%s\"\n", (*val)->bv_val, 0, 0);
+		    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "value \"%s\"\n", (*val)->bv_val, 0, 0);
 		}
 	    }
 	    if (or->or_op == SLAPI_OP_SUBSTRING) {
@@ -553,9 +553,9 @@ or_filter_create (Slapi_PBlock* pb)
 	    rc = LDAP_SUCCESS;
 	}
     } else {
-	LDAPDebug (LDAP_DEBUG_FILTER, "=> or_filter_create missing parameter(s)\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> or_filter_create missing parameter(s)\n", 0, 0, 0);
     }
-    LDAPDebug (LDAP_DEBUG_FILTER, "<= or_filter_create(%p) %i\n", (void*)or, rc, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= or_filter_create(%p) %i\n", (void*)or, rc, 0);
     return rc;
 }
 
@@ -573,7 +573,7 @@ static int
 op_indexer_destroy (Slapi_PBlock* pb)
 {
     auto indexer_t* ix = op_indexer_get (pb);
-    LDAPDebug (LDAP_DEBUG_FILTER, "op_indexer_destroy(%p)\n", (void*)ix, 0, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "op_indexer_destroy(%p)\n", (void*)ix, 0, 0);
     if (ix != NULL) {
         indexer_free (ix);
         /* The keys were freed, but we need to reset the pblock pointer */
@@ -596,7 +596,7 @@ op_index_entry (Slapi_PBlock* pb)
     } else {
 	rc = LDAP_OPERATIONS_ERROR;
     }
-    LDAPDebug (LDAP_DEBUG_FILTER, "op_index_entry(%p) %i\n", (void*)ix, rc, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "op_index_entry(%p) %i\n", (void*)ix, rc, 0);
     return rc;
 }
 
@@ -618,7 +618,7 @@ op_index_search (Slapi_PBlock* pb)
 	    rc = slapi_pblock_set (pb, SLAPI_PLUGIN_MR_KEYS, or->or_index_keys);
 	}
     }
-    LDAPDebug (LDAP_DEBUG_FILTER, "op_index_search(%p) %i\n", (void*)or, rc, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "op_index_search(%p) %i\n", (void*)or, rc, 0);
     return rc;
 }
 
@@ -652,7 +652,7 @@ static void
 ss_indexer_destroy (Slapi_PBlock* pb)
 {
     auto ss_indexer_t* ss = ss_indexer_get (pb);
-    LDAPDebug (LDAP_DEBUG_FILTER, "ss_indexer_destroy(%p)\n", (void*)ss, 0, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "ss_indexer_destroy(%p)\n", (void*)ss, 0, 0);
     if (ss) {
         ss_indexer_free(ss);
         /* The keys were freed, but we need to reset the pblock pointer */
@@ -743,7 +743,7 @@ ss_index_entry (Slapi_PBlock* pb)
 	    slapi_ch_free((void**)&prefixes);
 	}
     }
-    LDAPDebug (LDAP_DEBUG_FILTER, "ss_index_entry(%p) %i %lu substrings\n",
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "ss_index_entry(%p) %i %lu substrings\n",
 	       (void*)ss, rc, (unsigned long)substringsLen);
     return rc;
 }
@@ -809,7 +809,7 @@ ss_index_search (Slapi_PBlock* pb)
 	    rc = slapi_pblock_set (pb, SLAPI_PLUGIN_MR_KEYS, or->or_index_keys);
 	}
     }
-    LDAPDebug (LDAP_DEBUG_FILTER, "ss_index_search(%p) %i\n", (void*)or, rc, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "ss_index_search(%p) %i\n", (void*)or, rc, 0);
     return rc;
 }
 
@@ -884,7 +884,7 @@ or_filter_index (Slapi_PBlock* pb)
 	!(rc = slapi_pblock_set (pb, SLAPI_PLUGIN_MR_OID, mrOID))) {
 	rc = slapi_pblock_set (pb, SLAPI_PLUGIN_MR_QUERY_OPERATOR, &mrQUERY_OPERATOR);
     }
-    LDAPDebug (LDAP_DEBUG_FILTER, "or_filter_index(%p) %i\n",
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "or_filter_index(%p) %i\n",
 	       (void*)(or ? or->or_indexer : NULL), rc, 0);
     return rc;
 }
@@ -896,12 +896,12 @@ or_indexer_create (Slapi_PBlock* pb)
     auto char* mrOID = NULL;
     auto void* mrOBJECT = NULL;
     if (slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &mrOID) || mrOID == NULL) {
-	LDAPDebug (LDAP_DEBUG_FILTER, "=> or_indexer_create: no OID parameter\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> or_indexer_create: no OID parameter\n", 0, 0, 0);
     } else {
 	auto indexer_t* ix = indexer_create (mrOID);
 	auto char* mrTYPE = NULL;
 	slapi_pblock_get (pb, SLAPI_PLUGIN_MR_TYPE, &mrTYPE);
-	LDAPDebug (LDAP_DEBUG_FILTER, "=> or_indexer_create(oid %s; type %s)\n",
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> or_indexer_create(oid %s; type %s)\n",
 		   mrOID, mrTYPE ? mrTYPE : "<NULL>", 0);
 	if (ix != NULL) {
 	    if (ix->ix_index != NULL &&
@@ -944,7 +944,7 @@ or_indexer_create (Slapi_PBlock* pb)
 	    }
 	}
     }
-    LDAPDebug (LDAP_DEBUG_FILTER, "<= or_indexer_create(%p) %i\n", mrOBJECT, rc, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= or_indexer_create(%p) %i\n", mrOBJECT, rc, 0);
     return rc;
 }
 
@@ -995,6 +995,6 @@ orderingRule_init (Slapi_PBlock* pb)
     if ( rc == 0 ) {
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&pdesc );
     }
-    LDAPDebug (LDAP_DEBUG_FILTER, "orderingRule_init %i\n", rc, 0, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "orderingRule_init %i\n", rc, 0, 0);
     return rc;
 }
diff --git a/ldap/servers/plugins/cos/cos.c b/ldap/servers/plugins/cos/cos.c
index 75ef2ba..4a1de56 100644
--- a/ldap/servers/plugins/cos/cos.c
+++ b/ldap/servers/plugins/cos/cos.c
@@ -143,7 +143,7 @@ int cos_init( Slapi_PBlock *pb )
 	int ret = 0;
 	void * plugin_identity=NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_init\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_init\n",0,0,0);
 
 	/*
 	** Store the plugin identity for later use.
@@ -178,7 +178,7 @@ int cos_init( Slapi_PBlock *pb )
 	                      plugin_identity);
 
 bailout:
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_init\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_init\n",0,0,0);
 	return ret;
 }
 
@@ -193,22 +193,22 @@ int cos_start( Slapi_PBlock *pb )
 {
 	int ret = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_start\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_start\n",0,0,0);
 
 	if( !cos_cache_init() )
 	{
-		LDAPDebug( LDAP_DEBUG_PLUGIN, "cos: ready for service\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos: ready for service\n",0,0,0);
 	}
 	else
 	{
 
 		/* problems we are hosed */
 		cos_cache_stop();
-		LDAPDebug( LDAP_DEBUG_ANY, "cos_start: failed to initialise\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_start: failed to initialise\n",0,0,0);
 		ret = -1;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_start\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_start\n",0,0,0);
 	return ret;
 }
 
@@ -219,11 +219,11 @@ int cos_start( Slapi_PBlock *pb )
 */
 int cos_close( Slapi_PBlock *pb )
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_close\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_close\n",0,0,0);
 
 	cos_cache_stop();
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_close\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_close\n",0,0,0);
 
 	return 0;
 }
@@ -260,11 +260,11 @@ int cos_compute(computed_attr_context *c,char* type,Slapi_Entry *e,slapi_compute
 */
 int cos_post_op( Slapi_PBlock *pb )
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_post_op\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_post_op\n",0,0,0);
 
 	cos_cache_change_notify(pb);
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_post_op\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_post_op\n",0,0,0);
 
 	return SLAPI_PLUGIN_SUCCESS; /* always succeed */
 }
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
index e6889d8..45439b9 100644
--- a/ldap/servers/plugins/cos/cos_cache.c
+++ b/ldap/servers/plugins/cos/cos_cache.c
@@ -288,7 +288,7 @@ int cos_cache_init(void)
 {
 	int ret = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_init\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_init\n",0,0,0);
 
 	slapi_vattrcache_cache_none();
 	cache_lock = slapi_new_mutex();
@@ -357,7 +357,7 @@ int cos_cache_init(void)
 
 
 out:
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_init\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_init\n",0,0,0);
 	return ret;
 }
 
@@ -375,7 +375,7 @@ out:
 */
 static void cos_cache_wait_on_change(void *arg)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_wait_on_change thread\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_wait_on_change thread\n",0,0,0);
 
 	slapi_lock_mutex(stop_lock);
 	slapi_lock_mutex(change_lock);
@@ -428,7 +428,7 @@ static void cos_cache_wait_on_change(void *arg)
 	slapi_unlock_mutex(change_lock);
 	slapi_unlock_mutex(stop_lock);
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_wait_on_change thread exit\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_wait_on_change thread exit\n",0,0,0);
 }
 
 /*
@@ -446,7 +446,7 @@ static int cos_cache_create(void)
 	static int firstTime = 1;
 	int cache_built = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_create\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_create\n",0,0,0);
 
 	pNewCache = (cosCache*)slapi_ch_malloc(sizeof(cosCache));
 	if(pNewCache)
@@ -509,21 +509,21 @@ static int cos_cache_create(void)
 				{
 					/* we should not go on without proper schema checking */
 					cos_cache_release(pNewCache);
-					LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_create: failed to cache the schema\n",0,0,0);			
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_create: failed to cache the schema\n",0,0,0);			
 				}
 			}
 			else
 			{
 				/* currently we cannot go on without the indexes */
 				cos_cache_release(pNewCache);
-				LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_create: failed to index cache\n",0,0,0);			
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_create: failed to index cache\n",0,0,0);			
 			}
 		}
 		else
 		{
 			if(firstTime)
 			{
-				LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_create: cos disabled\n",0,0,0);
+				LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_create: cos disabled\n",0,0,0);
 				firstTime = 0;
 			}
 
@@ -531,7 +531,7 @@ static int cos_cache_create(void)
 		}
 	}
 	else
-		LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_create: memory allocation failure\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_create: memory allocation failure\n",0,0,0);
 
 
 	/* make sure we have a new cache */
@@ -563,7 +563,7 @@ static int cos_cache_create(void)
 		
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_create\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_create\n",0,0,0);
 	return ret;
 }
 
@@ -587,7 +587,7 @@ static int cos_cache_build_definition_list(cosDefinitions **pDefs, int *vattr_ca
 	int cos_def_available = 0;
 	static int firstTime = 1;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_build_definition_list\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_build_definition_list\n",0,0,0);
 
 	/*
 	 * The class of service definitions may be anywhere in the DIT,
@@ -597,7 +597,7 @@ static int cos_cache_build_definition_list(cosDefinitions **pDefs, int *vattr_ca
 	attrs[0] = "namingcontexts";
 	attrs[1] = 0;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "cos: Building class of service cache after status change.\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos: Building class of service cache after status change.\n",0,0,0);
 
 	/*
 	 * XXXrbyrne: this looks really inefficient--should be using
@@ -609,7 +609,7 @@ static int cos_cache_build_definition_list(cosDefinitions **pDefs, int *vattr_ca
 		slapi_pblock_get( pSuffixSearch, SLAPI_PLUGIN_INTOP_RESULT, &ret);
 
 	if(!pSuffixSearch || ret != LDAP_SUCCESS) {
-		LDAPDebug( LDAP_DEBUG_ANY, 
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 		           "cos_cache_build_definition_list: failed to find suffixes\n",
 		           0,0,0);
 		ret = -1;
@@ -665,14 +665,14 @@ next:
 	{
 		if(firstTime)
 		{
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_build_definition_list: Found no cos definitions, cos disabled while waiting for updates\n",0,0,0);
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_build_definition_list: Found no cos definitions, cos disabled while waiting for updates\n",0,0,0);
 			firstTime = 0;
 		}
 
 		ret = -1;
 	}
 	else
-		LDAPDebug( LDAP_DEBUG_PLUGIN, "cos: Class of service cache built.\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos: Class of service cache built.\n",0,0,0);
 
 	/* clean up */
 	if(pSuffixSearch)
@@ -681,7 +681,7 @@ next:
 		slapi_pblock_destroy(pSuffixSearch);
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_build_definition_list\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_build_definition_list\n",0,0,0);
 	return ret;
 }
 
@@ -977,12 +977,12 @@ cos_dn_defs_cb (Slapi_Entry* e, void *callback_data)
 			 * Don't reset info->ret....it keeps track of any success
 			*/
 			if ( rc == COS_DEF_ERROR_NO_TEMPLATES) {
-				LDAPDebug(LDAP_DEBUG_ANY, "Skipping CoS Definition %s"
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Skipping CoS Definition %s"
 					"--no CoS Templates found, "
 					"which should be added before the CoS Definition.\n",
 					pTmpDn, 0, 0);
 			} else {
-				LDAPDebug(LDAP_DEBUG_ANY, "Skipping CoS Definition %s\n"
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Skipping CoS Definition %s\n"
 					"--error(%d)\n",
 					pTmpDn, rc, 0);
 			}
@@ -999,10 +999,10 @@ cos_dn_defs_cb (Slapi_Entry* e, void *callback_data)
 		*/
 		if(pDn)
 		{
-			LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_add_dn_defs: incomplete cos definition detected in %s, discarding from cache.\n",pDn->val,0,0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_add_dn_defs: incomplete cos definition detected in %s, discarding from cache.\n",pDn->val,0,0);
 		}
 		else
-			LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_add_dn_defs: incomplete cos definition detected, no DN to report, discarding from cache.\n",0,0,0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_add_dn_defs: incomplete cos definition detected, no DN to report, discarding from cache.\n",0,0,0);
 		
 		if(pCosTargetTree)
 			cos_cache_del_attrval_list(&pCosTargetTree);
@@ -1199,7 +1199,7 @@ static int 	cos_dn_tmpl_entries_cb (Slapi_Entry* e, void *callback_data) {
 				info->ret = 0;  /* we have succeed to add the tmpl */
 			} else {
 				/* Don't reset info->ret....it keeps track of any success */
-				LDAPDebug(LDAP_DEBUG_ANY, "cos_cache_add_dn_tmpls:"
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_add_dn_tmpls:"
 								"could not cache cos template %s\n",pDn,0,0);
 			}
 		}
@@ -1215,10 +1215,10 @@ static int 	cos_dn_tmpl_entries_cb (Slapi_Entry* e, void *callback_data) {
 			*/
 			if(pDn)
 			{
-				LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_add_dn_tmpls: incomplete cos template detected in %s, discarding from cache.\n",pDn->val,0,0);
+				LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_add_dn_tmpls: incomplete cos template detected in %s, discarding from cache.\n",pDn->val,0,0);
 			}
 			else
-				LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_add_dn_tmpls: incomplete cos template detected, no DN to report, discarding from cache.\n",0,0,0);
+				LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_add_dn_tmpls: incomplete cos template detected, no DN to report, discarding from cache.\n",0,0,0);
 			
 			if(pObjectclass)
 				cos_cache_del_attrval_list(&pObjectclass);
@@ -1259,7 +1259,7 @@ static int cos_cache_add_dn_tmpls(char *dn, cosAttrValue *pCosSpecifier, cosAttr
 	struct tmpl_info	info = {NULL, 0, 0, 0};
 	Slapi_PBlock *pDnSearch = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_add_dn_tmpls\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_add_dn_tmpls\n",0,0,0);
 	
 	/* no cos specifier means this is an indirect scheme */
 	if(pCosSpecifier)
@@ -1331,17 +1331,17 @@ static int cos_cache_add_defn(
 	cosAttributes *pDummyAttributes = 0;
 	cosAttrValue *pSpecsIter = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_add_defn\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_add_defn\n",0,0,0);
 	
 	if (!spec) {
-		LDAPDebug( LDAP_DEBUG_ANY, "missing spec\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "missing spec\n",0,0,0);
 		ret = -1;
 		goto out;
 	}
 	pSpecsIter = *spec;
 
 	if (!tmpDn) {
-		LDAPDebug( LDAP_DEBUG_ANY, "missing tmpDn\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "missing tmpDn\n",0,0,0);
 		ret = -1;
 		goto out;
 	}
@@ -1353,7 +1353,7 @@ static int cos_cache_add_defn(
 		if(	cos_cache_attrval_exists(*pAttrs, pSpecsIter->val ) )
 		{
 			/* no, this is not sane, lets reject the whole darn scheme in disgust */
-			LDAPDebug( LDAP_DEBUG_ANY, "cos definition %s supplies its own cosspecifier, rejecting scheme\n",(*dn)->val,0,0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos definition %s supplies its own cosspecifier, rejecting scheme\n",(*dn)->val,0,0);
 			ret = -1;
 		}
 
@@ -1370,7 +1370,7 @@ static int cos_cache_add_defn(
 			
 			/* process each template in turn */
 			
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "Processing cosDefinition %s\n",(*dn)->val,0,0);
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Processing cosDefinition %s\n",(*dn)->val,0,0);
 			
 			while(pTmpTmplDn && cosType != COSTYPE_INDIRECT)
 			{
@@ -1384,7 +1384,7 @@ static int cos_cache_add_defn(
 			if(tmplCount == 0 && cosType != COSTYPE_INDIRECT)
 			{
 				/* without our golden templates we are nothing 
-				LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_add_defn:"
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_add_defn:"
 				"no templates for cos definition at %s.\n",(*dn)->val,0,0);*/
 				ret = COS_DEF_ERROR_NO_TEMPLATES;
 			}
@@ -1429,7 +1429,7 @@ static int cos_cache_add_defn(
 				theDef->pCosOpDefault = *pCosOpDefault;
 
 				cos_cache_add_ll_entry((void**)pDefs, theDef, NULL);
-				LDAPDebug( LDAP_DEBUG_PLUGIN, "Added cosDefinition %s\n",(*dn)->val,0,0);
+				LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Added cosDefinition %s\n",(*dn)->val,0,0);
 			}
 		}
 		else
@@ -1453,7 +1453,7 @@ out:
 			cos_cache_del_attrval_list(pAttrs);
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_add_defn\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_add_defn\n",0,0,0);
 	return ret;
 }
 
@@ -1464,7 +1464,7 @@ out:
 */
 static void cos_cache_del_attrval_list(cosAttrValue **pVal)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_del_attrval_list\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_del_attrval_list\n",0,0,0);
 
 	while(*pVal)
 	{
@@ -1475,7 +1475,7 @@ static void cos_cache_del_attrval_list(cosAttrValue **pVal)
 		*pVal = pTmp;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_del_attrval_list\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_del_attrval_list\n",0,0,0);
 }
 
 
@@ -1490,7 +1490,7 @@ cos_cache_add_attrval(cosAttrValue **attrval, char *val)
 	int ret = 0;
 	cosAttrValue *theVal;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_add_attrval\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_add_attrval\n",0,0,0);
 
 	/* create the attrvalue */
 	theVal = (cosAttrValue*) slapi_ch_malloc(sizeof(cosAttrValue));
@@ -1504,17 +1504,17 @@ cos_cache_add_attrval(cosAttrValue **attrval, char *val)
 		else
 		{
 			slapi_ch_free((void**)&theVal);
-			LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_add_attrval: failed to allocate memory\n",0,0,0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_add_attrval: failed to allocate memory\n",0,0,0);
 			ret = -1;
 		}
 	}
 	else
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_add_attrval: failed to allocate memory\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_add_attrval: failed to allocate memory\n",0,0,0);
 		ret = -1;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_add_attrval\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_add_attrval\n",0,0,0);
 	return ret;
 }
 
@@ -1551,7 +1551,7 @@ static void cos_cache_add_ll_entry(void** attrval, void *theVal, int ( *compare
 	static int call_count = 0;
 
 	call_count++;
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_add_ll_entry - recursion level %d\n",call_count,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_add_ll_entry - recursion level %d\n",call_count,0,0);
 
 
 	/*
@@ -1614,7 +1614,7 @@ static void cos_cache_add_ll_entry(void** attrval, void *theVal, int ( *compare
 			*attrval = theVal;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_add_ll_entry - recursion level %d\n",call_count,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_add_ll_entry - recursion level %d\n",call_count,0,0);
 	call_count--;
 }
 
@@ -1630,7 +1630,7 @@ int cos_cache_getref(cos_cache **pptheCache)
 	static int first_time = 1;
 	cosCache **ppCache = (cosCache**)pptheCache;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_getref\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_getref\n",0,0,0);
 
 	if(first_time)
 	{
@@ -1642,7 +1642,7 @@ int cos_cache_getref(cos_cache **pptheCache)
 			if(cos_cache_create())
 			{
 				/* there was a problem or no COS definitions were found */
-				LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_getref: no cos cache created\n",0,0,0);
+				LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_getref: no cos cache created\n",0,0,0);
 			}
 		}
 		slapi_unlock_mutex(change_lock);
@@ -1659,7 +1659,7 @@ int cos_cache_getref(cos_cache **pptheCache)
 
 
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_getref\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_getref\n",0,0,0);
 	return ret;
 }
 
@@ -1673,7 +1673,7 @@ int cos_cache_addref(cos_cache *ptheCache)
 	int ret = 0;
 	cosCache *pCache = (cosCache*)ptheCache;
 	
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_addref\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_addref\n",0,0,0);
 
 	slapi_lock_mutex(cache_lock);
 	
@@ -1682,7 +1682,7 @@ int cos_cache_addref(cos_cache *ptheCache)
 	
 	slapi_unlock_mutex(cache_lock);
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_addref\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_addref\n",0,0,0);
 
 	return ret;
 }
@@ -1700,7 +1700,7 @@ int cos_cache_release(cos_cache *ptheCache)
 	int destroy = 0;
 	cosCache *pOldCache = (cosCache*)ptheCache;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_release\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_release\n",0,0,0);
 
 	slapi_lock_mutex(cache_lock);
 
@@ -1770,7 +1770,7 @@ int cos_cache_release(cos_cache *ptheCache)
 		slapi_ch_free((void**)&pOldCache);
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_release\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_release\n",0,0,0);
 
 	return ret;
 }
@@ -1783,7 +1783,7 @@ int cos_cache_release(cos_cache *ptheCache)
 */
 static void cos_cache_del_attr_list(cosAttributes **pAttrs)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_del_attr_list\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_del_attr_list\n",0,0,0);
 
 	while(*pAttrs)
 	{
@@ -1796,7 +1796,7 @@ static void cos_cache_del_attr_list(cosAttributes **pAttrs)
 	}
 
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_del_attr_list\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_del_attr_list\n",0,0,0);
 }
 
 
@@ -1810,7 +1810,7 @@ static void cos_cache_del_schema(cosCache *pCache)
 	char *pLastName = 0;
 	int attr_index = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_del_schema\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_del_schema\n",0,0,0);
 
 	if(pCache && pCache->attrCount && pCache->ppAttrIndex)
 	{
@@ -1831,7 +1831,7 @@ static void cos_cache_del_schema(cosCache *pCache)
 		cos_cache_del_attrval_list(&(pCache->ppAttrIndex[0]->pObjectclasses));
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_del_schema\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_del_schema\n",0,0,0);
 }
 
 
@@ -1845,7 +1845,7 @@ static int cos_cache_add_attr(cosAttributes **pAttrs, char *name, cosAttrValue *
 	int ret =0;
 	cosAttributes *theAttr;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_add_attr\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_add_attr\n",0,0,0);
 
 	/* create the attribute */
 	theAttr = (cosAttributes*) slapi_ch_malloc(sizeof(cosAttributes));
@@ -1857,22 +1857,22 @@ static int cos_cache_add_attr(cosAttributes **pAttrs, char *name, cosAttrValue *
 		if(theAttr->pAttrName)
 		{
 			cos_cache_add_ll_entry((void**)pAttrs, theAttr, NULL);
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_add_attr: Added attribute %s\n",name,0,0);
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_add_attr: Added attribute %s\n",name,0,0);
 		}
 		else
 		{
 			slapi_ch_free((void**)&theAttr);
-			LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_add_attr: failed to allocate memory\n",0,0,0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_add_attr: failed to allocate memory\n",0,0,0);
 			ret = -1;
 		}
 	}
 	else
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_add_attr: failed to allocate memory\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_add_attr: failed to allocate memory\n",0,0,0);
 		ret = -1;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_add_attr\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_add_attr\n",0,0,0);
 	return ret;
 }
 
@@ -1887,7 +1887,7 @@ static int cos_cache_add_tmpl(cosTemplates **pTemplates, cosAttrValue *dn, cosAt
 	int ret =0;
 	cosTemplates *theTemp;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_add_tmpl\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_add_tmpl\n",0,0,0);
 
 	/* create the attribute */
 	theTemp = (cosTemplates*) slapi_ch_malloc(sizeof(cosTemplates));
@@ -1903,7 +1903,7 @@ static int cos_cache_add_tmpl(cosTemplates **pTemplates, cosAttrValue *dn, cosAt
 			slapi_ch_free_string(&dn->val);
 			dn->val = normed;
 		} else {
-			LDAPDebug(LDAP_DEBUG_ANY, 
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 				"cos_cache_add_tmpl: failed to normalize dn %s. "
 				"Processing the pre normalized dn.\n", 
 				dn->val, 0, 0);
@@ -1997,7 +1997,7 @@ static int cos_cache_add_tmpl(cosTemplates **pTemplates, cosAttrValue *dn, cosAt
 		else
 		{
 			/* mmm, should never get here, it means the dn is whacky */
-			LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_add_tmpl: malformed dn detected: %s\n",dn,0,0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_add_tmpl: malformed dn detected: %s\n",dn,0,0);
 			grade[0] = '\0';
 		}
 
@@ -2016,17 +2016,17 @@ static int cos_cache_add_tmpl(cosTemplates **pTemplates, cosAttrValue *dn, cosAt
 		}
 		
 		cos_cache_add_ll_entry((void**)pTemplates, theTemp, NULL);
-		LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_add_tmpl: Added template %s\n",dn->val,0,0);
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_add_tmpl: Added template %s\n",dn->val,0,0);
 
 		slapi_ch_free((void**)&grade);
 	}
 	else
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_add_tmpl: failed to allocate memory\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_add_tmpl: failed to allocate memory\n",0,0,0);
 		ret = -1;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_add_tmpl\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_add_tmpl\n",0,0,0);
 	return ret;
 }
 
@@ -2045,7 +2045,7 @@ static int cos_cache_attrval_exists(cosAttrValue *pAttrs, const char *val)
 {
 	int ret = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_attrval_exists\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_attrval_exists\n",0,0,0);
 
 	while(pAttrs)
 	{
@@ -2058,7 +2058,7 @@ static int cos_cache_attrval_exists(cosAttrValue *pAttrs, const char *val)
 		pAttrs = pAttrs->list.pNext;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_attrval_exists\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_attrval_exists\n",0,0,0);
 	return ret;
 }
 
@@ -2070,12 +2070,12 @@ static int cos_cache_vattr_get(vattr_sp_handle *handle, vattr_context *c, Slapi_
 	int indirect_cos = 0;
 	int ret = -1;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_vattr_get\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_vattr_get\n",0,0,0);
 	
 	if(cos_cache_getref(&pCache) < 1)
 	{
 		/* problems we are hosed */
-		LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_vattr_get: failed to get class of service reference\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_vattr_get: failed to get class of service reference\n",0,0,0);
 		goto bail;
 	}
 
@@ -2095,7 +2095,7 @@ static int cos_cache_vattr_get(vattr_sp_handle *handle, vattr_context *c, Slapi_
 
 bail:
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_vattr_get\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_vattr_get\n",0,0,0);
 	return ret;
 }
 
@@ -2105,12 +2105,12 @@ static int cos_cache_vattr_compare(vattr_sp_handle *handle, vattr_context *c, Sl
 	int ret = -1;
 	cos_cache *pCache = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_vattr_compare\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_vattr_compare\n",0,0,0);
 	
 	if(cos_cache_getref(&pCache) < 1)
 	{
 		/* problems we are hosed */
-		LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_vattr_compare: failed to get class of service reference\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_vattr_compare: failed to get class of service reference\n",0,0,0);
 		goto bail;
 	}
 
@@ -2120,7 +2120,7 @@ static int cos_cache_vattr_compare(vattr_sp_handle *handle, vattr_context *c, Sl
 
 bail:
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_vattr_compare\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_vattr_compare\n",0,0,0);
 	return ret;
 }
 
@@ -2137,12 +2137,12 @@ static int cos_cache_vattr_types(vattr_sp_handle *handle,Slapi_Entry *e,
 	char *lastattr = "thisisfakeforcos";
 	int props = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_vattr_types\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_vattr_types\n",0,0,0);
 	
 	if(cos_cache_getref((cos_cache **)&pCache) < 1)
 	{
 		/* problems we are hosed */
-		LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_vattr_types: failed to get class of service reference\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_vattr_types: failed to get class of service reference\n",0,0,0);
 		goto bail;
 	}
 
@@ -2175,7 +2175,7 @@ static int cos_cache_vattr_types(vattr_sp_handle *handle,Slapi_Entry *e,
 
 bail:
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_vattr_types\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_vattr_types\n",0,0,0);
 	return ret;
 }
 
@@ -2222,7 +2222,7 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context,
 	int entry_has_value = 0;
 	int merge_mode = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_query_attr\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_query_attr\n",0,0,0);
 
 
 	if(out_attr)
@@ -2285,7 +2285,7 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context,
 	
 	if(pDn == 0)
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_query_attr: failed to get entry dn\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_query_attr: failed to get entry dn\n",0,0,0);
 		ret = 1;
 		goto bail;
 	}
@@ -2300,13 +2300,13 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context,
 
 		if(slapi_entry_attr_find( e, "objectclass", &pObjclasses ))
 		{
-			LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_query_attr: failed to get objectclass from %s\n",pDn,0,0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_query_attr: failed to get objectclass from %s\n",pDn,0,0);
 			goto bail;
 		}
 
 		if(!cos_cache_schema_check(pCache, attr_index, pObjclasses))
 		{
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "cos_cache_query_attr: cos attribute %s failed schema check on dn: %s\n",type,pDn,0);
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos_cache_query_attr: cos attribute %s failed schema check on dn: %s\n",type,pDn,0);
 			goto bail;
 		}
 	}
@@ -2474,7 +2474,7 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context,
 											hit = 1;
 										else
 										{
-											LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_query_attr: could not create values to return\n",0,0,0);
+											LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_query_attr: could not create values to return\n",0,0,0);
 											goto bail;
 										}
 
@@ -2557,7 +2557,7 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context,
 				hit = 1;
 			else
 			{
-				LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_query_attr: could not create values to return\n",0,0,0);
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_query_attr: could not create values to return\n",0,0,0);
 				goto bail;
 			}
 		}
@@ -2602,7 +2602,7 @@ static int cos_cache_query_attr(cos_cache *ptheCache, vattr_context *context,
 
 bail:
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_query_attr\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_query_attr\n",0,0,0);
 	return ret;
 }
 
@@ -2618,7 +2618,7 @@ static int cos_cache_find_attr(cosCache *pCache, char *type)
 	int ret = -1;  /* assume failure */
 	cosAttributes attr;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_find_attr\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_find_attr\n",0,0,0);
 
 	attr.pAttrName = type;
 
@@ -2633,7 +2633,7 @@ static int cos_cache_find_attr(cosCache *pCache, char *type)
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_find_attr\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_find_attr\n",0,0,0);
 	return ret;
 }
 
@@ -2652,7 +2652,7 @@ static int cos_cache_schema_check(cosCache *pCache, int attr_index, Slapi_Attr *
 	Slapi_Value *val;
 	int hint;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_schema_check\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_schema_check\n",0,0,0);
 
 	hint = slapi_attr_first_value( pObjclasses, &val );
 	while(hint != -1) 
@@ -2664,7 +2664,7 @@ static int cos_cache_schema_check(cosCache *pCache, int attr_index, Slapi_Attr *
 		hint = slapi_attr_next_value( pObjclasses, hint,  &val );
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_schema_check\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_schema_check\n",0,0,0);
 	return ret;
 }
 
@@ -2682,7 +2682,7 @@ static int cos_cache_schema_build(cosCache *pCache)
 	cosAttrValue *pLastRef = 0;
 	int attr_index = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_schema_build\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_schema_build\n",0,0,0);
 
 	if(!config_get_schemacheck())
 		ret = 0;
@@ -2762,7 +2762,7 @@ static int cos_cache_schema_build(cosCache *pCache)
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_schema_build\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_schema_build\n",0,0,0);
 	return ret;
 }
 
@@ -2788,7 +2788,7 @@ static int cos_cache_index_all(cosCache *pCache)
 {
 	int ret = -1;
 	
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_index_all\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_index_all\n",0,0,0);
 
 	/*
 		first fixup the index array so we can use qsort()
@@ -2877,7 +2877,7 @@ static int cos_cache_index_all(cosCache *pCache)
 						slapi_ch_free_string(&pAttrVal->val);
 						pAttrVal->val = normed;
 					} else {
-						LDAPDebug(LDAP_DEBUG_ANY, 
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 							"cos_cache_index_all: failed to normalize dn %s. "
 							"Processing the pre normalized dn.\n", 
 							pAttrVal->val, 0, 0);
@@ -2949,7 +2949,7 @@ static int cos_cache_index_all(cosCache *pCache)
 			
 			pCache->templateCount = actualCount;
 
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "cos: cos cache index built\n",0,0,0);
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "cos: cos cache index built\n",0,0,0);
 			
 			ret = 0;
 		}
@@ -2961,13 +2961,13 @@ static int cos_cache_index_all(cosCache *pCache)
 			if(pCache->ppTemplateList)
 				slapi_ch_free((void**)(&pCache->ppTemplateList));
 
-			LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_index_all: failed to allocate index memory\n",0,0,0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_index_all: failed to allocate index memory\n",0,0,0);
 		}
 	}
 	else
-		LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_index_all: no attributes to index\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_index_all: no attributes to index\n",0,0,0);
 	
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_index_all\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_index_all\n",0,0,0);
 	return ret;
 }
 
@@ -2995,7 +2995,7 @@ static int cos_cache_total_attr_count(cosCache *pCache)
 	int count = 0;
 	cosDefinitions *pDef = pCache->pDefs;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_total_attr_count\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_total_attr_count\n",0,0,0);
 
 	pCache->templateCount = 0;
 
@@ -3020,7 +3020,7 @@ static int cos_cache_total_attr_count(cosCache *pCache)
 		pDef = pDef->list.pNext;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_total_attr_count\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_total_attr_count\n",0,0,0);
 	return count;
 }
 
@@ -3087,7 +3087,7 @@ static int cos_cache_template_index_bsearch(const char *dn)
 	int ret = 0;
 	cosCache *pCache;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_template_index_bsearch\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_template_index_bsearch\n",0,0,0);
 	
 	if(-1 != cos_cache_getref((cos_cache**)&pCache))
 	{
@@ -3097,7 +3097,7 @@ static int cos_cache_template_index_bsearch(const char *dn)
 		cos_cache_release((cos_cache*)pCache);
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_template_index_bsearch\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_template_index_bsearch\n",0,0,0);
 
 	return ret;
 }
@@ -3115,7 +3115,7 @@ static int cos_cache_attr_index_bsearch( const cosCache *pCache, const cosAttrib
 	int ret = -1;
 	int index = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_attr_index_bsearch\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_attr_index_bsearch\n",0,0,0);
 
 	if(upper >= lower)
 	{
@@ -3159,7 +3159,7 @@ static int cos_cache_attr_index_bsearch( const cosCache *pCache, const cosAttrib
 	else
 		index = -1;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_attr_index_bsearch\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_attr_index_bsearch\n",0,0,0);
 	return index;
 }
 
@@ -3171,7 +3171,7 @@ static int cos_cache_cmp_attr(cosAttributes *pAttr, Slapi_Value *test_this, int
 	cosAttrValue *pAttrVal = pAttr->pAttrValue;
 	char *the_cmp = (char *)slapi_value_get_string(test_this);
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_cmp_attr\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_cmp_attr\n",0,0,0);
 	
 	*result = 0;
 
@@ -3189,7 +3189,7 @@ static int cos_cache_cmp_attr(cosAttributes *pAttr, Slapi_Value *test_this, int
 		index++;
 	} 
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_cmp_attr\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_cmp_attr\n",0,0,0);
 	return ret;
 }
 
@@ -3208,7 +3208,7 @@ static int cos_cache_cos_2_slapi_valueset(cosAttributes *pAttr, Slapi_ValueSet *
 	static Slapi_Attr *attr = 0; /* allocated once, never freed */
 	static int done_once = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_cos_2_slapi_attr\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_cos_2_slapi_attr\n",0,0,0);
 	
 	/* test out_vs for existing values */
 	if(*out_vs)
@@ -3242,7 +3242,7 @@ static int cos_cache_cos_2_slapi_valueset(cosAttributes *pAttr, Slapi_ValueSet *
 			}
 			else
 			{
-				LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_cos_2_slapi_attr: memory allocation error\n",0,0,0);
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_cos_2_slapi_attr: memory allocation error\n",0,0,0);
 				ret = -1;
 				goto bail;
 			}
@@ -3253,13 +3253,13 @@ static int cos_cache_cos_2_slapi_valueset(cosAttributes *pAttr, Slapi_ValueSet *
 	}
 	else
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "cos_cache_cos_2_slapi_attr: memory allocation error\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cos_cache_cos_2_slapi_attr: memory allocation error\n",0,0,0);
 		ret = -1;
 	}
 
 bail:
 	
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_cos_2_slapi_attr\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_cos_2_slapi_attr\n",0,0,0);
 	return ret;
 }
 
@@ -3295,7 +3295,7 @@ void cos_cache_change_notify(Slapi_PBlock *pb)
 	int rc = 0;
 	int optype = -1;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_change_notify\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_change_notify\n",0,0,0);
 
 	/* Don't update local cache when remote entries are updated. */
 	slapi_pblock_get( pb, SLAPI_BACKEND, &be );
@@ -3376,7 +3376,7 @@ void cos_cache_change_notify(Slapi_PBlock *pb)
 	}
 
 bail:
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_change_notify\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_change_notify\n",0,0,0);
 }
 
 /*
@@ -3386,7 +3386,7 @@ bail:
 */
 void cos_cache_stop(void)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_stop\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_stop\n",0,0,0);
 
 	/* first deregister our state change func */
 	slapi_unregister_backend_state_change((void *)cos_cache_backend_state_change);
@@ -3411,7 +3411,7 @@ void cos_cache_stop(void)
 	slapi_destroy_condvar(start_cond); start_cond = NULL;
 	slapi_destroy_mutex(start_lock); start_lock = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_stop\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_stop\n",0,0,0);
 }
 
 /*
@@ -3431,7 +3431,7 @@ static int cos_cache_backwards_stricmp_and_clip(char*s1,char*s2)
 	s1len = strlen(s1);
 	s2len = strlen(s2);
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_backwards_stricmp_and_clip s1 %d s2 %d\n",s1len,s2len,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> cos_cache_backwards_stricmp_and_clip s1 %d s2 %d\n",s1len,s2len,0);
 
 	if(s1len > s2len && s2len > 0)
 	{
@@ -3458,7 +3458,7 @@ static int cos_cache_backwards_stricmp_and_clip(char*s1,char*s2)
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- cos_cache_backwards_stricmp_and_clip\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- cos_cache_backwards_stricmp_and_clip\n",0,0,0);
 	return ret;
 }
 
diff --git a/ldap/servers/plugins/http/http_client.c b/ldap/servers/plugins/http/http_client.c
index 4ce992c..16befdb 100644
--- a/ldap/servers/plugins/http/http_client.c
+++ b/ldap/servers/plugins/http/http_client.c
@@ -113,7 +113,7 @@ int http_client_version(void)
 int http_client_init(Slapi_PBlock *pb)
 {
 	int status = HTTP_SUCCESS;
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> http_client_init -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> http_client_init -- BEGIN\n",0,0,0);
 
 	if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    	SLAPI_PLUGIN_VERSION_01 ) != 0 ||
@@ -137,7 +137,7 @@ int http_client_init(Slapi_PBlock *pb)
          return HTTP_FAILURE;
         }
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- http_client_init -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- http_client_init -- END\n",0,0,0);
     return status;
 }
 
@@ -147,7 +147,7 @@ static int http_client_start(Slapi_PBlock *pb)
 	/**
 	 * do some init work here
 	 */
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> http_client_start -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> http_client_start -- BEGIN\n",0,0,0);
 
 	api[0] = 0; /* reserved for api broker use, must be zero */
 	api[1] = (void *)_http_init;
@@ -165,7 +165,7 @@ static int http_client_start(Slapi_PBlock *pb)
 	
 	_http_init(plugin_id);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- http_client_start -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- http_client_start -- END\n",0,0,0);
 	return status;
 }
 
@@ -175,11 +175,11 @@ static int http_client_close(Slapi_PBlock *pb)
 	/**
 	 * do cleanup 
 	 */
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> http_client_close -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> http_client_close -- BEGIN\n",0,0,0);
 
 	slapi_apib_unregister(HTTP_v1_0_GUID);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- http_client_close -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- http_client_close -- END\n",0,0,0);
 
 	return status;
 }
@@ -189,11 +189,11 @@ static int http_client_close(Slapi_PBlock *pb)
  */
 static void _http_init(Slapi_ComponentId *plugin_id)
 {
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> _http_init -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> _http_init -- BEGIN\n",0,0,0);
 	
 	http_impl_init(plugin_id);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- _http_init -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- _http_init -- END\n",0,0,0);
 }
 
 /**
@@ -203,11 +203,11 @@ static void _http_init(Slapi_ComponentId *plugin_id)
 static int _http_get_text(char *url, char **data, int *bytesRead)
 {
 	int status = HTTP_SUCCESS;
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> _http_get_text -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> _http_get_text -- BEGIN\n",0,0,0);
 
 	status = http_impl_get_text(url, data, bytesRead);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- _http_get_text -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- _http_get_text -- END\n",0,0,0);
 	return status;
 }
 
@@ -218,11 +218,11 @@ static int _http_get_text(char *url, char **data, int *bytesRead)
 static int _http_get_binary(char *url, char **data, int *bytesRead)
 {
 	int status = HTTP_SUCCESS;
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> _http_get_binary -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> _http_get_binary -- BEGIN\n",0,0,0);
 
 	status = http_impl_get_binary(url, data, bytesRead);
 	
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- _http_get_binary -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- _http_get_binary -- END\n",0,0,0);
 	return status;
 }
 
@@ -233,11 +233,11 @@ static int _http_get_binary(char *url, char **data, int *bytesRead)
 static int _http_get_redirected_uri(char *url, char **data, int *bytesRead)
 {
 	int status = HTTP_SUCCESS;
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> _http_get_redirected_uri -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> _http_get_redirected_uri -- BEGIN\n",0,0,0);
 
 	status = http_impl_get_redirected_uri(url, data, bytesRead);
 	
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- _http_get_redirected_uri -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- _http_get_redirected_uri -- END\n",0,0,0);
 	return status;
 }
 
@@ -247,11 +247,11 @@ static int _http_get_redirected_uri(char *url, char **data, int *bytesRead)
 static int _http_post(char *url, httpheader ** httpheaderArray, char *body, char **data, int *bytesRead)
 {
 	int status = HTTP_SUCCESS;
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> _http_post -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> _http_post -- BEGIN\n",0,0,0);
 
 	status = http_impl_post(url, httpheaderArray, body, data, bytesRead);
 	
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- _http_post -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- _http_post -- END\n",0,0,0);
 	return status;
 }
 
@@ -260,10 +260,10 @@ static int _http_post(char *url, httpheader ** httpheaderArray, char *body, char
  */
 static void _http_shutdown( void )
 {
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> _http_shutdown -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> _http_shutdown -- BEGIN\n",0,0,0);
 	
 	http_impl_shutdown();
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- _http_shutdown -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- _http_shutdown -- END\n",0,0,0);
 }
 
diff --git a/ldap/servers/plugins/http/http_impl.c b/ldap/servers/plugins/http/http_impl.c
index e2a141a..f4605e2 100644
--- a/ldap/servers/plugins/http/http_impl.c
+++ b/ldap/servers/plugins/http/http_impl.c
@@ -182,14 +182,14 @@ static int doRequestRetry(const char *url, httpheader **httpheaderArray, char *b
 	retrycnt = httpConfig->retryCount;
 	
 	if (retrycnt == 0) {
-		  LDAPDebug( LDAP_DEBUG_PLUGIN, "doRequestRetry: Retry Count cannot be read. Setting to default value of 3 \n", 0,0,0);
+		  LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "doRequestRetry: Retry Count cannot be read. Setting to default value of 3 \n", 0,0,0);
 	   	  retrycnt = 3;
 	}
         status = doRequest(url, httpheaderArray, body, buf, bytesRead, reqType);
 	if (status != HTTP_IMPL_SUCCESS) {
-	       LDAPDebug( LDAP_DEBUG_PLUGIN, "doRequestRetry: Failed to perform http request \n", 0,0,0);
+	       LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "doRequestRetry: Failed to perform http request \n", 0,0,0);
        	 while (retrycnt > 0) {
-       	         LDAPDebug( LDAP_DEBUG_PLUGIN, "doRequestRetry: Retrying http request %d.\n", i,0,0);
+       	         LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "doRequestRetry: Retrying http request %d.\n", i,0,0);
        	         status = doRequest(url, httpheaderArray, body, buf, bytesRead, reqType);
        	         if (status == HTTP_IMPL_SUCCESS) {
                         break;
@@ -198,8 +198,8 @@ static int doRequestRetry(const char *url, httpheader **httpheaderArray, char *b
        	         i++;
         }
         if (status != HTTP_IMPL_SUCCESS) {
-                LDAPDebug( LDAP_DEBUG_ANY, "doRequestRetry: Failed to perform http request after %d attempts.\n", i,0,0);
-	LDAPDebug( LDAP_DEBUG_ANY, "doRequestRetry:  Verify plugin URI configuration and contact Directory Administrator.\n",0,0,0);
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "doRequestRetry: Failed to perform http request after %d attempts.\n", i,0,0);
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "doRequestRetry:  Verify plugin URI configuration and contact Directory Administrator.\n",0,0,0);
         }
 
 	}
@@ -219,9 +219,9 @@ static int doRequest(const char *url, httpheader **httpheaderArray, char *body,
 	PRInt32 http_connection_time_out = 0;
 	PRInt32 sslOn = 0;
 	
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> doRequest -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> doRequest -- BEGIN\n",0,0,0);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> url=[%s] \n",url,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> url=[%s] \n",url,0,0);
 
 	/* Parse the URL and initialize the host, port, path */
 	if (parseURI(url, &host, &port, &path, &sslOn) == PR_FAILURE) {
@@ -231,7 +231,7 @@ static int doRequest(const char *url, httpheader **httpheaderArray, char *body,
 		goto bail;
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> host=[%s] port[%d] path[%s] \n",host,port,path);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> host=[%s] port[%d] path[%s] \n",host,port,path);
 
 	/* Initialize the Net Addr */
     if (PR_StringToNetAddr(host, &addr) == PR_FAILURE) {
@@ -251,7 +251,7 @@ static int doRequest(const char *url, httpheader **httpheaderArray, char *body,
 		addr.inet.port = (PRUint16)port;
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Successfully created NetAddr \n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Successfully created NetAddr \n",0,0,0);
 
 	/* open a TCP connection to the server */
     fd = PR_NewTCPSocket();
@@ -262,7 +262,7 @@ static int doRequest(const char *url, httpheader **httpheaderArray, char *body,
 		goto bail;
     }
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Successfully created New TCP Socket \n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Successfully created New TCP Socket \n",0,0,0);
 
 	/* immediately send the response */
     setTCPNoDelay(fd);
@@ -297,7 +297,7 @@ static int doRequest(const char *url, httpheader **httpheaderArray, char *body,
 		goto bail;
     }
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Successfully connected to host [%s] \n",host,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Successfully connected to host [%s] \n",host,0,0);
 
 	/* send the request to the server */
 	if (reqType == HTTP_REQ_TYPE_POST) {
@@ -317,7 +317,7 @@ static int doRequest(const char *url, httpheader **httpheaderArray, char *body,
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Successfully sent the request [%s] \n",path,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Successfully sent the request [%s] \n",path,0,0);
 
 	/* read the response */
 	if (processResponse(fd, buf, bytesRead, reqType) == PR_FAILURE) {
@@ -326,7 +326,7 @@ static int doRequest(const char *url, httpheader **httpheaderArray, char *body,
         status = HTTP_CLIENT_ERROR_BAD_RESPONSE;
 		goto bail;
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Successfully read the response\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Successfully read the response\n",0,0,0);
 bail:
 	if (host) {
 		PR_Free(host);
@@ -338,7 +338,7 @@ bail:
 		PR_Close(fd);
 		fd = NULL;
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- doRequest -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- doRequest -- END\n",0,0,0);
 	return status;
 }
 
@@ -368,7 +368,7 @@ static PRStatus processResponse(PRFileDesc *fd, char **resBUF, int *bytesRead, i
 	 * the HTTP_DEFAULT_BUFFER_SIZE, it will cause the server to crash. A 4k
 	 * buffer should be good enough.
 	 */
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> processResponse -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> processResponse -- BEGIN\n",0,0,0);
 
 	headers = (char *)PR_Calloc(1, 4 * HTTP_DEFAULT_BUFFER_SIZE);
     /* Get protocol string */
@@ -390,7 +390,7 @@ static PRStatus processResponse(PRFileDesc *fd, char **resBUF, int *bytesRead, i
     tmp[index] = '\0';
     protocol = PL_strdup(tmp);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> protocol=[%s] \n",protocol,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> protocol=[%s] \n",protocol,0,0);
 
     /* Get status num */
     index = 0;
@@ -412,7 +412,7 @@ static PRStatus processResponse(PRFileDesc *fd, char **resBUF, int *bytesRead, i
     statusNum = PL_strdup(tmp);
 	retcode=atoi(tmp);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> statusNum=[%s] \n",statusNum,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> statusNum=[%s] \n",statusNum,0,0);
 
 	if (HTTP_RESPONSE_REDIRECT && (reqType == HTTP_REQ_TYPE_REDIRECT)) {
 		isRedirect = PR_TRUE;
@@ -433,7 +433,7 @@ static PRStatus processResponse(PRFileDesc *fd, char **resBUF, int *bytesRead, i
 		}
 		tmp[index] = '\0';
         statusString = PL_strdup(tmp);
-		LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> statusString [%s] \n",statusString,0,0);
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> statusString [%s] \n",statusString,0,0);
     }
 
     /**
@@ -507,7 +507,7 @@ static PRStatus processResponse(PRFileDesc *fd, char **resBUF, int *bytesRead, i
 				value[index] = '\0';
 				index = 0;
 				inName = PR_TRUE;
-				LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> name=[%s] value=[%s]\n",name,value,0);
+				LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> name=[%s] value=[%s]\n",name,value,0);
 				if (isRedirect && !PL_strcasecmp(name,"location")) {
 				  location = PL_strdup(value);
 				}
@@ -530,7 +530,7 @@ static PRStatus processResponse(PRFileDesc *fd, char **resBUF, int *bytesRead, i
 		*resBUF = PL_strdup(location);
 		*bytesRead = strlen(location);
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Response Buffer=[%s] bytesRead=[%d] \n",*resBUF,*bytesRead,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Response Buffer=[%s] bytesRead=[%d] \n",*resBUF,*bytesRead,0);
 
 bail:
 
@@ -550,7 +550,7 @@ bail:
 		PL_strfree(location);
 	}
 	
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- processResponse -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- processResponse -- END\n",0,0,0);
     return status;
 }
 
@@ -605,7 +605,7 @@ static PRStatus sendFullData( PRFileDesc *fd, char *buf, int timeOut)
 		slapi_log_error(SLAPI_LOG_FATAL, LOG_ERR, HTTP_PLUGIN_SUBSYSTEM,
 			"sendFullData: dataSent=%d bufLen=%d -> NSPR Error code (%d)\n",
 			dataSent, bufLen, errcode);
-		LDAPDebug( LDAP_DEBUG_PLUGIN, "---------->NSPR Error code (%d) \n", errcode,0,0);
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "---------->NSPR Error code (%d) \n", errcode,0,0);
 		return PR_FAILURE;
 	}
 }
@@ -675,7 +675,7 @@ static PRStatus sendPostReq(PRFileDesc *fd, const char *path, httpheader **httph
 	}
 	strcat(reqBUF, "\0");
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "---------->reqBUF is %s \n",reqBUF,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "---------->reqBUF is %s \n",reqBUF,0,0);
 	http_connection_time_out = httpConfig->connectionTimeOut;
 
 	status = sendFullData( fd, reqBUF, http_connection_time_out);
@@ -1343,7 +1343,7 @@ static int parseHTTPConfigEntry(Slapi_Entry *e)
             httpConfig->connectionTimeOut = value;
     }
    	else {
-                 LDAPDebug( LDAP_DEBUG_PLUGIN, "parseHTTPConfigEntry: HTTP Connection Time Out cannot be read. Setting to default value of 5000 ms \n", 0,0,0);
+                 LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "parseHTTPConfigEntry: HTTP Connection Time Out cannot be read. Setting to default value of 5000 ms \n", 0,0,0);
                  httpConfig->connectionTimeOut = 5000;
    	}
 
@@ -1353,7 +1353,7 @@ static int parseHTTPConfigEntry(Slapi_Entry *e)
             httpConfig->readTimeOut = value;
     }
     else {
-                 LDAPDebug( LDAP_DEBUG_PLUGIN, "parseHTTPConfigEntry: HTTP Read Time Out cannot be read. Setting to default value of 5000 ms \n", 0,0,0);
+                 LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "parseHTTPConfigEntry: HTTP Read Time Out cannot be read. Setting to default value of 5000 ms \n", 0,0,0);
                  httpConfig->readTimeOut = 5000;
    	}
 	
diff --git a/ldap/servers/plugins/presence/presence.c b/ldap/servers/plugins/presence/presence.c
index 0c9a485..4af3d9c 100644
--- a/ldap/servers/plugins/presence/presence.c
+++ b/ldap/servers/plugins/presence/presence.c
@@ -249,7 +249,7 @@ int presence_init( Slapi_PBlock *pb )
 	int status = PRESENCE_SUCCESS;
 	char * plugin_identity=NULL;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> presence_init -- BEGIN\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> presence_init -- BEGIN\n",0,0,0);
 
 	/**
 	 * Store the plugin identity for later use.
@@ -274,7 +274,7 @@ int presence_init( Slapi_PBlock *pb )
 		status = PRESENCE_FAILURE;
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- presence_init -- END\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- presence_init -- END\n",0,0,0);
     return status;
 }
 
@@ -289,7 +289,7 @@ int presence_start( Slapi_PBlock *pb )
 {
 	char * plugindn = NULL;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> presence_start -- begin\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> presence_start -- begin\n",0,0,0);
 
     if(slapi_apib_get_interface(HTTP_v1_0_GUID, &_HttpAPI))
 	{
@@ -345,8 +345,8 @@ int presence_start( Slapi_PBlock *pb )
 		return PRESENCE_FAILURE;
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "presence: ready for service\n",0,0,0);
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- presence_start -- end\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "presence: ready for service\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- presence_start -- end\n",0,0,0);
 
 	return PRESENCE_SUCCESS;
 }
@@ -358,11 +358,11 @@ int presence_start( Slapi_PBlock *pb )
 */
 int presence_close( Slapi_PBlock *pb )
 {
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> presence_close\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> presence_close\n",0,0,0);
 
 	deleteMapTables();
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- presence_close\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- presence_close\n",0,0,0);
 
 	return PRESENCE_SUCCESS;
 }
@@ -386,9 +386,9 @@ static int presence_vattr_get(vattr_sp_handle *handle,
 	_Vmap *map = NULL;
 	_ConfigEntry *info = NULL;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> presence_vattr_get \n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> presence_vattr_get \n",0,0,0);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Type=[%s] \n",type,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Type=[%s] \n",type,0,0);
 
 	if (imIDExists(e, type, &id, &map, &info) != PRESENCE_SUCCESS)
 	{
@@ -400,7 +400,7 @@ static int presence_vattr_get(vattr_sp_handle *handle,
 		status = PRESENCE_FAILURE;		
 		goto cleanup;
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> ID=[%s] \n",id,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> ID=[%s] \n",id,0,0);
 
 	/**
 	 * Now since we got a valid id we do a quick schema check
@@ -417,8 +417,8 @@ static int presence_vattr_get(vattr_sp_handle *handle,
 
 	status = makeHttpRequest(id, map, info, &returnedBUF, &size);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> size=[%d] \n",size,0,0);
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> buffer=[%s]\n",(returnedBUF) ? returnedBUF : "NULL",0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> size=[%d] \n",size,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> buffer=[%s]\n",(returnedBUF) ? returnedBUF : "NULL",0,0);
 
 
 	if(status == PRESENCE_SUCCESS)
@@ -451,14 +451,14 @@ static int presence_vattr_get(vattr_sp_handle *handle,
 	}
 	
 cleanup:
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Processed ID=[%s] \n",id,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Processed ID=[%s] \n",id,0,0);
 	if (id != NULL ) {
 		slapi_ch_free((void **)&id);
 	}
 	if (returnedBUF != NULL ) {
 		PR_Free(returnedBUF);
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- presence_vattr_get \n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- presence_vattr_get \n",0,0,0);
 	return status;
 }
 
@@ -469,8 +469,8 @@ static int presence_vattr_compare(vattr_sp_handle *handle, vattr_context *c, Sla
 	/**
 	 * not yet implemented ???
 	 */
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> presence_vattr_compare \n",0,0,0);
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- presence_vattr_compare \n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> presence_vattr_compare \n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- presence_vattr_compare \n",0,0,0);
 
 	return status;
 }
@@ -482,11 +482,11 @@ static int presence_vattr_types(vattr_sp_handle *handle,Slapi_Entry *e,vattr_typ
 	args.entry = e;
 	args.context = type_context;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> presence_vattr_types\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> presence_vattr_types\n",0,0,0);
 	
 	PL_HashTableEnumerateEntries(_IdVattrMapTable, setTypes, &args);	
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- presence_vattr_types\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- presence_vattr_types\n",0,0,0);
 	return status;
 }
 
@@ -498,7 +498,7 @@ static int loadPluginConfig(void)
 	Slapi_PBlock *search_pb;
     Slapi_Entry **entries = NULL;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> loadPluginConfig\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> loadPluginConfig\n",0,0,0);
 
     search_pb = slapi_pblock_new();
 
@@ -541,7 +541,7 @@ static int loadPluginConfig(void)
 										NULL
 										);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> parseConfigEntry \n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> parseConfigEntry \n",0,0,0);
 
 	for (i = 0; (entries[i] != NULL); i++)
 	{
@@ -552,9 +552,9 @@ static int loadPluginConfig(void)
 			goto cleanup;
 		}
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- parseConfigEntry \n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- parseConfigEntry \n",0,0,0);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- loadPluginConfig\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- loadPluginConfig\n",0,0,0);
 
 cleanup:
     slapi_free_search_results_internal(search_pb);
@@ -579,7 +579,7 @@ static int parseConfigEntry(Slapi_Entry *e)
 	   */
 		return PRESENCE_FAILURE;
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> key [%s] \n",key,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> key [%s] \n",key,0,0);
 	/**
 	 * Now create the config entry which will hold all the 
 	 * attributes of a presence vendor
@@ -602,7 +602,7 @@ static int parseConfigEntry(Slapi_Entry *e)
 		toLowerCase(value);
 		PL_HashTableAdd(_IdVattrMapTable, value, map);
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> nsIMStatusText [%s] \n",value,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> nsIMStatusText [%s] \n",value,0,0);
 
 	value = slapi_entry_attr_get_charptr(e, NS_IM_STATUS_GRAPHIC);
 	if (value) {
@@ -614,35 +614,35 @@ static int parseConfigEntry(Slapi_Entry *e)
 		PL_HashTableAdd(_IdVattrMapTable, value, map);
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> nsIMStatusGraphic [%s] \n",value,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> nsIMStatusGraphic [%s] \n",value,0,0);
 
 	value = slapi_entry_attr_get_charptr(e, NS_IM_URL_TEXT);
 	if (value) {
 		entry->textURL = value;
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> nsIMURLText [%s] \n",value,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> nsIMURLText [%s] \n",value,0,0);
 
 	value = slapi_entry_attr_get_charptr(e, NS_IM_URL_GRAPHIC);
 	if (value) {
 		entry->graphicURL = value;
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> nsIMStatusGraphic [%s] \n",value,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> nsIMStatusGraphic [%s] \n",value,0,0);
 
 	value = slapi_entry_attr_get_charptr(e, NS_IM_ON_VALUE_MAP_TEXT);
 	if (value) {
 		entry->onTextMap = value;
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> nsIMOnValueMapText [%s] \n",value,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> nsIMOnValueMapText [%s] \n",value,0,0);
 
 	value = slapi_entry_attr_get_charptr(e, NS_IM_OFF_VALUE_MAP_TEXT);
 	if (value) {
 		entry->offTextMap = value;
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> nsIMOffValueMapText [%s] \n",value,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> nsIMOffValueMapText [%s] \n",value,0,0);
 
 	/**
 	 * Next 3 are binary syntax types so needs special handling
@@ -670,20 +670,20 @@ static int parseConfigEntry(Slapi_Entry *e)
 		entry->requestMethod = value;
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> nsIMRequestMethod [%s] \n",value,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> nsIMRequestMethod [%s] \n",value,0,0);
 
 	value = slapi_entry_attr_get_charptr(e, NS_IM_URL_TEXT_RETURN_TYPE);
 	if (value) {
 		entry->textReturnType = value;
 	}
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> nsIMURLTextReturnType [%s] \n",value,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> nsIMURLTextReturnType [%s] \n",value,0,0);
 
 	value = slapi_entry_attr_get_charptr(e, NS_IM_URL_GRAPHIC_RETURN_TYPE);
 	if (value) {
 		entry->graphicReturnType = value;
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> nsIMURLGraphicReturnType [%s] \n",value,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> nsIMURLGraphicReturnType [%s] \n",value,0,0);
 
 	/**
 	 * Finally add the entry to the map table
@@ -705,8 +705,8 @@ static int imIDExists(Slapi_Entry *e, char *type, char **value, _Vmap **map, _Co
 	_ConfigEntry *tEntry = NULL;
 	_Vmap *tMap = NULL;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> imIDExists \n",0,0,0);	
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Type [%s] \n",type,0,0);	
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> imIDExists \n",0,0,0);	
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Type [%s] \n",type,0,0);	
 
 	/**
 	 * The public function PL_HashTableLookup modifies the 
@@ -739,14 +739,14 @@ static int imIDExists(Slapi_Entry *e, char *type, char **value, _Vmap **map, _Co
 		status = PRESENCE_FAILURE;
 		goto bail;
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Value [%s] \n",tValue,0,0);	
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Value [%s] \n",tValue,0,0);	
 
 	tEntry = PL_HashTableLookupConst(_IdConfigMapTable, tMap->imID);
 	*value	= tValue;
 	*entry	= tEntry;
 	*map	= tMap;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- imIDExists \n",0,0,0);	
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- imIDExists \n",0,0,0);	
 
 bail:
 	return status;
@@ -760,7 +760,7 @@ static int makeHttpRequest(char *id, _Vmap *map, _ConfigEntry *info, char **BUF,
 	char *urltosend = NULL;
 	int bytesRead;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> makeHttpRequest:: \n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> makeHttpRequest:: \n",0,0,0);
 
 	if (map->syntax == PRESENCE_STRING) {
 		url = info->textURL;
@@ -773,14 +773,14 @@ static int makeHttpRequest(char *id, _Vmap *map, _ConfigEntry *info, char **BUF,
 	}
 	urltosend = replaceIdWithValue(url, map->imID, id);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> URL [%s] \n",urltosend,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> URL [%s] \n",urltosend,0,0);
 	/**
 	 * make an actual HTTP call now
 	 */
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> RequestMethod [%s] \n", info->requestMethod,0,0);
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Syntax [%d] \n", map->syntax,0,0);
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> TextReturnType [%s] \n", info->textReturnType,0,0);
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> GraphicReturnType [%s] \n", info->graphicReturnType,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> RequestMethod [%s] \n", info->requestMethod,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Syntax [%d] \n", map->syntax,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> TextReturnType [%s] \n", info->textReturnType,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> GraphicReturnType [%s] \n", info->graphicReturnType,0,0);
 	if (!strcasecmp(info->requestMethod, PRESENCE_REQUEST_METHOD_GET)) {
 		if (map->syntax == PRESENCE_STRING) {
 			if (!strcasecmp(info->textReturnType, PRESENCE_TEXT_RETURN_TYPE)) {
@@ -817,7 +817,7 @@ static int makeHttpRequest(char *id, _Vmap *map, _ConfigEntry *info, char **BUF,
 	}
 
 bail:
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- makeHttpRequest:: <%d>\n",status,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- makeHttpRequest:: <%d>\n",status,0,0);
 
 	slapi_ch_free((void**)&urltosend);
 	return status;
@@ -889,7 +889,7 @@ static int setIMStatus(char *id, _Vmap *map, _ConfigEntry *info,
 	Slapi_Attr *attr = NULL;
 	const struct berval *tmp = NULL;
 	
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> setIMStatus \n", 0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> setIMStatus \n", 0,0,0);
 	/**
 	 * we got some data back so lets try to map it to 
 	 * the existing set of on/off data
@@ -932,15 +932,15 @@ static int setIMStatus(char *id, _Vmap *map, _ConfigEntry *info,
 			bval.bv_val = returnedBUF;
 			value1 = slapi_value_new_berval(&bval);
 
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> returned size  [%d] \n", bval.bv_len,0,0);
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> returned value [%s] \n", bval.bv_val,0,0);
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> returned size  [%d] \n", bval.bv_len,0,0);
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> returned value [%s] \n", bval.bv_val,0,0);
 			
 			attr = info->onGraphicMap;
 			if (attr) {
 				slapi_attr_first_value(attr, &value2);
 				tmp = slapi_value_get_berval(value2);
-				LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Stored size  [%d] \n", tmp->bv_len,0,0);
-				LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> Stored value [%s] \n", tmp->bv_val,0,0);
+				LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Stored size  [%d] \n", tmp->bv_len,0,0);
+				LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> Stored value [%s] \n", tmp->bv_val,0,0);
 				if (!slapi_value_compare(attr, value1, value2)) {
 					value = slapi_value_new_string(PRESENCE_RETURNED_ON_TEXT);
 				}
@@ -973,7 +973,7 @@ static int setIMStatus(char *id, _Vmap *map, _ConfigEntry *info,
 		   */
 			value = slapi_value_new_string(PRESENCE_RETURNED_ERROR_TEXT);
 		}
-		LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> value [%s] \n", returnedBUF,0,0);
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> value [%s] \n", returnedBUF,0,0);
 	} else {
 	  /**
 		* we had send a request for image
@@ -981,7 +981,7 @@ static int setIMStatus(char *id, _Vmap *map, _ConfigEntry *info,
 		* return instead of analyzing it
 		*/
 		if (!strcasecmp(info->graphicReturnType, PRESENCE_TEXT_RETURN_TYPE)) {
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> value [%s] \n", returnedBUF,0,0);
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> value [%s] \n", returnedBUF,0,0);
 			if (!strcasecmp(info->requestMethod, PRESENCE_REQUEST_METHOD_REDIRECT)) {
 			  /**
 			   * a redirect case in which we should probably have a 
@@ -1016,7 +1016,7 @@ static int setIMStatus(char *id, _Vmap *map, _ConfigEntry *info,
 			   */
 			}
 		} else {
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> value [%s] \n", returnedBUF,0,0);
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> value [%s] \n", returnedBUF,0,0);
 			bval.bv_len = size;
 			bval.bv_val = returnedBUF;
 			value = slapi_value_new_berval(&bval);
@@ -1037,7 +1037,7 @@ static int setIMStatus(char *id, _Vmap *map, _ConfigEntry *info,
 	if (value && map->syntax == PRESENCE_STRING) {
 		slapi_value_free(&value);
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- setIMStatus \n", 0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- setIMStatus \n", 0,0,0);
 	
 	return status;
 }
@@ -1056,7 +1056,7 @@ static int setTypes(PLHashEntry *he, PRIntn i, void *arg)
 	_Vmap *map  = (_Vmap *)he->value;
 	char *id = map->imID;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "--> setTypes \n", 0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "--> setTypes \n", 0,0,0);
 
 	status = slapi_vattr_values_get_sp(NULL, args->entry, id, &results, &type_name_disposition, &actual_type_name, 0, &free_flags);
 	if(status == PRESENCE_SUCCESS)
@@ -1071,9 +1071,9 @@ static int setTypes(PLHashEntry *he, PRIntn i, void *arg)
 
 		slapi_vattr_values_free(&results, &actual_type_name, free_flags);
 
-		LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> ID [%s] Type[%s]\n", actual_type_name,type,0);
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> ID [%s] Type[%s]\n", actual_type_name,type,0);
 	}
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<-- setTypes \n", 0,0,0);
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<-- setTypes \n", 0,0,0);
 
 	return HT_ENUMERATE_NEXT;
 }
@@ -1091,14 +1091,14 @@ logGraphicAttributeValue( Slapi_Attr *attr, const char *attrname )
 		if (v) {
 			char	*ldifvalue;
 
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> %s size [%d] \n",
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> %s size [%d] \n",
 					attrname,v->bv_len,0);
 
 			ldifvalue = ldif_type_and_value_with_options(
 					(char *)attrname,	/* XXX: had to cast away const */
 					v->bv_val, v->bv_len, 0 );
 			if ( NULL != ldifvalue ) {
-				LDAPDebug( LDAP_DEBUG_PLUGIN, "----------> %s value [\n%s]\n",
+				LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "----------> %s value [\n%s]\n",
 						attrname,ldifvalue,0);
 				slapi_ch_free_string( &ldifvalue );
 			}
diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c
index 1ac753d..1af6267 100644
--- a/ldap/servers/plugins/replication/windows_connection.c
+++ b/ldap/servers/plugins/replication/windows_connection.c
@@ -120,7 +120,7 @@ windows_conn_new(Repl_Agmt *agmt)
 {
 	Repl_Connection *rpc;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_new\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_new\n", 0, 0, 0 );
 
 	rpc = (Repl_Connection *)slapi_ch_malloc(sizeof(repl_connection));
 	if ((rpc->lock = PR_NewLock()) == NULL)
@@ -153,12 +153,12 @@ windows_conn_new(Repl_Agmt *agmt)
 	rpc->timeout.tv_usec = 0;
 	rpc->flag_agmt_changed = 0;
 	rpc->plain = NULL;
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_new\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_new\n", 0, 0, 0 );
 	return rpc;
 loser:
 	windows_conn_delete(rpc);
 	slapi_ch_free((void**)&rpc);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_new - loser\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_new - loser\n", 0, 0, 0 );
 	return NULL;
 }
 
@@ -170,11 +170,11 @@ static PRBool
 windows_conn_connected(Repl_Connection *conn)
 {
 	PRBool return_value;
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_connected\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_connected\n", 0, 0, 0 );
 	PR_Lock(conn->lock);
 	return_value = STATE_CONNECTED == conn->state;
 	PR_Unlock(conn->lock);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_connected\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_connected\n", 0, 0, 0 );
 	return return_value;
 }
 
@@ -185,14 +185,14 @@ windows_conn_connected(Repl_Connection *conn)
 static void
 windows_conn_delete_internal(Repl_Connection *conn)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_delete_internal\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_delete_internal\n", 0, 0, 0 );
 	PR_ASSERT(NULL != conn);
 	close_connection_internal(conn);
 	/* slapi_ch_free accepts NULL pointer */
 	slapi_ch_free((void **)&conn->hostname);
 	slapi_ch_free((void **)&conn->binddn);
 	slapi_ch_free((void **)&conn->plain);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_delete_internal\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_delete_internal\n", 0, 0, 0 );
 }
 
 /*
@@ -204,7 +204,7 @@ windows_conn_delete(Repl_Connection *conn)
 {
 	PRBool destroy_it = PR_FALSE;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_delete\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_delete\n", 0, 0, 0 );
 
 	PR_ASSERT(NULL != conn);
 	PR_Lock(conn->lock);
@@ -231,7 +231,7 @@ windows_conn_delete(Repl_Connection *conn)
 	{
 		windows_conn_delete_internal(conn);
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_delete\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_delete\n", 0, 0, 0 );
 }
 
 
@@ -242,22 +242,22 @@ windows_conn_delete(Repl_Connection *conn)
 void
 windows_conn_get_error(Repl_Connection *conn, int *operation, int *error)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_get_error\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_get_error\n", 0, 0, 0 );
 	PR_Lock(conn->lock);
 	*operation = conn->last_operation;
 	*error = conn->last_ldap_error;
 	PR_Unlock(conn->lock);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_get_error\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_get_error\n", 0, 0, 0 );
 }
 
 void
 windows_conn_set_error(Repl_Connection *conn, int error)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_set_error\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_set_error\n", 0, 0, 0 );
 	PR_Lock(conn->lock);
 	conn->last_ldap_error = error;
 	PR_Unlock(conn->lock);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_set_error\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_set_error\n", 0, 0, 0 );
 }
 
 /*
@@ -286,7 +286,7 @@ windows_perform_operation(Repl_Connection *conn, int optype, const char *dn,
 	const char *op_string = NULL;
 	const char *extra_op_string = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_perform_operation\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_perform_operation\n", 0, 0, 0 );
 
 	if (windows_conn_connected(conn))
 	{
@@ -490,7 +490,7 @@ windows_perform_operation(Repl_Connection *conn, int optype, const char *dn,
 		 */
 		return_value = CONN_NOT_CONNECTED;
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_perform_operation\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_perform_operation\n", 0, 0, 0 );
 	return return_value;
 }
 
@@ -695,10 +695,10 @@ windows_search_entry_ext(Repl_Connection *conn, char* searchbase, char *filter,
 {
 	ConnResult return_value = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_search_entry\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_search_entry\n", 0, 0, 0 );
 
 	if (!entry) {
-		LDAPDebug( LDAP_DEBUG_ANY, "windows_search_entry: NULL entry\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "windows_search_entry: NULL entry\n", 0, 0, 0 );
 		return_value = CONN_LOCAL_ERROR; /* entry should never == NULL here */
 		goto done;
 	}
@@ -717,7 +717,7 @@ windows_search_entry_ext(Repl_Connection *conn, char* searchbase, char *filter,
 
 		slapi_add_controls(&serverctrls_copy, serverctrls, 1 /* make a copy we can free */);
 
-		LDAPDebug( LDAP_DEBUG_REPL, "Calling windows entry search request plugin\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_REPL, LOG_DEBUG, "Calling windows entry search request plugin\n", 0, 0, 0 );
 
 		winsync_plugin_call_pre_ad_search_cb(conn->agmt, NULL, &searchbase_copy, &scope, &filter_copy,
 											 &attrs, &serverctrls_copy);
@@ -748,7 +748,7 @@ next:
 				nummessages = ldap_count_messages(conn->ld, res);
 				numentries = ldap_count_entries(conn->ld, res);
 				numreferences = ldap_count_references(conn->ld, res);
-				LDAPDebug( LDAP_DEBUG_REPL, "windows_search_entry: received %d messages, %d entries, %d references\n",
+				LDAPDebug(LDAP_DEBUG_REPL, LOG_DEBUG, "windows_search_entry: received %d messages, %d entries, %d references\n",
                                    nummessages, numentries, numreferences );
 			}
 
@@ -797,7 +797,7 @@ next:
 		return_value = CONN_NOT_CONNECTED;
 	}
 done:
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_search_entry\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_search_entry\n", 0, 0, 0 );
 	return return_value;
 }
 
@@ -806,7 +806,7 @@ send_dirsync_search(Repl_Connection *conn)
 {
 	ConnResult return_value;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> send_dirsync_search\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> send_dirsync_search\n", 0, 0, 0 );
 	
 	if (windows_conn_connected(conn))
 	{
@@ -836,7 +836,7 @@ send_dirsync_search(Repl_Connection *conn)
 		conn->status = STATUS_SEARCHING;
 		op_string = "search";
 
-		LDAPDebug( LDAP_DEBUG_REPL, "Calling dirsync search request plugin\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_REPL, LOG_DEBUG, "Calling dirsync search request plugin\n", 0, 0, 0 );
 		userfilter = windows_private_get_windows_userfilter(conn->agmt);
 		if (userfilter) {
 			filter = slapi_ch_strdup(userfilter);
@@ -846,7 +846,7 @@ send_dirsync_search(Repl_Connection *conn)
 
 		winsync_plugin_call_dirsync_search_params_cb(conn->agmt, old_dn, &dn, &scope, &filter,
 		                                             &attrs, &server_controls);
-		LDAPDebug( LDAP_DEBUG_REPL, "Sending dirsync search request\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_REPL, LOG_DEBUG, "Sending dirsync search request\n", 0, 0, 0 );
 
 		rc = ldap_search_ext( conn->ld, dn, scope, filter, attrs, PR_FALSE, server_controls,
                               NULL /* ClientControls */, 0,0, &msgid);
@@ -889,7 +889,7 @@ send_dirsync_search(Repl_Connection *conn)
 		 */
 		return_value = CONN_NOT_CONNECTED;
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= send_dirsync_search\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= send_dirsync_search\n", 0, 0, 0 );
 	return return_value;
 }
 
@@ -902,12 +902,12 @@ windows_conn_send_add(Repl_Connection *conn, const char *dn, LDAPMod **attrs,
 	LDAPControl **server_controls, LDAPControl ***returned_controls)
 {
 	ConnResult res = 0;
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_send_add\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_send_add\n", 0, 0, 0 );
 	res = windows_perform_operation(conn, CONN_ADD, dn, attrs, NULL /* newrdn */,
 		NULL /* newparent */, 0 /* deleteoldrdn */, server_controls,
 		NULL /* extop OID */, NULL /* extop payload */, NULL /* retoidp */,
 		NULL /* retdatap */, returned_controls);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_send_add\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_send_add\n", 0, 0, 0 );
 	return res;
 }
 
@@ -919,8 +919,8 @@ ConnResult
 windows_conn_send_delete(Repl_Connection *conn, const char *dn,
 	LDAPControl **server_controls, LDAPControl ***returned_controls)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_send_delete\n", 0, 0, 0 );
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_send_delete\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_send_delete\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_send_delete\n", 0, 0, 0 );
 	return windows_perform_operation(conn, CONN_DELETE, dn, NULL /* attrs */,
 		NULL /* newrdn */, NULL /* newparent */, 0 /* deleteoldrdn */,
 		server_controls, NULL /* extop OID */, NULL /* extop payload */,
@@ -935,8 +935,8 @@ ConnResult
 windows_conn_send_modify(Repl_Connection *conn, const char *dn, LDAPMod **mods,
 	LDAPControl **server_controls, LDAPControl ***returned_controls)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_send_modify\n", 0, 0, 0 );
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_send_modify\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_send_modify\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_send_modify\n", 0, 0, 0 );
 	return windows_perform_operation(conn, CONN_MODIFY, dn, mods, NULL /* newrdn */,
 		NULL /* newparent */, 0 /* deleteoldrdn */, server_controls,
 		NULL /* extop OID */, NULL /* extop payload */, NULL /* retoidp */,
@@ -951,8 +951,8 @@ windows_conn_send_rename(Repl_Connection *conn, const char *dn,
 	const char *newrdn, const char *newparent, int deleteoldrdn,
 	LDAPControl **server_controls, LDAPControl ***returned_controls)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_send_rename\n", 0, 0, 0 );
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_send_rename\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_send_rename\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_send_rename\n", 0, 0, 0 );
 	return windows_perform_operation(conn, CONN_RENAME, dn, NULL /* attrs */,
 		newrdn, newparent, deleteoldrdn, server_controls,
 		NULL /* extop OID */, NULL /* extop payload */, NULL /* retoidp */,
@@ -971,7 +971,7 @@ Slapi_Entry * windows_conn_get_search_result(Repl_Connection *conn)
 	LDAPMessage *lm = NULL;
 	char *dn = "";
 	
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_get_search_result\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_get_search_result\n", 0, 0, 0 );
 
 	if (windows_conn_connected(conn))
 	{
@@ -1026,7 +1026,7 @@ Slapi_Entry * windows_conn_get_search_result(Repl_Connection *conn)
 		res = NULL;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_get_search_result\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_get_search_result\n", 0, 0, 0 );
 	return e;
 }
 
@@ -1039,8 +1039,8 @@ windows_conn_send_extended_operation(Repl_Connection *conn, const char *extop_oi
 	struct berval *payload, char **retoidp, struct berval **retdatap,
 	LDAPControl **server_controls, LDAPControl ***returned_controls)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_send_extended_operation\n", 0, 0, 0 );
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_send_extended_operation\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_send_extended_operation\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_send_extended_operation\n", 0, 0, 0 );
 	return windows_perform_operation(conn, CONN_EXTENDED_OPERATION, NULL /* dn */, NULL /* attrs */,
 		NULL /* newrdn */, NULL /* newparent */,  0 /* deleteoldrdn */,
 		server_controls, extop_oid, payload, retoidp, retdatap,
@@ -1067,7 +1067,7 @@ windows_conn_read_entry_attribute(Repl_Connection *conn, const char *dn,
 	LDAPMessage *res = NULL;
 	char *attrs[2];
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_read_entry_attribute\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_read_entry_attribute\n", 0, 0, 0 );
 
 	PR_ASSERT(NULL != type);
 	if (windows_conn_connected(conn))
@@ -1109,7 +1109,7 @@ windows_conn_read_entry_attribute(Repl_Connection *conn, const char *dn,
 	{
 		return_value = CONN_NOT_CONNECTED;
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_read_entry_attribute\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_read_entry_attribute\n", 0, 0, 0 );
 	return return_value;
 }
 
@@ -1121,8 +1121,8 @@ windows_conn_read_entry_attribute(Repl_Connection *conn, const char *dn,
 const char *
 windows_conn_get_status(Repl_Connection *conn)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_get_status\n", 0, 0, 0 );
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_get_status\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_get_status\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_get_status\n", 0, 0, 0 );
 	return conn->status;
 }
 
@@ -1135,7 +1135,7 @@ windows_conn_get_status(Repl_Connection *conn)
 void
 windows_conn_cancel_linger(Repl_Connection *conn)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_cancel_linger\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_cancel_linger\n", 0, 0, 0 );
 	PR_ASSERT(NULL != conn);
 	PR_Lock(conn->lock);
 	if (conn->linger_active)
@@ -1158,7 +1158,7 @@ windows_conn_cancel_linger(Repl_Connection *conn)
 			agmt_get_long_name(conn->agmt));
 	}
 	PR_Unlock(conn->lock);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_cancel_linger\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_cancel_linger\n", 0, 0, 0 );
 }
 
 
@@ -1174,7 +1174,7 @@ linger_timeout(time_t event_time, void *arg)
 	PRBool delete_now;
 	Repl_Connection *conn = (Repl_Connection *)arg;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> linger_timeout\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> linger_timeout\n", 0, 0, 0 );
 
 	PR_ASSERT(NULL != conn);
 	slapi_log_error(SLAPI_LOG_REPL, LOG_DEBUG, windows_repl_plugin_name,
@@ -1193,7 +1193,7 @@ linger_timeout(time_t event_time, void *arg)
 	{
 		windows_conn_delete_internal(conn);
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= linger_timeout\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= linger_timeout\n", 0, 0, 0 );
 }
 
 
@@ -1206,7 +1206,7 @@ windows_conn_start_linger(Repl_Connection *conn)
 {
 	time_t now;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_start_linger\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_start_linger\n", 0, 0, 0 );
 
 	PR_ASSERT(NULL != conn);
 	slapi_log_error(SLAPI_LOG_REPL, LOG_DEBUG, windows_repl_plugin_name,
@@ -1234,7 +1234,7 @@ windows_conn_start_linger(Repl_Connection *conn)
 		conn->status = STATUS_LINGERING;
 	}
 	PR_Unlock(conn->lock);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_start_linger\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_start_linger\n", 0, 0, 0 );
 }
 
 
@@ -1257,7 +1257,7 @@ windows_conn_connect(Repl_Connection *conn)
 	ConnResult return_value = CONN_OPERATION_SUCCESS;
 	int pw_ret = 1;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_connect\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_connect\n", 0, 0, 0 );
 
 	/** Connection already open just return SUCCESS **/
 	if(conn->state == STATE_CONNECTED) {
@@ -1408,7 +1408,7 @@ windows_conn_connect(Repl_Connection *conn)
 		{
 			/* We assume that a server that doesn't support dirsync is our NT4 LDAP service */
 			windows_private_set_isnt4(conn->agmt,1);
-			LDAPDebug( LDAP_DEBUG_REPL, "windows_conn_connect : detected NT4 peer\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_REPL, LOG_DEBUG, "windows_conn_connect : detected NT4 peer\n", 0, 0, 0 );
 		} else 
 		{
 			windows_private_set_isnt4(conn->agmt,0);
@@ -1418,7 +1418,7 @@ windows_conn_connect(Repl_Connection *conn)
 		if (CONN_IS_WIN2K3 == supports)
 		{
 			windows_private_set_iswin2k3(conn->agmt,1);
-			LDAPDebug( LDAP_DEBUG_REPL, "windows_conn_connect : detected Win2k3 or later peer\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_REPL, LOG_DEBUG, "windows_conn_connect : detected Win2k3 or later peer\n", 0, 0, 0 );
 		} else
 		{
 			windows_private_set_iswin2k3(conn->agmt,0);
@@ -1442,7 +1442,7 @@ done:
 		creds = NULL;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_connect\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_connect\n", 0, 0, 0 );
 	return return_value;
 }
 
@@ -1450,7 +1450,7 @@ done:
 static void
 close_connection_internal(Repl_Connection *conn)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> close_connection_internal\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> close_connection_internal\n", 0, 0, 0 );
 
 	if (NULL != conn->ld)
 	{
@@ -1464,18 +1464,18 @@ close_connection_internal(Repl_Connection *conn)
 	conn->supports_ds50_repl = -1;
 	slapi_log_error(SLAPI_LOG_REPL, LOG_DEBUG, windows_repl_plugin_name,
 		"%s: Disconnected from the consumer\n", agmt_get_long_name(conn->agmt));
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= close_connection_internal\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= close_connection_internal\n", 0, 0, 0 );
 }
 
 void
 windows_conn_disconnect(Repl_Connection *conn)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_disconnect\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_disconnect\n", 0, 0, 0 );
 	PR_ASSERT(NULL != conn);
 	PR_Lock(conn->lock);
 	close_connection_internal(conn);
 	PR_Unlock(conn->lock);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_disconnect\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_disconnect\n", 0, 0, 0 );
 }
 
 
@@ -1495,7 +1495,7 @@ windows_conn_replica_supports_ds5_repl(Repl_Connection *conn)
 	ConnResult return_value;
 	int ldap_rc;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_replica_supports_ds5_repl\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_replica_supports_ds5_repl\n", 0, 0, 0 );
 
 	if (windows_conn_connected(conn))
 	{
@@ -1564,7 +1564,7 @@ windows_conn_replica_supports_ds5_repl(Repl_Connection *conn)
 		/* Not connected */
 		return_value = CONN_NOT_CONNECTED;
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_replica_supports_ds5_repl\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_replica_supports_ds5_repl\n", 0, 0, 0 );
 	return return_value;
 }
 
@@ -1575,7 +1575,7 @@ windows_conn_replica_supports_dirsync(Repl_Connection *conn)
 	ConnResult return_value;
 	int ldap_rc;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_replica_supports_dirsync\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_replica_supports_dirsync\n", 0, 0, 0 );
 
 	if (getenv("WINSYNC_USE_DS")) {
 		/* used to fake out dirsync to think it's talking to a real ad when in fact
@@ -1636,7 +1636,7 @@ windows_conn_replica_supports_dirsync(Repl_Connection *conn)
 		/* Not connected */
 		return_value = CONN_NOT_CONNECTED;
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_replica_supports_dirsync\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_replica_supports_dirsync\n", 0, 0, 0 );
 	return return_value;
 }
 
@@ -1648,7 +1648,7 @@ windows_conn_replica_is_win2k3(Repl_Connection *conn)
         ConnResult return_value;
         int ldap_rc;
 
-        LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_replica_is_win2k3\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_replica_is_win2k3\n", 0, 0, 0 );
 
         if (windows_conn_connected(conn))
         {
@@ -1702,7 +1702,7 @@ windows_conn_replica_is_win2k3(Repl_Connection *conn)
                 /* Not connected */
                 return_value = CONN_NOT_CONNECTED;
         }
-        LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_replica_is_win2k3\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_replica_is_win2k3\n", 0, 0, 0 );
         return return_value;
 }
 
@@ -1718,7 +1718,7 @@ attribute_string_value_present(LDAP *ld, LDAPMessage *entry, const char *type,
 	int return_value = 0;
 	ber_len_t vallen;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> attribute_string_value_present\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> attribute_string_value_present\n", 0, 0, 0 );
 
 	if (NULL != entry)
 	{
@@ -1754,7 +1754,7 @@ attribute_string_value_present(LDAP *ld, LDAPMessage *entry, const char *type,
 		if (NULL != atype)
 			ldap_memfree(atype);
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= attribute_string_value_present\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= attribute_string_value_present\n", 0, 0, 0 );
 	return return_value;
 }
 
@@ -1778,24 +1778,24 @@ attribute_string_value_present(LDAP *ld, LDAPMessage *entry, const char *type,
 void
 windows_conn_set_timeout(Repl_Connection *conn, long timeout)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_set_timeout\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_set_timeout\n", 0, 0, 0 );
 	PR_ASSERT(NULL != conn);
 	PR_ASSERT(timeout >= 0);
 	PR_Lock(conn->lock);
 	conn->timeout.tv_sec = timeout;
 	PR_Unlock(conn->lock);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_set_timeout\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_set_timeout\n", 0, 0, 0 );
 }
 
 void windows_conn_set_agmt_changed(Repl_Connection *conn)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_conn_set_agmt_changed\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_conn_set_agmt_changed\n", 0, 0, 0 );
 	PR_ASSERT(NULL != conn);
 	PR_Lock(conn->lock);
 	if (NULL != conn->agmt)
 		conn->flag_agmt_changed = 1;
 	PR_Unlock(conn->lock);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_conn_set_agmt_changed\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_conn_set_agmt_changed\n", 0, 0, 0 );
 }
 
 static const char *
@@ -1833,7 +1833,7 @@ bind_and_check_pwp(Repl_Connection *conn, char * binddn, char *password)
 	int			rc;
 	const char  *mech = bind_method_to_mech(conn->bindmethod);
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> bind_and_check_pwp\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> bind_and_check_pwp\n", 0, 0, 0 );
 
 	rc = slapi_ldap_bind(conn->ld, binddn, password, mech, NULL,
 						 &ctrls, NULL, NULL);
@@ -1879,7 +1879,7 @@ bind_and_check_pwp(Repl_Connection *conn, char * binddn, char *password)
 			ldap_controls_free( ctrls );
 		}
 
-		LDAPDebug( LDAP_DEBUG_TRACE, "<= bind_and_check_pwp - CONN_OPERATION_SUCCESS\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= bind_and_check_pwp - CONN_OPERATION_SUCCESS\n", 0, 0, 0 );
 
 		return (CONN_OPERATION_SUCCESS);
 	}
@@ -1910,7 +1910,7 @@ bind_and_check_pwp(Repl_Connection *conn, char * binddn, char *password)
 							ldap_err2string(rc), errmsg);
 		}
 
-		LDAPDebug( LDAP_DEBUG_TRACE, "<= bind_and_check_pwp - CONN_OPERATION_FAILED\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= bind_and_check_pwp - CONN_OPERATION_FAILED\n", 0, 0, 0 );
 		return (CONN_OPERATION_FAILED);
 	}
 }
@@ -1974,7 +1974,7 @@ do_simple_bind (Repl_Connection *conn, LDAP *ld, char * binddn, char *password)
 {
 	int msgid;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> do_simple_bind\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> do_simple_bind\n", 0, 0, 0 );
 
 	if( LDAP_SUCCESS != slapi_ldap_bind( ld, binddn, password, LDAP_SASL_SIMPLE, NULL, NULL, NULL, &msgid ) ) 
 	{
@@ -2004,7 +2004,7 @@ do_simple_bind (Repl_Connection *conn, LDAP *ld, char * binddn, char *password)
 			"%s: Simple bind resumed\n",
 			agmt_get_long_name(conn->agmt));
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= do_simple_bind\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= do_simple_bind\n", 0, 0, 0 );
 	return msgid;
 }
 
@@ -2014,14 +2014,14 @@ repl5_start_debug_timeout(int *setlevel)
 {
 	Slapi_Eq_Context eqctx = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> repl5_start_debug_timeout\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> repl5_start_debug_timeout\n", 0, 0, 0 );
 
 	if (s_debug_timeout && s_debug_level) {
 		time_t now = time(NULL);
 		eqctx = slapi_eq_once(repl5_debug_timeout_callback, setlevel,
 							  s_debug_timeout + now);
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= repl5_start_debug_timeout\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= repl5_start_debug_timeout\n", 0, 0, 0 );
 	return eqctx;
 }
 
@@ -2030,7 +2030,7 @@ repl5_stop_debug_timeout(Slapi_Eq_Context eqctx, int *setlevel)
 {
 	char buf[20];
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> repl5_stop_debug_timeout\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> repl5_stop_debug_timeout\n", 0, 0, 0 );
 
 	if (eqctx && !*setlevel) {
 		(void)slapi_eq_cancel(eqctx);
@@ -2042,7 +2042,7 @@ repl5_stop_debug_timeout(Slapi_Eq_Context eqctx, int *setlevel)
 		config_set_errorlog_level("nsslapd-errorlog-level", buf, NULL, 1);
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= repl5_stop_debug_timeout\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= repl5_stop_debug_timeout\n", 0, 0, 0 );
 }
 
 static void
@@ -2052,7 +2052,7 @@ repl5_debug_timeout_callback(time_t when, void *arg)
 	/* No longer needed as we are including the one in slap.h */
 	char buf[20];
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> repl5_debug_timeout_callback\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> repl5_debug_timeout_callback\n", 0, 0, 0 );
 
 	*setlevel = 1;
 	sprintf(buf, "%d", s_debug_level);
@@ -2062,5 +2062,5 @@ repl5_debug_timeout_callback(time_t when, void *arg)
 		"repl5_debug_timeout_callback: set debug level to %d at %ld\n",
 		s_debug_level, when);
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= repl5_debug_timeout_callback\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= repl5_debug_timeout_callback\n", 0, 0, 0 );
 }
diff --git a/ldap/servers/plugins/replication/windows_private.c b/ldap/servers/plugins/replication/windows_private.c
index 28364e4..f8f433a 100644
--- a/ldap/servers/plugins/replication/windows_private.c
+++ b/ldap/servers/plugins/replication/windows_private.c
@@ -1698,7 +1698,7 @@ windows_plugin_callonce(void)
             int idx;
             for (idx = 0; theapis && theapis[idx]; ++idx) {
                 if (windows_plugin_add(theapis[idx], maxapi)) {
-                    LDAPDebug(LDAP_DEBUG_PLUGIN,
+                    LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG,
                               "<-- windows_plugin_callonce -- already added windows plugin API "
                               "[%d][0x%p] for GUID [%s] -- end\n",
                               idx, theapis[idx], guid);
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
index 603ce8e..2f8c2e7 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -260,7 +260,7 @@ windows_ignore_error_and_keep_going(int error)
 {
 	int return_value = PR_FALSE;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_ignore_error_and_keep_going\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_ignore_error_and_keep_going\n", 0, 0, 0 );
 
 	switch (error)
 	{
@@ -331,15 +331,15 @@ windows_ignore_error_and_keep_going(int error)
 		return_value = PR_FALSE;
 		break;
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_ignore_error_and_keep_going\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_ignore_error_and_keep_going\n", 0, 0, 0 );
 	return return_value;
 }
 
 static const char*
 op2string(int op)
 {
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> op2string\n", 0, 0, 0 );
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= op2string\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> op2string\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= op2string\n", 0, 0, 0 );
 	switch (op) {
 	case SLAPI_OPERATION_ADD:
 		return "add";
@@ -581,7 +581,7 @@ windows_acquire_replica(Private_Repl_Protocol *prp, RUV **ruv, int check_ruv)
 	PRBool is_newer = PR_FALSE;
 	RUV *r = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_acquire_replica\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_acquire_replica\n", 0, 0, 0 );
 
 	if (NULL == ruv)
 	{
@@ -597,7 +597,7 @@ windows_acquire_replica(Private_Repl_Protocol *prp, RUV **ruv, int check_ruv)
         slapi_log_error(SLAPI_LOG_FATAL, LOG_ERR, windows_repl_plugin_name,
 						"%s: Remote replica already acquired\n",
 						agmt_get_long_name(prp->agmt));
-		LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_acquire_replica\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_acquire_replica\n", 0, 0, 0 );
         return ACQUIRE_SUCCESS;
     }
 
@@ -636,7 +636,7 @@ windows_acquire_replica(Private_Repl_Protocol *prp, RUV **ruv, int check_ruv)
 	/* Once we get here we have a valid ruv */
  	if (is_newer == PR_FALSE && check_ruv) { 
  		prp->last_acquire_response_code = NSDS50_REPL_UPTODATE;
-		LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_acquire_replica - ACQUIRE_CONSUMER_WAS_UPTODATE\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_acquire_replica - ACQUIRE_CONSUMER_WAS_UPTODATE\n", 0, 0, 0 );
  		return ACQUIRE_CONSUMER_WAS_UPTODATE; 
  	} 
 
@@ -705,7 +705,7 @@ windows_acquire_replica(Private_Repl_Protocol *prp, RUV **ruv, int check_ruv)
         prp->replica_acquired = PR_TRUE;
     }
 done:
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_acquire_replica\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_acquire_replica\n", 0, 0, 0 );
 
 	return return_value;
 }
@@ -713,7 +713,7 @@ done:
 void
 windows_release_replica(Private_Repl_Protocol *prp)
 {
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_release_replica\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_release_replica\n", 0, 0, 0 );
 
   PR_ASSERT(NULL != prp);
   PR_ASSERT(NULL != prp->conn);
@@ -725,7 +725,7 @@ windows_release_replica(Private_Repl_Protocol *prp)
 
   prp->replica_acquired = PR_FALSE;
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_release_replica\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_release_replica\n", 0, 0, 0 );
 
 }
 
@@ -1545,7 +1545,7 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op
 	Slapi_Entry *local_entry = NULL;
 	Slapi_Entry *remote_entry = NULL;
 		
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_replay_update\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_replay_update\n", 0, 0, 0 );
 
 	local_dn = slapi_sdn_dup( op->target_address.sdn );
 
@@ -2039,7 +2039,7 @@ windows_create_remote_entry(Private_Repl_Protocol *prp,Slapi_Entry *original_ent
 		"objectclass:top\n"
 		"objectclass:group\n";
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_create_remote_entry\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_create_remote_entry\n", 0, 0, 0 );
 
 	if (NULL == password) {
 		retval = LDAP_PARAM_ERROR;
@@ -2286,7 +2286,7 @@ error:
 	{
 		windows_dump_entry("Created new remote entry:\n",new_entry);
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_create_remote_entry: %d\n", retval, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_create_remote_entry: %d\n", retval, 0, 0 );
 	return retval;
 }
 
@@ -2301,12 +2301,12 @@ windows_entry_already_exists(Slapi_Entry *e){
 	Slapi_DN *sdn = NULL;
 	Slapi_Entry *entry = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_entry_already_exists\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_entry_already_exists\n", 0, 0, 0 );
 
 	sdn = slapi_entry_get_sdn(e);
 	rc  = slapi_search_internal_get_entry( sdn, NULL, &entry, repl_get_plugin_identity (PLUGIN_MULTIMASTER_REPLICATION));
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_entry_already_exists\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_entry_already_exists\n", 0, 0, 0 );
 
 	if (rc == LDAP_SUCCESS)
 	{
@@ -2326,7 +2326,7 @@ windows_delete_local_entry(Slapi_DN *sdn){
 	Slapi_PBlock *pb = NULL;
 	int return_value = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_delete_local_entry\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_delete_local_entry\n", 0, 0, 0 );
 
 	pb = slapi_pblock_new();
 	slapi_delete_internal_set_pb(pb, slapi_sdn_get_dn(sdn), NULL, NULL, repl_get_plugin_identity(PLUGIN_MULTIMASTER_REPLICATION), 0);
@@ -2338,7 +2338,7 @@ windows_delete_local_entry(Slapi_DN *sdn){
 		slapi_log_error(SLAPI_LOG_REPL, LOG_DEBUG, windows_repl_plugin_name,
 			"delete operation on local entry %s returned: %d\n", slapi_sdn_get_dn(sdn), return_value);
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_delete_local_entry: %d\n", return_value, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_delete_local_entry: %d\n", return_value, 0, 0 );
 
 	return return_value;
 }
@@ -2634,7 +2634,7 @@ windows_check_mods_for_rdn_change(Private_Repl_Protocol *prp, LDAPMod **original
 	Slapi_Mod *smod = slapi_mod_new();
 	Slapi_Mod *last_smod = smod;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_check_mods_for_rdn_change\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_check_mods_for_rdn_change\n", 0, 0, 0 );
 
 	/* Iterate through the original mods, looking for a modification to the RDN attribute */
 	slapi_mods_init_byref(&smods, original_mods);
@@ -2786,7 +2786,7 @@ done:
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_check_mods_for_rdn_change: %d\n", ret, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_check_mods_for_rdn_change: %d\n", ret, 0, 0 );
 
 	return ret;
 }
@@ -2809,16 +2809,16 @@ windows_map_mods_for_replay(Private_Repl_Protocol *prp,
 	const Slapi_DN *windows_subtree = NULL;
 	const subtreePair* subtree_pairs = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_map_mods_for_replay\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_map_mods_for_replay\n", 0, 0, 0 );
 	if (NULL == prp) {
-		LDAPDebug(LDAP_DEBUG_TRACE,
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		          "<= windows_map_mods_for_replay; NULL protocol; NOOP\n", 0, 0, 0);
 		return;
 	}
 	windows_subtree = windows_private_get_windows_subtree(prp->agmt);
 	subtree_pairs = windows_private_get_subtreepairs(prp->agmt);
 	if ((NULL == windows_subtree) && (NULL == subtree_pairs)) {
-		LDAPDebug(LDAP_DEBUG_TRACE,
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		          "<= windows_map_mods_for_replay; NULL agreement subtree; NOOP\n", 0, 0, 0);
 		return;
 	}
@@ -3068,7 +3068,7 @@ windows_map_mods_for_replay(Private_Repl_Protocol *prp,
 	slapi_mods_done (&smods);
 	/* Extract the mods for the caller */
 	*returned_mods = slapi_mods_get_ldapmods_passout(&mapped_smods);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_map_mods_for_replay\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_map_mods_for_replay\n", 0, 0, 0 );
 }
 
 
@@ -4479,7 +4479,7 @@ windows_create_local_entry(Private_Repl_Protocol *prp,Slapi_Entry *remote_entry,
 		"ntGroupDeleteGroup:true\n"
    		"cn:%s\n";
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_create_local_entry\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_create_local_entry\n", 0, 0, 0 );
 
 	windows_is_remote_entry_user_or_group(remote_entry,&is_user,&is_group);
 	user_entry_template = is_nt4 ? local_nt4_user_entry_template : local_user_entry_template;
@@ -4606,7 +4606,7 @@ error:
 	{
 		slapi_ch_free_string(&username);
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_create_local_entry\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_create_local_entry\n", 0, 0, 0 );
 	return retval;
 }
 
@@ -4676,7 +4676,7 @@ windows_generate_update_mods(Private_Repl_Protocol *prp,
 	Slapi_Entry *target_entry = NULL;
 
 	/* Iterate over the attributes on the remote entry, updating the local entry where appropriate */
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_generate_update_mods\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_generate_update_mods\n", 0, 0, 0 );
 
 	*do_modify = 0;
 
@@ -5149,7 +5149,7 @@ windows_generate_update_mods(Private_Repl_Protocol *prp,
 		slapi_mods_dump(smods,"windows sync");
 	}
 bail:
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_generate_update_mods: %d\n", retval, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_generate_update_mods: %d\n", retval, 0, 0 );
 	return retval;
 }
 
@@ -6022,7 +6022,7 @@ windows_dirsync_inc_run(Private_Repl_Protocol *prp)
 	int rc = 0;
 	int done = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_dirsync_inc_run\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> windows_dirsync_inc_run\n", 0, 0, 0 );
 	while (!done) {
 
 		Slapi_Entry *e = NULL;
@@ -6049,6 +6049,6 @@ windows_dirsync_inc_run(Private_Repl_Protocol *prp)
 		}
 	} /* While !done */
 error:
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_dirsync_inc_run\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= windows_dirsync_inc_run\n", 0, 0, 0 );
 }
 
diff --git a/ldap/servers/plugins/retrocl/retrocl_trim.c b/ldap/servers/plugins/retrocl/retrocl_trim.c
index b09f669..5e9b59f 100644
--- a/ldap/servers/plugins/retrocl/retrocl_trim.c
+++ b/ldap/servers/plugins/retrocl/retrocl_trim.c
@@ -294,7 +294,7 @@ static int trim_changelog(void)
 	    }
 	}
     } else {
-       LDAPDebug(LDAP_DEBUG_PLUGIN, "not yet time to trim: %ld < (%d+%d)\n",
+       LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "not yet time to trim: %ld < (%d+%d)\n",
                  now, lt, trim_interval);
     }
     PR_Lock( ts.ts_s_trim_mutex );
@@ -372,7 +372,7 @@ void retrocl_housekeeping ( time_t cur_time, void *noarg )
 		 * But a client might have deleted it over protocol.
 		 */
 		first_time = retrocl_getchangetime( SLAPI_SEQ_FIRST, &ldrc );
-		LDAPDebug(LDAP_DEBUG_PLUGIN,
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG,
 			  "cltrim: ldrc=%d, first_time=%ld, cur_time=%ld\n",
 			  ldrc,first_time,cur_time);
 		if ( LDAP_SUCCESS == ldrc && first_time > (time_t) 0L &&
diff --git a/ldap/servers/plugins/syntaxes/bin.c b/ldap/servers/plugins/syntaxes/bin.c
index 66dca47..221e4b5 100644
--- a/ldap/servers/plugins/syntaxes/bin.c
+++ b/ldap/servers/plugins/syntaxes/bin.c
@@ -211,11 +211,11 @@ bin_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> bin_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> bin_init\n", 0, 0, 0 );
 	rc = register_bin_like_plugin( pb, &bin_pdesc, bin_names,
 		 	BINARY_SYNTAX_OID );
 	rc |= register_matching_rule_plugins();
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= bin_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= bin_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -225,10 +225,10 @@ octetstring_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> octetstring_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> octetstring_init\n", 0, 0, 0 );
 	rc = register_bin_like_plugin( pb, &octetstring_pdesc, octetstring_names,
 		 	OCTETSTRING_SYNTAX_OID );
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= octetstring_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= octetstring_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -238,10 +238,10 @@ jpeg_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> jpeg_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> jpeg_init\n", 0, 0, 0 );
 	rc = register_bin_like_plugin( pb, &jpeg_pdesc, jpeg_names,
 		 	JPEG_SYNTAX_OID );
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= jpeg_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= jpeg_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -251,10 +251,10 @@ fax_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> fax_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> fax_init\n", 0, 0, 0 );
 	rc = register_bin_like_plugin( pb, &fax_pdesc, fax_names,
 			FAX_SYNTAX_OID );
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= fax_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= fax_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/bitstring.c b/ldap/servers/plugins/syntaxes/bitstring.c
index a399e8d..af49ec4 100644
--- a/ldap/servers/plugins/syntaxes/bitstring.c
+++ b/ldap/servers/plugins/syntaxes/bitstring.c
@@ -104,7 +104,7 @@ bitstring_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> bitstring_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> bitstring_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -135,7 +135,7 @@ bitstring_init( Slapi_PBlock *pb )
 	    (void *) bitstring_normalize );
 
 	rc |= register_matching_rule_plugins();
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= bitstring_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= bitstring_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/ces.c b/ldap/servers/plugins/syntaxes/ces.c
index 6ce19ca..6fd5d31 100644
--- a/ldap/servers/plugins/syntaxes/ces.c
+++ b/ldap/servers/plugins/syntaxes/ces.c
@@ -344,12 +344,12 @@ ces_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> ces_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> ces_init\n", 0, 0, 0 );
 
 	rc = register_ces_like_plugin(pb,&ia5_pdesc,ia5_names,IA5STRING_SYNTAX_OID, ia5_validate);
 	rc |= register_matching_rule_plugins();
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= ces_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= ces_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -358,12 +358,12 @@ uri_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> uri_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> uri_init\n", 0, 0, 0 );
 
 	rc = register_ces_like_plugin(pb,&uri_pdesc,uri_names,
 				      "1.3.6.1.4.1.4401.1.1.1", NULL);
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= uri_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= uri_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/cis.c b/ldap/servers/plugins/syntaxes/cis.c
index a2cc456..dd46bd3 100644
--- a/ldap/servers/plugins/syntaxes/cis.c
+++ b/ldap/servers/plugins/syntaxes/cis.c
@@ -724,11 +724,11 @@ cis_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> cis_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> cis_init\n", 0, 0, 0 );
 	rc = register_cis_like_plugin( pb, &dirstring_pdesc, dirstring_names,
 		 	DIRSTRING_SYNTAX_OID, dirstring_validate );
 	rc |= register_matching_rule_plugins();
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= cis_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= cis_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -738,10 +738,10 @@ boolean_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> boolean_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> boolean_init\n", 0, 0, 0 );
 	rc = register_cis_like_plugin( pb, &boolean_pdesc, boolean_names,
 			BOOLEAN_SYNTAX_OID, boolean_validate );
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= boolean_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= boolean_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -750,10 +750,10 @@ time_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> time_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> time_init\n", 0, 0, 0 );
 	rc = register_cis_like_plugin( pb, &time_pdesc, time_names,
 			GENERALIZEDTIME_SYNTAX_OID, time_validate );
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= time_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= time_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -762,10 +762,10 @@ country_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> country_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> country_init\n", 0, 0, 0 );
 	rc = register_cis_like_plugin( pb, &country_pdesc, country_names,
 				       COUNTRYSTRING_SYNTAX_OID, country_validate );
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= country_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= country_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -774,10 +774,10 @@ postal_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> postal_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> postal_init\n", 0, 0, 0 );
 	rc = register_cis_like_plugin( pb, &postal_pdesc, postal_names,
 				       POSTALADDRESS_SYNTAX_OID, postal_validate );
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= postal_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= postal_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -787,9 +787,9 @@ oid_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> oid_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> oid_init\n", 0, 0, 0 );
 	rc = register_cis_like_plugin( pb, &oid_pdesc, oid_names, OID_SYNTAX_OID, oid_validate );
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= oid_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= oid_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -798,10 +798,10 @@ printable_init( Slapi_PBlock *pb )
 {
 	int     rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> printable_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> printable_init\n", 0, 0, 0 );
 	rc = register_cis_like_plugin( pb, &printable_pdesc, printable_names,
 					PRINTABLESTRING_SYNTAX_OID, printable_validate );
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= printable_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= printable_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/deliverymethod.c b/ldap/servers/plugins/syntaxes/deliverymethod.c
index 47e9052..6702dc4 100644
--- a/ldap/servers/plugins/syntaxes/deliverymethod.c
+++ b/ldap/servers/plugins/syntaxes/deliverymethod.c
@@ -49,7 +49,7 @@ delivery_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> delivery_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> delivery_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -79,7 +79,7 @@ delivery_init( Slapi_PBlock *pb )
 	rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NORMALIZE,
 	    (void *) delivery_normalize );
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= delivery_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= delivery_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/dn.c b/ldap/servers/plugins/syntaxes/dn.c
index 12387c7..0dbc2ff 100644
--- a/ldap/servers/plugins/syntaxes/dn.c
+++ b/ldap/servers/plugins/syntaxes/dn.c
@@ -110,7 +110,7 @@ dn_init( Slapi_PBlock *pb )
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> dn_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> dn_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -136,7 +136,7 @@ dn_init( Slapi_PBlock *pb )
 	    (void *) dn_normalize );
 
 	rc |= register_matching_rule_plugins();
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= dn_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= dn_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/facsimile.c b/ldap/servers/plugins/syntaxes/facsimile.c
index 98b92e1..cbf7e25 100644
--- a/ldap/servers/plugins/syntaxes/facsimile.c
+++ b/ldap/servers/plugins/syntaxes/facsimile.c
@@ -49,7 +49,7 @@ facsimile_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> facsimile_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> facsimile_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -79,7 +79,7 @@ facsimile_init( Slapi_PBlock *pb )
 	rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NORMALIZE,
 	    (void *) facsimile_normalize );
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= facsimile_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= facsimile_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/guide.c b/ldap/servers/plugins/syntaxes/guide.c
index 889081e..9986fc7 100644
--- a/ldap/servers/plugins/syntaxes/guide.c
+++ b/ldap/servers/plugins/syntaxes/guide.c
@@ -59,7 +59,7 @@ guide_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> guide_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> guide_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -89,7 +89,7 @@ guide_init( Slapi_PBlock *pb )
 	rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NORMALIZE,
 	    (void *) guide_normalize );
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= guide_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= guide_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -98,7 +98,7 @@ enhancedguide_init( Slapi_PBlock *pb )
 {
 	int     rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> guide_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> guide_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -126,7 +126,7 @@ enhancedguide_init( Slapi_PBlock *pb )
 	rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
 	    (void *) enhancedguide_validate );
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= guide_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= guide_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/int.c b/ldap/servers/plugins/syntaxes/int.c
index a0ac682..400ad8a 100644
--- a/ldap/servers/plugins/syntaxes/int.c
+++ b/ldap/servers/plugins/syntaxes/int.c
@@ -162,7 +162,7 @@ int_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> int_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> int_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -189,7 +189,7 @@ int_init( Slapi_PBlock *pb )
 	    (void *) int_normalize );
 
 	rc |= register_matching_rule_plugins();
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= int_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= int_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/nameoptuid.c b/ldap/servers/plugins/syntaxes/nameoptuid.c
index b31d506..98b319e 100644
--- a/ldap/servers/plugins/syntaxes/nameoptuid.c
+++ b/ldap/servers/plugins/syntaxes/nameoptuid.c
@@ -109,7 +109,7 @@ nameoptuid_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> nameoptuid_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> nameoptuid_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -140,7 +140,7 @@ nameoptuid_init( Slapi_PBlock *pb )
 	    (void *) nameoptuid_normalize );
 
 	rc |= register_matching_rule_plugins();
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= nameoptuid_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= nameoptuid_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/numericstring.c b/ldap/servers/plugins/syntaxes/numericstring.c
index 2c3beaf..9d6a412 100644
--- a/ldap/servers/plugins/syntaxes/numericstring.c
+++ b/ldap/servers/plugins/syntaxes/numericstring.c
@@ -167,7 +167,7 @@ numstr_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> numstr_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> numstr_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -194,7 +194,7 @@ numstr_init( Slapi_PBlock *pb )
 	    (void *) numstr_normalize );
 
 	rc |= register_matching_rule_plugins();
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= numstr_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= numstr_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/sicis.c b/ldap/servers/plugins/syntaxes/sicis.c
index dc8a35d..93b75e5 100644
--- a/ldap/servers/plugins/syntaxes/sicis.c
+++ b/ldap/servers/plugins/syntaxes/sicis.c
@@ -54,7 +54,7 @@ sicis_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> sicis_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> sicis_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -82,7 +82,7 @@ sicis_init( Slapi_PBlock *pb )
 	rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NORMALIZE,
 	    (void *) sicis_normalize );
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= sicis_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= sicis_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/string.c b/ldap/servers/plugins/syntaxes/string.c
index 149663b..541870f 100644
--- a/ldap/servers/plugins/syntaxes/string.c
+++ b/ldap/servers/plugins/syntaxes/string.c
@@ -181,7 +181,7 @@ string_filter_approx( struct berval *bvfilter, Slapi_Value **bvals,
 	if (0 != rc) {
 		rc = -1;
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= string_filter_approx %d\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= string_filter_approx %d\n",
 	    rc, 0, 0 );
 
 	return( rc );
@@ -208,7 +208,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
 	int free_re = 1;
 	struct subfilt *sf = NULL;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> string_filter_sub\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> string_filter_sub\n", 0, 0, 0 );
 	if (pb) {
 		slapi_pblock_get( pb, SLAPI_OPERATION, &op );
 	}
@@ -322,13 +322,13 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
 		tmpbuf = NULL;
 		re = slapi_re_comp( p, &re_result );
 		if (NULL == re) {
-			LDAPDebug( LDAP_DEBUG_ANY, "re_comp (%s) failed (%s): %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "re_comp (%s) failed (%s): %s\n",
 					   pat, p, re_result?re_result:"unknown" );
 			rc = LDAP_OPERATIONS_ERROR;
 			goto bailout;
 		} else if (slapi_is_loglevel_set(SLAPI_LOG_TRACE)) {
 			char ebuf[BUFSIZ];
-			LDAPDebug(LDAP_DEBUG_TRACE, "re_comp (%s)\n", escape_string(p, ebuf), 0, 0);
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "re_comp (%s)\n", escape_string(p, ebuf), 0, 0);
 		}
 	}
 
@@ -376,7 +376,7 @@ string_filter_sub( Slapi_PBlock *pb, char *initial, char **any, char *final,
 
 		if (slapi_is_loglevel_set(SLAPI_LOG_TRACE)) {
 			char ebuf[BUFSIZ];
-			LDAPDebug(LDAP_DEBUG_TRACE, "re_exec (%s) %i\n", escape_string(realval, ebuf), tmprc, 0);
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "re_exec (%s) %i\n", escape_string(realval, ebuf), tmprc, 0);
 		}
 		if ( tmprc == 1 ) {
 			rc = 0;
@@ -393,7 +393,7 @@ bailout:
 	slapi_ch_free((void**)&tmpbuf );	/* NULL is fine */
 	slapi_ch_free((void**)&bigpat );	/* NULL is fine */
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= string_filter_sub %d\n",
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= string_filter_sub %d\n",
 	    rc, 0, 0 );
 	return( rc );
 }
@@ -738,7 +738,7 @@ string_assertion2keys_ava(
 		}
 		break;
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "string_assertion2keys_ava: unknown ftype 0x%x\n",
 		    ftype, 0, 0 );
 		break;
@@ -920,7 +920,7 @@ substring_comp_keys(
 	PR_ASSERT(NULL != comp_buf);
 	PR_ASSERT(NULL != substrlens);
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> substring_comp_keys (%s) %d\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> substring_comp_keys (%s) %d\n",
         str, prepost, 0 );
 
     /* prepend ^ for initial substring */
@@ -963,5 +963,5 @@ substring_comp_keys(
 		(*nsubs)++;
     }
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= substring_comp_keys\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= substring_comp_keys\n", 0, 0, 0 );
 }
diff --git a/ldap/servers/plugins/syntaxes/tel.c b/ldap/servers/plugins/syntaxes/tel.c
index 6a5d92f..a777bdf 100644
--- a/ldap/servers/plugins/syntaxes/tel.c
+++ b/ldap/servers/plugins/syntaxes/tel.c
@@ -151,7 +151,7 @@ tel_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> tel_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> tel_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -182,7 +182,7 @@ tel_init( Slapi_PBlock *pb )
 	    (void *) tel_normalize );
 
 	rc |= register_matching_rule_plugins();
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= tel_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= tel_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/teletex.c b/ldap/servers/plugins/syntaxes/teletex.c
index ae713ce..8255869 100644
--- a/ldap/servers/plugins/syntaxes/teletex.c
+++ b/ldap/servers/plugins/syntaxes/teletex.c
@@ -49,7 +49,7 @@ teletex_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> teletex_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> teletex_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -79,7 +79,7 @@ teletex_init( Slapi_PBlock *pb )
 	rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NORMALIZE,
 	    (void *) teletex_normalize );
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= teletex_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= teletex_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/telex.c b/ldap/servers/plugins/syntaxes/telex.c
index 99525af..14405f2 100644
--- a/ldap/servers/plugins/syntaxes/telex.c
+++ b/ldap/servers/plugins/syntaxes/telex.c
@@ -48,7 +48,7 @@ telex_init( Slapi_PBlock *pb )
 {
 	int	rc, flags;
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "=> telex_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "=> telex_init\n", 0, 0, 0 );
 
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
 	    (void *) SLAPI_PLUGIN_VERSION_01 );
@@ -78,7 +78,7 @@ telex_init( Slapi_PBlock *pb )
 	rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NORMALIZE,
 	    (void *) telex_normalize );
 
-	LDAPDebug( LDAP_DEBUG_PLUGIN, "<= telex_init %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "<= telex_init %d\n", rc, 0, 0 );
 	return( rc );
 }
 
diff --git a/ldap/servers/plugins/syntaxes/value.c b/ldap/servers/plugins/syntaxes/value.c
index ef496ee..360e57f 100644
--- a/ldap/servers/plugins/syntaxes/value.c
+++ b/ldap/servers/plugins/syntaxes/value.c
@@ -368,7 +368,7 @@ value_cmp(
 	} else if (syntax & SYNTAX_CES) {
 		rc = strcmp( v1->bv_val, v2->bv_val );
 	} else { /* error - unknown syntax */
-		LDAPDebug(LDAP_DEBUG_PLUGIN,
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG,
 				  "invalid syntax [%d]\n", syntax, 0, 0);
 	}
 
diff --git a/ldap/servers/slapd/abandon.c b/ldap/servers/slapd/abandon.c
index 9a39f6a..72680d7 100644
--- a/ldap/servers/slapd/abandon.c
+++ b/ldap/servers/slapd/abandon.c
@@ -38,7 +38,7 @@ do_abandon( Slapi_PBlock *pb )
 	Operation	*o;
 	BerElement	*ber = pb->pb_op->o_ber;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "do_abandon\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_abandon\n", 0, 0, 0 );
 
 	/*
 	 * Parse the abandon request.  It looks like this:
@@ -47,7 +47,7 @@ do_abandon( Slapi_PBlock *pb )
 	 */
 
 	if ( ber_scanf( ber, "i", &id ) == LBER_ERROR ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "ber_scanf failed (op=Abandon; params=ID)\n",
 		    0, 0 ,0 );
 		return;
@@ -61,14 +61,14 @@ do_abandon( Slapi_PBlock *pb )
 	 * pass them to the backend.
 	 */
 	if ( (err = get_ldapmessage_controls( pb, ber, NULL )) != 0 ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"get_ldapmessage_controls failed: %d (%s) (op=Abandon)\n", 
 				err, ldap_err2string( err ), 0);
 		/* LDAP does not allow any response to an abandon */
 		return;
 	}
 
-	LDAPDebug( LDAP_DEBUG_ARGS, "do_abandon: id %d\n", id, 0 ,0 );
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "do_abandon: id %d\n", id, 0 ,0 );
 
 	/*
 	 * find the operation being abandoned and set the o_abandon
@@ -97,7 +97,7 @@ do_abandon( Slapi_PBlock *pb )
 		if (ts) {
 		  	operation_set_target_spec (pb->pb_op, ts);
 		} else {
-		     LDAPDebug( LDAP_DEBUG_TRACE, "do_abandon: no target spec of abandoned operation\n", 0,0,0);
+		     LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_abandon: no target spec of abandoned operation\n", 0,0,0);
 		}
 
 		operation_set_abandoned_op (pb->pb_op, o->o_abandoned_op);
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
index 0f38318..bfe5054 100644
--- a/ldap/servers/slapd/add.c
+++ b/ldap/servers/slapd/add.c
@@ -61,7 +61,7 @@ do_add( Slapi_PBlock *pb )
 	int			rc;
 	PRBool  searchsubentry=PR_TRUE;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "do_add\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_add\n", 0, 0, 0 );
 
 	slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
     ber = operation->o_ber;
@@ -86,7 +86,7 @@ do_add( Slapi_PBlock *pb )
 		Slapi_DN mysdn;
 		if ( ber_scanf( ber, "{a", &rawdn ) == LBER_ERROR ) {
 			slapi_ch_free_string(&rawdn);
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"ber_scanf failed (op=Add; params=DN)\n", 0, 0, 0 );
 			op_shared_log_error_access (pb, "ADD", "???", "decoding error");
 			send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL,
@@ -121,7 +121,7 @@ do_add( Slapi_PBlock *pb )
 		slapi_entry_init_ext(e, &mysdn, NULL);
 		slapi_sdn_done(&mysdn);
 	}
-	LDAPDebug( LDAP_DEBUG_ARGS, "	do_add: dn (%s)\n", slapi_entry_get_dn_const(e), 0, 0 );
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "	do_add: dn (%s)\n", slapi_entry_get_dn_const(e), 0, 0 );
 
 	/* get the attrs */
 	for ( tag = ber_first_element( ber, &len, &last );
@@ -140,7 +140,7 @@ do_add( Slapi_PBlock *pb )
 		}
 
 		if ( vals == NULL ) {
-			LDAPDebug( LDAP_DEBUG_ANY, "no values for type %s\n", type, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "no values for type %s\n", type, 0, 0 );
 			op_shared_log_error_access (pb, "ADD", slapi_sdn_get_dn (slapi_entry_get_sdn_const(e)), "null value");
 			send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL, NULL,
 			    0, NULL );
@@ -787,7 +787,7 @@ add_created_attrs(Slapi_PBlock *pb, Slapi_Entry *e)
 	struct slapi_componentid *cid = NULL;
 	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
-	LDAPDebug(LDAP_DEBUG_TRACE, "add_created_attrs\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "add_created_attrs\n", 0, 0, 0);
 
 	bvals[0] = &bv;
 	bvals[1] = NULL;
@@ -881,7 +881,7 @@ static int check_rdn_for_created_attrs(Slapi_Entry *e)
 
         for (i = 0; type[i] != NULL; i++) {
             if (slapi_rdn_contains_attr(rdn, type[i], &value)) {
-                LDAPDebug(LDAP_DEBUG_TRACE, "Invalid DN. RDN contains %s attribute\n", type[i], 0, 0);
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Invalid DN. RDN contains %s attribute\n", type[i], 0, 0);
                 rc = 1;
                 break;
             }
@@ -889,7 +889,7 @@ static int check_rdn_for_created_attrs(Slapi_Entry *e)
 
         slapi_rdn_free(&rdn);
     } else {
-        LDAPDebug(LDAP_DEBUG_TRACE, "check_rdn_for_created_attrs: Error allocating RDN\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "check_rdn_for_created_attrs: Error allocating RDN\n", 0, 0, 0);
         rc = -1;
     }
 
@@ -907,7 +907,7 @@ static void handle_fast_add(Slapi_PBlock *pb, Slapi_Entry *entry)
 
     if ((be == NULL) || (be->be_wire_import == NULL)) {
         /* can this even happen? */
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "handle_fast_add: backend not supported\n", 0, 0, 0);
         send_ldap_result(pb, LDAP_NOT_SUPPORTED, NULL, NULL, 0, NULL);
         return;
@@ -924,7 +924,7 @@ static void handle_fast_add(Slapi_PBlock *pb, Slapi_Entry *entry)
     if (operation_is_flag_set(operation, OP_FLAG_ACTION_SCHEMA_CHECK) &&
         (slapi_entry_schema_check(pb, entry) != 0)) {
 	char *errtext; 
-        LDAPDebug(LDAP_DEBUG_TRACE, "entry failed schema check\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "entry failed schema check\n", 0, 0, 0);
 	slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &errtext);
         send_ldap_result(pb, LDAP_OBJECT_CLASS_VIOLATION, NULL, errtext, 0, NULL);
         slapi_entry_free(entry);
@@ -934,7 +934,7 @@ static void handle_fast_add(Slapi_PBlock *pb, Slapi_Entry *entry)
     /* syntax check */
     if (slapi_entry_syntax_check(pb, entry, 0) != 0) {
         char *errtext;
-        LDAPDebug(LDAP_DEBUG_TRACE, "entry failed syntax check\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "entry failed syntax check\n", 0, 0, 0);
         slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &errtext);
         send_ldap_result(pb, LDAP_INVALID_SYNTAX, NULL, errtext, 0, NULL);
         slapi_entry_free(entry);
@@ -954,7 +954,7 @@ static void handle_fast_add(Slapi_PBlock *pb, Slapi_Entry *entry)
     slapi_pblock_set(pb, SLAPI_BULK_IMPORT_STATE, &ret);
     ret = (*be->be_wire_import)(pb);
     if (ret != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "wire import: error during import (%d)\n",
                   ret, 0, 0);
         send_ldap_result(pb, LDAP_OPERATIONS_ERROR,
@@ -988,7 +988,7 @@ add_uniqueid (Slapi_Entry *e)
 	}
 	else
 	{
-		LDAPDebug(LDAP_DEBUG_ANY, "add_created_attrs: uniqueid generation failed for %s; error = %d\n", 
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "add_created_attrs: uniqueid generation failed for %s; error = %d\n", 
 				   slapi_entry_get_dn_const(e), rc, 0);
 	}
 
diff --git a/ldap/servers/slapd/attrsyntax.c b/ldap/servers/slapd/attrsyntax.c
index 25078fe..b34216a 100644
--- a/ldap/servers/slapd/attrsyntax.c
+++ b/ldap/servers/slapd/attrsyntax.c
@@ -119,14 +119,14 @@ check_oid( const char *oid ) {
 
   if ( oid == NULL) {
 	/* this is bad */
-	LDAPDebug (LDAP_DEBUG_ANY, "NULL passed to check_oid\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "NULL passed to check_oid\n",0,0,0);
 	return 0;
   }
   
   length_oid = strlen(oid);
   if (length_oid < 4) {
 	/* this is probably bad */
-	LDAPDebug (LDAP_DEBUG_ANY, "Bad oid %s passed to check_oid\n",oid,0,0);
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Bad oid %s passed to check_oid\n",oid,0,0);
 	return 0;
   }
 
@@ -141,14 +141,14 @@ check_oid( const char *oid ) {
   
   if ( !isdigit(oid[0]) || 
 	   !isdigit(oid[length_oid-1]) ) {
-	LDAPDebug (LDAP_DEBUG_ANY, "Non numeric oid %s passed to check_oid\n",oid,0,0);
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Non numeric oid %s passed to check_oid\n",oid,0,0);
 	return 0;
   }
 
   /* check to see that it contains only digits and dots */
   for ( i = 0; i < length_oid; i++ ) {
 	if ( !isdigit(oid[i]) && oid[i] != '.'  ){
-	  LDAPDebug (LDAP_DEBUG_ANY, "Non numeric oid %s passed to check_oid\n",oid,0,0);
+	  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Non numeric oid %s passed to check_oid\n",oid,0,0);
 	  return 0;
 	}
   }
@@ -174,7 +174,7 @@ attr_syntax_check_oids()
 		PLHashEntry *he = oid2asi->buckets[ii-1];
 		for (; he; he = he->next) {
 			if (!check_oid(he->key)) {
-				LDAPDebug(LDAP_DEBUG_ANY, "Error: bad oid %s in bucket %d\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: bad oid %s in bucket %d\n",
 						  he->key, ii-1, 0);
 				nbad++;
 			}
@@ -670,7 +670,7 @@ int default_dirstring_values2keys( Slapi_PBlock *pb, Slapi_Value **bvals,Slapi_V
 	case LDAP_FILTER_SUBSTRINGS:
 	default:
 		/* default plugin only handles equality so far */
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "default_dirstring_values2keys: unsupported ftype 0x%x\n",
 		    ftype, 0, 0 );
 		break;
diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
index 18cb7f9..f7dd9ce 100644
--- a/ldap/servers/slapd/auth.c
+++ b/ldap/servers/slapd/auth.c
@@ -59,7 +59,7 @@ slapu_search_s( LDAP* ld, const char* rawbaseDN, int scope, const char* filter,
         slapi_sdn_free(&sdn);
         return err;
     }
-    LDAPDebug (LDAP_DEBUG_TRACE, "=> slapu_search_s (\"%s\", %i, %s)\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> slapu_search_s (\"%s\", %i, %s)\n",
                baseDN, scope, filter);
     if (filter == NULL) filter = "objectclass=*";
 
@@ -86,18 +86,18 @@ slapu_search_s( LDAP* ld, const char* rawbaseDN, int scope, const char* filter,
             pb = NULL;
             if (scope == LDAP_SCOPE_SUBTREE) {
                 char fbuf[ BUFSIZ ];
-                LDAPDebug (LDAP_DEBUG_ANY, "slapi_search_internal (\"%s\", subtree, %s) err %i\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapi_search_internal (\"%s\", subtree, %s) err %i\n",
                            baseDN, escape_string( (char*)filter, fbuf ), err);
             }
         }
     } else {
         char fbuf[ BUFSIZ ];
-        LDAPDebug (LDAP_DEBUG_ANY, "slapi_search_internal (\"%s\", %i, %s) NULL\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapi_search_internal (\"%s\", %i, %s) NULL\n",
                    baseDN, scope, escape_string( (char*)filter, fbuf ));
     }
     slapi_sdn_free(&sdn);
     *result = (LDAPMessage*)pb;
-    LDAPDebug (LDAP_DEBUG_TRACE, "<= slapu_search_s %i\n", err, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= slapu_search_s %i\n", err, 0, 0);
     return err;
 }
 
@@ -260,14 +260,14 @@ client_auth_init ()
     if (client_auth_config_file == NULL) {
 	char *confdir = config_get_configdir();
 	if (NULL == confdir) {
-	    LDAPDebug (LDAP_DEBUG_ANY,
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		"client_auth_init: failed to get configdir\n",
 		0, 0, 0);
 	    return;
 	}
 	client_auth_config_file = PR_smprintf("%s/certmap.conf", confdir);
 	if (NULL == client_auth_config_file) {
-	    LDAPDebug (LDAP_DEBUG_ANY,
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		"client_auth_init: failed to duplicate \"%s/certmap\"\n",
 		confdir, 0, 0);
 	    slapi_ch_free_string(&confdir);
@@ -277,7 +277,7 @@ client_auth_init ()
     }
     err = ldaputil_init (client_auth_config_file, "", NULL, "slapd", NULL);
     if (err != LDAPU_SUCCESS) {
-	LDAPDebug (LDAP_DEBUG_TRACE, "ldaputil_init(%s,...) %i\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldaputil_init(%s,...) %i\n",
 		client_auth_config_file, err, 0);
     } else {
 	LDAPUVTable_t vtable = {
@@ -331,7 +331,7 @@ subject_of (CERTCertificate* cert)
     if (cert != NULL) {
 	int err = ldapu_get_cert_subject_dn (cert, &dn);
 	if (err != LDAPU_SUCCESS) {
-	    LDAPDebug (LDAP_DEBUG_ANY, "ldapu_get_cert_subject_dn(%p) %i (%s)\n",
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldapu_get_cert_subject_dn(%p) %i (%s)\n",
 		       (void*)cert, err, ldapu_err2string (err));
 	}
     }
@@ -345,7 +345,7 @@ issuer_of (CERTCertificate* cert)
     if (cert != NULL) {
 	int err = ldapu_get_cert_issuer_dn (cert, &dn);
 	if (err != LDAPU_SUCCESS) {
-	    LDAPDebug (LDAP_DEBUG_ANY, "ldapu_get_cert_issuer_dn(%p) %i (%s)\n",
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldapu_get_cert_issuer_dn(%p) %i (%s)\n",
 		       (void*)cert, err, ldapu_err2string (err));
 	}
     }
@@ -487,12 +487,12 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
 		} else {
 		  
 		    extraErrorMsg = "no entry";
-		    LDAPDebug (LDAP_DEBUG_TRACE, "<= ldapu_cert_to_ldap_entry() %s\n",
+		    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldapu_cert_to_ldap_entry() %s\n",
 			       extraErrorMsg, 0, 0);
 		}
 	    } else {
 		extraErrorMsg = ldapu_err2string(err);
-	        LDAPDebug (LDAP_DEBUG_TRACE, "<= ldapu_cert_to_ldap_entry() %i (%s)%s\n",
+	        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldapu_cert_to_ldap_entry() %i (%s)%s\n",
 			   err, extraErrorMsg, chain ? "" : " NULL");
 	    }
 		slapi_ch_free_string(&basedn);
diff --git a/ldap/servers/slapd/ava.c b/ldap/servers/slapd/ava.c
index 03af368..006ac6b 100644
--- a/ldap/servers/slapd/ava.c
+++ b/ldap/servers/slapd/ava.c
@@ -31,7 +31,7 @@ get_ava(
 	    == LBER_ERROR ) {
         slapi_ch_free_string( &type );
         ava_done(ava);
-		LDAPDebug( LDAP_DEBUG_ANY, "  get_ava ber_scanf\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "  get_ava ber_scanf\n", 0, 0, 0 );
 		return( LDAP_PROTOCOL_ERROR );
 	}
 	ava->ava_type = slapi_attr_syntax_normalize(type);
diff --git a/ldap/servers/slapd/back-ldbm/ancestorid.c b/ldap/servers/slapd/back-ldbm/ancestorid.c
index 2fd752e..fa0be74 100644
--- a/ldap/servers/slapd/back-ldbm/ancestorid.c
+++ b/ldap/servers/slapd/back-ldbm/ancestorid.c
@@ -120,7 +120,7 @@ static int ldbm_get_nonleaf_ids(backend *be, DB_TXN *txn, IDList **idl, ImportJo
     /* Return the idlist */
     if (ret == 0) {
         *idl = nodes;
-        LDAPDebug(LDAP_DEBUG_TRACE, "found %lu nodes for ancestorid\n", 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "found %lu nodes for ancestorid\n", 
                   (u_long)IDL_NIDS(nodes), 0, 0);
     } else {
         idl_free(&nodes);
@@ -207,7 +207,7 @@ static int ldbm_ancestorid_default_create_index(backend *be, ImportJob *job)
 
     /* Maybe nothing to do */
     if (nodes == NULL || nodes->b_nids == 0) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Nothing to do to build ancestorid index\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Nothing to do to build ancestorid index\n",
                   0, 0, 0);
         goto out;
     }
@@ -268,7 +268,7 @@ static int ldbm_ancestorid_default_create_index(backend *be, ImportJob *job)
             descendants = idl_union_allids(be, ai_aid, ididl->idl, children);
             idl_free(&children);
             if (id2idl_hash_remove(ht, &id) == 0) {
-                LDAPDebug(LDAP_DEBUG_ANY, "ancestorid hash_remove failed\n", 0,0,0);
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ancestorid hash_remove failed\n", 0,0,0);
             } else {
                 id2idl_free(&ididl);
             }
@@ -302,7 +302,7 @@ static int ldbm_ancestorid_default_create_index(backend *be, ImportJob *job)
             ididl->keyid = parentid;
             ididl->idl = descendants;
             if (id2idl_hash_add(ht, &parentid, ididl, NULL) == 0) {
-                LDAPDebug(LDAP_DEBUG_ANY, "ancestorid hash_add failed\n", 0,0,0);
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ancestorid hash_add failed\n", 0,0,0);
             }
         }
 
@@ -384,7 +384,7 @@ static int ldbm_ancestorid_new_idl_create_index(backend *be, ImportJob *job)
 
 	/* Bail now if we did not get here honestly. */
 	if (!idl_get_idl_new()) {
-		LDAPDebug(LDAP_DEBUG_ANY, "Cannot create ancestorid index.  " 
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Cannot create ancestorid index.  " 
 			"New IDL version called but idl_new is false!\n", 0,0,0);
 		return 1;
 	}
@@ -408,7 +408,7 @@ static int ldbm_ancestorid_new_idl_create_index(backend *be, ImportJob *job)
 
     /* Maybe nothing to do */
     if (nodes == NULL || nodes->b_nids == 0) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Nothing to do to build ancestorid index\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Nothing to do to build ancestorid index\n",
                   0, 0, 0);
         goto out;
     }
@@ -523,7 +523,7 @@ static int ldbm_ancestorid_new_idl_create_index(backend *be, ImportJob *job)
         }
         import_log_notice(job, "Created ancestorid index (new idl).");
     } else {
-        LDAPDebug(LDAP_DEBUG_ANY, "Failed to create ancestorid index\n", 0,0,0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to create ancestorid index\n", 0,0,0);
     }
 
     /* Free any leftover idlists */
@@ -632,7 +632,7 @@ static int check_cache(id2idl_hash *ht)
     }
 
     if (found > 0) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ERROR: parentid index is not complete (%lu extra keys in ancestorid cache)\n", found,0,0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: parentid index is not complete (%lu extra keys in ancestorid cache)\n", found,0,0);
         ret = -1;
     }
 
@@ -699,13 +699,13 @@ static int ancestorid_addordel(
 
     if (flags & BE_INDEX_ADD) {
 #if 1
-        LDAPDebug(LDAP_DEBUG_TRACE, "insert ancestorid %lu:%lu\n", 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "insert ancestorid %lu:%lu\n", 
                   (u_long)node_id, (u_long)id, 0);
 #endif
         ret = idl_insert_key(be, db, &key, id, txn, ai, allids);
     } else {
 #if 1
-        LDAPDebug(LDAP_DEBUG_TRACE, "delete ancestorid %lu:%lu\n", 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "delete ancestorid %lu:%lu\n", 
                   (u_long)node_id, (u_long)id, 0);
 #endif
         ret = idl_delete_key(be, db, &key, id, txn, ai);
@@ -958,14 +958,14 @@ _sdn_suffix_cmp(
     /* return the DN */
     slapi_sdn_set_dn_passin(common, ndnstr);
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "common suffix <%s>\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "common suffix <%s>\n",
               slapi_sdn_get_dn(common), 0, 0);
 
 out:
     slapi_ldap_value_free(rdns1);
     slapi_ldap_value_free(rdns2);
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "_sdn_suffix_cmp(<%s>, <%s>) => %d\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "_sdn_suffix_cmp(<%s>, <%s>) => %d\n",
               slapi_sdn_get_dn(left), slapi_sdn_get_dn(right), ret);
 
     return ret;
diff --git a/ldap/servers/slapd/back-ldbm/archive.c b/ldap/servers/slapd/back-ldbm/archive.c
index 64d558c..19d2192 100644
--- a/ldap/servers/slapd/back-ldbm/archive.c
+++ b/ldap/servers/slapd/back-ldbm/archive.c
@@ -90,7 +90,7 @@ int ldbm_back_archive2ldbm( Slapi_PBlock *pb )
         /* task does not support restore old idl onto new idl server */
         if (is_old_to_new)
         {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "backup has old idl format; "
                       "to restore old formated backup onto the new server, "
                       "please use command line utility \"bak2db\" .\n",
@@ -111,7 +111,7 @@ int ldbm_back_archive2ldbm( Slapi_PBlock *pb )
 
             /* check if an import/restore is already ongoing... */
             if (instance_set_busy(inst) != 0) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "ldbm: '%s' is already in the middle of "
                           "another task and cannot be disturbed.\n",
                           inst->inst_name, 0, 0);
@@ -142,7 +142,7 @@ int ldbm_back_archive2ldbm( Slapi_PBlock *pb )
         for (inst_obj = objset_first_obj(li->li_instance_set); inst_obj;
              inst_obj = objset_next_obj(li->li_instance_set, inst_obj)) {
             inst = (ldbm_instance *)object_get_data(inst_obj);
-            LDAPDebug(LDAP_DEBUG_ANY, "Bringing %s offline...\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Bringing %s offline...\n",
                       inst->inst_name, 0, 0);
             if (task) {
                 slapi_task_log_notice(task, "Bringing %s offline...",
@@ -165,7 +165,7 @@ int ldbm_back_archive2ldbm( Slapi_PBlock *pb )
     /* tell the database to restore */
     return_value = dblayer_restore(li, directory, task, backendname);
     if (0 != return_value) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "archive2db: Failed to read backup file set. "
                   "Either the directory specified doesn't exist, "
                   "or it exists but doesn't contain a valid backup set, "
@@ -206,7 +206,7 @@ int ldbm_back_archive2ldbm( Slapi_PBlock *pb )
                 *p = '\0';
             }
             bakup_dir = slapi_ch_smprintf("%s%ctmp_%010ld", directory, c, time(0));
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "archive2db: backup dir: %s\n", bakup_dir, 0, 0);
             if (p) *p = c;
 
@@ -241,7 +241,7 @@ int ldbm_back_archive2ldbm( Slapi_PBlock *pb )
             inst = (ldbm_instance *)object_get_data(inst_obj);
             ret = dblayer_instance_start(inst->inst_be, DBLAYER_NORMAL_MODE);
             if (ret != 0) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "archive2db: Unable to restart '%s'\n",
                           inst->inst_name, 0, 0);
                 if (task) {
@@ -282,7 +282,7 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
     slapi_pblock_get( pb, SLAPI_BACKEND_TASK, &task );
 
     if ( !rawdirectory || !*rawdirectory ) {
-        LDAPDebug( LDAP_DEBUG_ANY, "db2archive: no archive name\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db2archive: no archive name\n",
                    0, 0, 0 );
         return -1;
     }
@@ -295,7 +295,7 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
         if (0 != (return_value = 
                   dblayer_start(li,
                             DBLAYER_ARCHIVE_MODE|DBLAYER_NO_DBTHREADS_MODE))) {
-            LDAPDebug(LDAP_DEBUG_ANY, "db2archive: Failed to init database\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db2archive: Failed to init database\n",
                       0, 0, 0);
             if (task) {
                 slapi_task_log_notice(task, "Failed to init database");
@@ -309,7 +309,7 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
 
     if (stat(directory, &sbuf) == 0) {
         if (slapd_comp_path(directory, li->li_directory) == 0) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "db2archive: Cannot archive to the db directory.\n", 0, 0, 0);
             if (task) {
                 slapi_task_log_notice(task, 
@@ -320,7 +320,7 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
         }
 
         dir_bak = slapi_ch_smprintf("%s.bak", directory);
-        LDAPDebug(LDAP_DEBUG_ANY, "db2archive: %s exists. Renaming to %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db2archive: %s exists. Renaming to %s\n",
                                   directory, dir_bak, 0);
         if (task) {
             slapi_task_log_notice(task, "%s exists. Renaming to %s",
@@ -329,7 +329,7 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
         if (stat(dir_bak, &sbuf) == 0) {
             return_value = ldbm_delete_dirs(dir_bak);
             if (0 != return_value) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                             "db2archive: %s exists and failed to delete it.\n",
                             dir_bak, 0, 0);
                 if (task) {
@@ -343,10 +343,10 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
         return_value = PR_Rename(directory, dir_bak);
         if (return_value != PR_SUCCESS) {
             PRErrorCode prerr = PR_GetError();
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                             "db2archive: Failed to rename \"%s\" to \"%s\".\n",
                             directory, dir_bak, 0);
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                             SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                             prerr, slapd_pr_strerror(prerr), 0);
             if (task) {
@@ -364,7 +364,7 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
     if (0 != MKDIR(directory,SLAPD_DEFAULT_DIR_MODE) && EEXIST != errno) {
         char *msg = dblayer_strerror(errno);
 
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "db2archive: mkdir(%s) failed; errno %i (%s)\n",
                   directory, errno, msg ? msg : "unknown");
         if (task) {
@@ -387,7 +387,7 @@ int ldbm_back_ldbm2archive( Slapi_PBlock *pb )
 
             /* check if an import/restore is already ongoing... */
             if (instance_set_busy(inst) != 0 || dblayer_in_import(inst) != 0) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "ldbm: '%s' is already in the middle of "
                           "another task and cannot be disturbed.\n",
                           inst->inst_name, 0, 0);
@@ -490,7 +490,7 @@ out:
     /* close the database down again */
     if (run_from_cmdline &&
         0 != dblayer_close(li,DBLAYER_ARCHIVE_MODE|DBLAYER_NO_DBTHREADS_MODE)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "db2archive: Failed to close database\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db2archive: Failed to close database\n",
                   0, 0, 0);
         if (task) {
             slapi_task_log_notice(task, "Failed to close database");
diff --git a/ldap/servers/slapd/back-ldbm/cache.c b/ldap/servers/slapd/back-ldbm/cache.c
index b34bec9..4280cd1 100644
--- a/ldap/servers/slapd/back-ldbm/cache.c
+++ b/ldap/servers/slapd/back-ldbm/cache.c
@@ -43,12 +43,12 @@
 #ifdef LDAP_CACHE_DEBUG
 #define ASSERT(_x) do { \
     if (!(_x)) { \
-       LDAPDebug(LDAP_DEBUG_ANY, "BAD CACHE ASSERTION at %s/%d: %s\n", \
+       LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "BAD CACHE ASSERTION at %s/%d: %s\n", \
                 __FILE__, __LINE__, #_x); \
        *(char *)0L = 23; \
     } \
 } while (0)
-#define LOG(_a, _x1, _x2, _x3)  LDAPDebug(LDAP_DEBUG_CACHE, _a, _x1, _x2, _x3)
+#define LOG(_a, _x1, _x2, _x3)  LDAPDebug(LDAP_DEBUG_CACHE, LOG_DEBUG, _a, _x1, _x2, _x3)
 #else
 #define ASSERT(_x) ;
 #define LOG(_a, _x1, _x2, _x3)  ;
@@ -489,7 +489,7 @@ static void cache_make_hashes(struct cache *cache, int type)
 /* initialize the cache */
 int cache_init(struct cache *cache, size_t maxsize, long maxentries, int type)
 {
-    LDAPDebug(LDAP_DEBUG_TRACE, "=> cache_init\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> cache_init\n", 0, 0, 0);
     cache->c_maxsize = maxsize;
     cache->c_maxentries = maxentries;
     cache->c_curentries = 0;
@@ -521,7 +521,7 @@ int cache_init(struct cache *cache, size_t maxsize, long maxentries, int type)
        LDAPDebug0Args(LDAP_DEBUG_ANY, "ldbm: cache_init: PR_NewMonitor failed\n");
        return 0;
     }
-    LDAPDebug(LDAP_DEBUG_TRACE, "<= cache_init\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= cache_init\n", 0, 0, 0);
     return 1;
 }
 
@@ -561,7 +561,7 @@ entrycache_flush(struct cache *cache)
         ASSERT(e->ep_refcnt == 0);
         e->ep_refcnt++;
         if (entrycache_remove_int(cache, e) < 0) {
-           LDAPDebug(LDAP_DEBUG_ANY,
+           LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                      "entry cache flush: unable to delete entry\n", 0, 0, 0);
            break;
         }
@@ -655,7 +655,7 @@ static void entrycache_set_max_size(struct cache *cache, size_t bytes)
 
     if (bytes < MINCACHESIZE) {
        bytes = MINCACHESIZE;
-       LDAPDebug(LDAP_DEBUG_ANY,
+       LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "WARNING -- Minimum cache size is %lu -- rounding up\n",
                 MINCACHESIZE, 0, 0);
     }
@@ -683,7 +683,7 @@ static void entrycache_set_max_size(struct cache *cache, size_t bytes)
      * ldbm_instance_config
      */
     if (! util_is_cachesize_sane(&bytes)) {
-       LDAPDebug(LDAP_DEBUG_ANY,
+       LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "WARNING -- Possible CONFIGURATION ERROR -- cachesize "
                 "(%lu) may be configured to use more than the available "
                 "physical memory.\n", bytes, 0, 0);
@@ -1604,7 +1604,7 @@ dncache_set_max_size(struct cache *cache, size_t bytes)
 
     if (bytes < MINCACHESIZE) {
        bytes = MINCACHESIZE;
-       LDAPDebug(LDAP_DEBUG_ANY,
+       LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "WARNING -- Minimum cache size is %lu -- rounding up\n",
                 MINCACHESIZE, 0, 0);
     }
@@ -1968,7 +1968,7 @@ dncache_flush(struct cache *cache)
         ASSERT(dn->ep_refcnt == 0);
         dn->ep_refcnt++;
         if (dncache_remove_int(cache, dn) < 0) {
-           LDAPDebug(LDAP_DEBUG_ANY, "dn cache flush: unable to delete entry\n",
+           LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dn cache flush: unable to delete entry\n",
                     0, 0, 0);
            break;
         }
diff --git a/ldap/servers/slapd/back-ldbm/cleanup.c b/ldap/servers/slapd/back-ldbm/cleanup.c
index 63116c5..6e31f57 100644
--- a/ldap/servers/slapd/back-ldbm/cleanup.c
+++ b/ldap/servers/slapd/back-ldbm/cleanup.c
@@ -20,14 +20,14 @@ int ldbm_back_cleanup( Slapi_PBlock *pb )
 	struct ldbminfo	*li;
     Slapi_Backend *be;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "ldbm backend cleaning up\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm backend cleaning up\n", 0, 0, 0 );
 	slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li );
     slapi_pblock_get( pb, SLAPI_BACKEND, &be );
 
 	if (be->be_state != BE_STATE_STOPPED &&
 		be->be_state != BE_STATE_DELETED)
 	{
-		LDAPDebug( LDAP_DEBUG_TRACE, 
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 				  "ldbm_back_cleanup: warning - backend is in a wrong state - %d\n", 
 				  be->be_state, 0, 0 );
 		return 0;
@@ -38,7 +38,7 @@ int ldbm_back_cleanup( Slapi_PBlock *pb )
 	if (be->be_state != BE_STATE_STOPPED &&
 		be->be_state != BE_STATE_DELETED)
 	{
-		LDAPDebug( LDAP_DEBUG_TRACE, 
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 				  "ldbm_back_cleanup: warning - backend is in a wrong state - %d\n", 
 				  be->be_state, 0, 0 );
 		PR_Unlock (be->be_state_lock);
diff --git a/ldap/servers/slapd/back-ldbm/close.c b/ldap/servers/slapd/back-ldbm/close.c
index 2032dbd..b69e2d5 100644
--- a/ldap/servers/slapd/back-ldbm/close.c
+++ b/ldap/servers/slapd/back-ldbm/close.c
@@ -19,7 +19,7 @@ int ldbm_back_close( Slapi_PBlock *pb )
 {
 	struct ldbminfo	*li;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "ldbm backend syncing\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm backend syncing\n", 0, 0, 0 );
 	slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li );
 	
 	/* Kill off any sleeping threads by setting this flag */
@@ -32,7 +32,7 @@ int ldbm_back_close( Slapi_PBlock *pb )
 	/* close down all the ldbm instances */
 	dblayer_close( li, DBLAYER_NORMAL_MODE );
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "ldbm backend done syncing\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm backend done syncing\n", 0, 0, 0 );
 	return 0;
 }
 
@@ -40,10 +40,10 @@ int ldbm_back_flush( Slapi_PBlock *pb )
 {
 	struct ldbminfo	*li;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "ldbm backend flushing\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm backend flushing\n", 0, 0, 0 );
 	slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li );
 	dblayer_flush( li );
-	LDAPDebug( LDAP_DEBUG_TRACE, "ldbm backend done flushing\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm backend done flushing\n", 0, 0, 0 );
 	return 0;
 }
 
@@ -56,5 +56,5 @@ void ldbm_back_instance_set_destructor(void **arg)
 	/* This function is called when the instance set is destroyed.
 	 * I can't really think of anything we should do here, but that
 	 * may change in the future. */
-	LDAPDebug(LDAP_DEBUG_ANY, "Set of instances destroyed\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Set of instances destroyed\n", 0, 0, 0);
 }
diff --git a/ldap/servers/slapd/back-ldbm/dbhelp.c b/ldap/servers/slapd/back-ldbm/dbhelp.c
index 27079c9..c40a9fa 100644
--- a/ldap/servers/slapd/back-ldbm/dbhelp.c
+++ b/ldap/servers/slapd/back-ldbm/dbhelp.c
@@ -41,10 +41,10 @@ dblayer_copy_file_keybykey(DB_ENV *env,
 	int mode = 0;
 	char *p = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> dblayer_copy_file_keybykey\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> dblayer_copy_file_keybykey\n", 0, 0, 0 );
 
 	if (!env) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Out of memory\n", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, Out of memory\n", 0, 0, 0);
 		goto error;
 	}
 
@@ -55,28 +55,28 @@ dblayer_copy_file_keybykey(DB_ENV *env,
 	/* Open the source file */
 	retval = db_create(&source_file, env, 0);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Create error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, Create error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 	retval = (source_file->open)(source_file, NULL, source_file_name, NULL, DB_UNKNOWN, DB_RDONLY, 0);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Open error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, Open error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 	/* Get the info we need from the source file */
 	retval = source_file->get_flags(source_file, &dbflags);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, get_flags error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, get_flags error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 	retval = source_file->get_type(source_file, &dbtype);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, get_type error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, get_type error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 	retval = source_file->get_pagesize(source_file, &dbpagesize);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, get_pagesize error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, get_pagesize error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 	/* Open the destination file
@@ -84,17 +84,17 @@ dblayer_copy_file_keybykey(DB_ENV *env,
 	 */
 	retval = db_create(&destination_file, env, 0);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Create error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, Create error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 	retval = destination_file->set_flags(destination_file,dbflags);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, set_flags error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, set_flags error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 	retval = destination_file->set_pagesize(destination_file,dbpagesize);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, set_pagesize error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, set_pagesize error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 
@@ -139,13 +139,13 @@ dblayer_copy_file_keybykey(DB_ENV *env,
 
 	retval = (destination_file->open)(destination_file, NULL, destination_file_name, NULL, dbtype, DB_CREATE | DB_EXCL, mode);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Open error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, Open error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 	/* Open a cursor on the source file */
 	retval = source_file->cursor(source_file,NULL,&source_cursor,0);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Create cursor error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, Create cursor error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 	/* Seek to the first key */
@@ -160,7 +160,7 @@ dblayer_copy_file_keybykey(DB_ENV *env,
 			 * In either case, set finished=1 so we can hop down and close the cursor. */
 			if ( DB_NOTFOUND != retval )
 			{
-				LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, c_get error %d: %s\n", retval, db_strerror(retval), 0);
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, c_get error %d: %s\n", retval, db_strerror(retval), 0);
 				goto error;
 			}
 			retval = 0; /* DB_NOTFOUND was OK... */
@@ -169,7 +169,7 @@ dblayer_copy_file_keybykey(DB_ENV *env,
 			/* For each key, insert into the destination file */
 			retval = destination_file->put(destination_file, NULL, &key, &data, 0);
 			if (retval) {
-				LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, put error %d: %s\n", retval, db_strerror(retval), 0);
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, put error %d: %s\n", retval, db_strerror(retval), 0);
 				goto error;
 			}
 			cursor_flag = DB_NEXT;
@@ -181,7 +181,7 @@ error:
 	if (source_cursor) {
 		retval_cleanup = source_cursor->c_close(source_cursor);
 		if (retval_cleanup) {
-			LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Close cursor error %d: %s\n", retval_cleanup, db_strerror(retval_cleanup), 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, Close cursor error %d: %s\n", retval_cleanup, db_strerror(retval_cleanup), 0);
 			retval += retval_cleanup;
 		}
 	}
@@ -190,7 +190,7 @@ error:
 		retval_cleanup = source_file->close(source_file,0);
 		source_file = NULL;
 		if (retval_cleanup) {
-			LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Close error %d: %s\n", retval_cleanup, db_strerror(retval_cleanup), 0); 
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, Close error %d: %s\n", retval_cleanup, db_strerror(retval_cleanup), 0); 
 			retval += retval_cleanup;
 		}
 	}
@@ -199,12 +199,12 @@ error:
 		retval_cleanup = destination_file->close(destination_file,0);
 		destination_file = NULL;
 		if (retval_cleanup) {
-			LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Close error %d: %s\n", retval_cleanup, db_strerror(retval_cleanup), 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_keybykey, Close error %d: %s\n", retval_cleanup, db_strerror(retval_cleanup), 0);
 			retval += retval_cleanup;
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= dblayer_copy_file_keybykey\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= dblayer_copy_file_keybykey\n", 0, 0, 0 );
 	return retval;
 }
 
@@ -219,19 +219,19 @@ dblayer_copy_file_resetlsns(char *home_dir,
 	int retval = 0;
 	DB_ENV *env = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> dblayer_copy_file_resetlsns\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> dblayer_copy_file_resetlsns\n", 0, 0, 0 );
 	/* Make the environment */
 
 	retval = dblayer_make_private_simple_env(home_dir,&env);
 	if (retval || !env) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_resetlsns: Call to dblayer_make_private_simple_env failed!\n" 
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_resetlsns: Call to dblayer_make_private_simple_env failed!\n" 
 			"Unable to open an environment.", 0, 0, 0);
 		goto out;
 	}
 	/* Do the copy */
 	retval = dblayer_copy_file_keybykey(env, source_file_name, destination_file_name, overwrite, priv, inst);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_resetlsns: Copy not completed successfully.", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_resetlsns: Copy not completed successfully.", 0, 0, 0);
 	}
 out:
 	/* Close the environment */
@@ -241,12 +241,12 @@ out:
 		if (retval2) {
 			if (0 == retval) {
 				retval = retval2;
-				LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_resetlsns, error %d: %s\n", retval, db_strerror(retval), 0);
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copy_file_resetlsns, error %d: %s\n", retval, db_strerror(retval), 0);
 			}
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= dblayer_copy_file_resetlsns\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= dblayer_copy_file_resetlsns\n", 0, 0, 0 );
 	return retval;
 }
 
@@ -275,16 +275,16 @@ int dblayer_make_private_recovery_env(char *db_home_dir, dblayer_private *priv,
 	int retval = 0;
 	DB_ENV *ret_env = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> dblayer_make_private_recovery_env\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> dblayer_make_private_recovery_env\n", 0, 0, 0 );
 	if (NULL == env) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_recovery_env: Null environment.  Cannot continue.", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_make_private_recovery_env: Null environment.  Cannot continue.", 0, 0, 0);
 		return -1;
 	}
 	*env = NULL;
 
 	retval = db_env_create(&ret_env,0);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_recovery_env, Create error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_make_private_recovery_env, Create error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 	dblayer_set_env_debugging(ret_env, priv);
@@ -293,12 +293,12 @@ int dblayer_make_private_recovery_env(char *db_home_dir, dblayer_private *priv,
 	if (0 == retval) {
 		*env = ret_env;
 	} else {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_recovery_env, Open error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_make_private_recovery_env, Open error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 
 error:
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= dblayer_make_private_recovery_env\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= dblayer_make_private_recovery_env\n", 0, 0, 0 );
 	return retval;
 }
 
@@ -308,16 +308,16 @@ int dblayer_make_private_simple_env(char *db_home_dir, DB_ENV **env)
 	int retval = 0;
 	DB_ENV *ret_env = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> dblayer_make_private_simple_env\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> dblayer_make_private_simple_env\n", 0, 0, 0 );
 	if (NULL == env) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_simple_env: Null environment.  Cannot continue.", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_make_private_simple_env: Null environment.  Cannot continue.", 0, 0, 0);
 		return -1;
 	}
 	*env = NULL;
 
 	retval = db_env_create(&ret_env,0);
 	if (retval) {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_simple_env, error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_make_private_simple_env, error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 
@@ -325,11 +325,11 @@ int dblayer_make_private_simple_env(char *db_home_dir, DB_ENV **env)
 	if (0 == retval) {
 		*env = ret_env;
 	} else {
-		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_simple_env, error %d: %s\n", retval, db_strerror(retval), 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_make_private_simple_env, error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
 
 error:
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= dblayer_make_private_simple_env\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= dblayer_make_private_simple_env\n", 0, 0, 0 );
 	return retval;
 }
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 33287d4..dafd093 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -321,11 +321,11 @@ dblayer_set_batch_transactions(void *arg, void *value, char *errorbuf, int phase
             } else if(val > 0) {
                 if(trans_batch_limit == FLUSH_REMOTEOFF){
                     /* this requires a server restart to take effect */
-                    LDAPDebug(LDAP_DEBUG_ANY,"dblayer_set_batch_transactions: enabling batch transactions "
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"dblayer_set_batch_transactions: enabling batch transactions "
                             "requires a server restart.\n",0,0,0);
                 } else if (!log_flush_thread){
                     /* we are already disabled, log a reminder of that fact. */
-                    LDAPDebug(LDAP_DEBUG_ANY,"dblayer_set_batch_transactions: batch transactions was "
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"dblayer_set_batch_transactions: batch transactions was "
                             "previously disabled, this update requires a server restart.\n",0,0,0);
                 }
                 trans_batch_limit=val;
@@ -356,7 +356,7 @@ dblayer_set_batch_txn_min_sleep(void *arg, void *value, char *errorbuf, int phas
             } else if(val > 0) {
                 if(trans_batch_txn_min_sleep == FLUSH_REMOTEOFF || !log_flush_thread){
                     /* this really has no effect until batch transactions are enabled */
-                    LDAPDebug(LDAP_DEBUG_ANY,"dblayer_set_batch_txn_min_sleep: Warning batch transactions "
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"dblayer_set_batch_txn_min_sleep: Warning batch transactions "
                             "is not enabled.\n",0,0,0);
                 }
                 trans_batch_txn_min_sleep = val;
@@ -387,7 +387,7 @@ dblayer_set_batch_txn_max_sleep(void *arg, void *value, char *errorbuf, int phas
             } else if(val > 0) {
                 if(trans_batch_txn_max_sleep == FLUSH_REMOTEOFF || !log_flush_thread){
                 	/* this really has no effect until batch transactions are enabled */
-                    LDAPDebug(LDAP_DEBUG_ANY,"dblayer_set_batch_txn_max_sleep: Warning batch transactions "
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"dblayer_set_batch_txn_max_sleep: Warning batch transactions "
                             "is not enabled.\n",0,0,0);
                 }
                 trans_batch_txn_max_sleep = val;
@@ -453,7 +453,7 @@ static int _dblayer_check_version(dblayer_private *priv)
     }
     /* DB3X: always POST 24 :) */
     priv->dblayer_lib_version = DBLAYER_LIB_VERSION_POST_24;
-    LDAPDebug(LDAP_DEBUG_TRACE,"version check: %s (%d.%d)\n", string, major, minor);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"version check: %s (%d.%d)\n", string, major, minor);
     return ret;
 }
 
@@ -480,7 +480,7 @@ dblayer_get_home_dir(struct ldbminfo *li, int *dbhome)
     }
     if (NULL == home_dir)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,"Db home directory is not set. "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Db home directory is not set. "
             "Possibly %s (optionally %s) is missing in the config file.\n",
             CONFIG_DIRECTORY, CONFIG_DB_HOME_DIRECTORY, 0);
     }
@@ -510,7 +510,7 @@ void dblayer_log_print(const char* prefix, char *buffer)
 #endif
 {
     /* We ignore the prefix since we know who we are anyway */
-    LDAPDebug(LDAP_DEBUG_ANY,"libdb: %s\n", buffer, 0, 0);    
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"libdb: %s\n", buffer, 0, 0);    
 }
 
 void dblayer_remember_disk_filled(struct ldbminfo *li)
@@ -664,7 +664,7 @@ static int dblayer_override_libdb_functions(DB_ENV *pEnv, dblayer_private *priv)
     db_env_set_func_seek((int (*)(int, off_t, int))dblayer_seek24_large);
 #endif
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "Enabled 64-bit files\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Enabled 64-bit files\n", 0, 0, 0);
 #endif   /* DB_USE_64LFS */
     return 0;
 }
@@ -759,7 +759,7 @@ static void dblayer_select_ncache(size_t cachesize, int *ncachep)
 #if defined(__LP64__) || defined (_LP64)
 	if ( (sizeof(cachesize) > 4) && (cachesize > (4L * GIGABYTE))) {
 		*ncachep = (cachesize / (4L * GIGABYTE)) + 1;
-		LDAPDebug(LDAP_DEBUG_ANY,"Setting ncache to: %d to keep each chunk below 4Gbytes\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Setting ncache to: %d to keep each chunk below 4Gbytes\n",
 			*ncachep, 0, 0);
 	}
 #endif
@@ -818,7 +818,7 @@ cleanup:
             slapi_ch_free((void **)&head[i]);
         }
         if (myncache == mymaxncache) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "WARNING: dbcachesize %lu too big\n", cachesize, 0, 0);
             myncache = 0;
             found = -1;
@@ -874,41 +874,41 @@ static void dblayer_init_dbenv(DB_ENV *pEnv, dblayer_private *priv)
 static void dblayer_dump_config_tracing(dblayer_private *priv)
 {
     if (priv->dblayer_home_directory) {
-        LDAPDebug(LDAP_DEBUG_TRACE,"home_directory=%s\n",priv->dblayer_home_directory,0,0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"home_directory=%s\n",priv->dblayer_home_directory,0,0);
     }
     if (priv->dblayer_log_directory) {
-        LDAPDebug(LDAP_DEBUG_TRACE,"log_directory=%s\n",priv->dblayer_log_directory,0,0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"log_directory=%s\n",priv->dblayer_log_directory,0,0);
     }
     if (priv->dblayer_dbhome_directory) {
-        LDAPDebug(LDAP_DEBUG_TRACE,"dbhome_directory=%s\n",priv->dblayer_dbhome_directory,0,0);
-    }
-    LDAPDebug(LDAP_DEBUG_TRACE,"trickle_percentage=%d\n",priv->dblayer_trickle_percentage,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"page_size=%lu\n",priv->dblayer_page_size,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"index_page_size=%lu\n",priv->dblayer_index_page_size,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"cachesize=%lu\n",priv->dblayer_cachesize,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"previous_cachesize=%lu\n",priv->dblayer_previous_cachesize,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"ncache=%d\n",priv->dblayer_ncache,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"previous_ncache=%d\n",priv->dblayer_previous_ncache,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"recovery_required=%d\n",priv->dblayer_recovery_required,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"durable_transactions=%d\n",priv->dblayer_durable_transactions,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"checkpoint_interval=%d\n",priv->dblayer_checkpoint_interval,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"transaction_batch_val=%d\n",trans_batch_limit,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"circular_logging=%d\n",priv->dblayer_circular_logging,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"idl_divisor=%d\n",priv->dblayer_idl_divisor,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"logfile_size=%lu\n",priv->dblayer_logfile_size,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"logbuf_size=%lu\n",priv->dblayer_logbuf_size,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"file_mode=%d\n",priv->dblayer_file_mode,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"cache_config=%d\n",priv->dblayer_cache_config,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"lib_version=%d\n",priv->dblayer_lib_version,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"spin_count=%d\n",priv->dblayer_spin_count,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"named_regions=%d\n",priv->dblayer_named_regions,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"private mem=%d\n",priv->dblayer_private_mem,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"private import mem=%d\n",priv->dblayer_private_import_mem,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"shm_key=%ld\n",priv->dblayer_shm_key,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"lockdown=%d\n",priv->dblayer_lockdown,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"locks=%d\n",priv->dblayer_lock_config,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"previous_locks=%d\n",priv->dblayer_previous_lock_config,0,0);
-    LDAPDebug(LDAP_DEBUG_TRACE,"tx_max=%d\n",priv->dblayer_tx_max,0,0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"dbhome_directory=%s\n",priv->dblayer_dbhome_directory,0,0);
+    }
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"trickle_percentage=%d\n",priv->dblayer_trickle_percentage,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"page_size=%lu\n",priv->dblayer_page_size,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"index_page_size=%lu\n",priv->dblayer_index_page_size,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"cachesize=%lu\n",priv->dblayer_cachesize,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"previous_cachesize=%lu\n",priv->dblayer_previous_cachesize,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"ncache=%d\n",priv->dblayer_ncache,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"previous_ncache=%d\n",priv->dblayer_previous_ncache,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"recovery_required=%d\n",priv->dblayer_recovery_required,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"durable_transactions=%d\n",priv->dblayer_durable_transactions,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"checkpoint_interval=%d\n",priv->dblayer_checkpoint_interval,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"transaction_batch_val=%d\n",trans_batch_limit,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"circular_logging=%d\n",priv->dblayer_circular_logging,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"idl_divisor=%d\n",priv->dblayer_idl_divisor,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"logfile_size=%lu\n",priv->dblayer_logfile_size,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"logbuf_size=%lu\n",priv->dblayer_logbuf_size,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"file_mode=%d\n",priv->dblayer_file_mode,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"cache_config=%d\n",priv->dblayer_cache_config,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"lib_version=%d\n",priv->dblayer_lib_version,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"spin_count=%d\n",priv->dblayer_spin_count,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"named_regions=%d\n",priv->dblayer_named_regions,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"private mem=%d\n",priv->dblayer_private_mem,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"private import mem=%d\n",priv->dblayer_private_import_mem,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"shm_key=%ld\n",priv->dblayer_shm_key,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"lockdown=%d\n",priv->dblayer_lockdown,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"locks=%d\n",priv->dblayer_lock_config,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"previous_locks=%d\n",priv->dblayer_previous_lock_config,0,0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"tx_max=%d\n",priv->dblayer_tx_max,0,0);
 }
 
 /* Check a given filesystem directory for access we need */
@@ -983,7 +983,7 @@ static int dblayer_grok_directory(char *directory, int flags)
                 }
                 /* If we're here, it means that we did not have the requested
                  * permission on this file */
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "WARNING---no %s permission to file %s\n",
                     access_string,filename,0);
             } else {
@@ -1062,7 +1062,7 @@ dblayer_make_env(struct dblayer_private_env **env, struct ldbminfo *li)
                                                    sizeof(dblayer_private_env));
 
     if ((ret = db_env_create(&pEnv->dblayer_DB_ENV, 0)) != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "ERROR -- Failed to create DB_ENV (returned: %d).\n",
                   ret, 0, 0);
     }
@@ -1120,7 +1120,7 @@ dblayer_make_env(struct dblayer_private_env **env, struct ldbminfo *li)
         *env = pEnv;
         pEnv = NULL; /* do not free below */
     } else {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "ERROR -- Failed to create RWLock (returned: %d).\n", 
             ret, 0, 0);
     }
@@ -1241,7 +1241,7 @@ no_diskspace(struct ldbminfo *li, int dbenv_flags)
     char *region_dir;
 
     if (statvfs(li->li_directory, &db_buf) < 0){
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "Cannot get file system info for (%s); file system corrupted?\n",
             li->li_directory, 0, 0);
         return 1;
@@ -1257,7 +1257,7 @@ no_diskspace(struct ldbminfo *li, int dbenv_flags)
             /* Calculate the available space as long as we are not using shared memory */
             if(using_region_files){
                 if(statvfs(li->li_dblayer_private->dblayer_dbhome_directory, &dbhome_buf) < 0){
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                         "Cannot get file system info for (%s); file system corrupted?\n",
                         li->li_dblayer_private->dblayer_dbhome_directory, 0, 0);
                     return 1;
@@ -1278,7 +1278,7 @@ no_diskspace(struct ldbminfo *li, int dbenv_flags)
 
         /* Check if we have enough space */
         if (fsiz < expected_siz){
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "No enough space left on device (%s) (%lu bytes); "
                 "at least %lu bytes space is needed for db region files\n",
                 region_dir, fsiz, expected_siz);
@@ -1324,11 +1324,11 @@ dblayer_start(struct ldbminfo *li, int dbmode)
 
     if (NULL != priv->dblayer_env) {
         if (CATASTROPHIC == priv->dblayer_env) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "Error: DB previously failed to start.\n", 0, 0, 0);
             return -1;
         } else {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "Warning: DB already started.\n", 0, 0, 0);
             return 0;
         }
@@ -1337,7 +1337,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
     /* DBDB we should pick these up in our config routine, and do away with
      *  the li_ one */
     if (NULL == li->li_directory || '\0' == *li->li_directory) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "Error: DB directory is not specified.\n", 0, 0, 0);
         return -1;
     }
@@ -1363,7 +1363,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
     return_value = dblayer_grok_directory(region_dir,
                                           DBLAYER_DIRECTORY_READWRITE_ACCESS);
     if (0 != return_value) {
-        LDAPDebug(LDAP_DEBUG_ANY,"Can't start because the database "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Can't start because the database "
                   "directory \"%s\" either doesn't exist, or is not "
                   "accessible\n", region_dir, 0, 0);
         return return_value;
@@ -1375,7 +1375,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
         return_value = dblayer_grok_directory(log_dir,
                            DBLAYER_DIRECTORY_READWRITE_ACCESS);
         if (0 != return_value) {
-            LDAPDebug(LDAP_DEBUG_ANY,"Can't start because the log "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Can't start because the log "
                       "directory \"%s\" either doesn't exist, or is not "
                       "accessible\n", log_dir, 0, 0);
             return return_value;
@@ -1386,7 +1386,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
      * the available phys mem */
     if (!util_is_cachesize_sane(&(priv->dblayer_cachesize))) {
         /* Oops---looks like the admin misconfigured, let's warn them */
-        LDAPDebug(LDAP_DEBUG_ANY,"WARNING---Likely CONFIGURATION ERROR---"
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"WARNING---Likely CONFIGURATION ERROR---"
                   "dbcachesize is configured to use more than the available "
                   "physical memory, decreased to the largest available size (%lu bytes).\n",
                   priv->dblayer_cachesize, 0, 0);
@@ -1421,13 +1421,13 @@ dblayer_start(struct ldbminfo *li, int dbmode)
         if (priv->dblayer_recovery_required) {
             open_flags |= DB_RECOVER;
             if (DBLAYER_RESTORE_MODE & dbmode) {
-                LDAPDebug(LDAP_DEBUG_ANY, "Recovering database after restore "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Recovering database after restore "
                           "from archive.\n", 0, 0, 0);
             } else if (DBLAYER_CLEAN_RECOVER_MODE & dbmode) {
-                LDAPDebug(LDAP_DEBUG_ANY, "Clean up db environment and start "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Clean up db environment and start "
                           "from archive.\n", 0, 0, 0);
             } else {
-                LDAPDebug(LDAP_DEBUG_ANY, "Detected Disorderly Shutdown last "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Detected Disorderly Shutdown last "
                           "time Directory Server was running, recovering "
                           "database.\n", 0, 0, 0);
                 slapi_disordely_shutdown(PR_TRUE);
@@ -1448,7 +1448,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
     }
 
     if (priv->dblayer_private_mem) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "WARNING: Server is running with nsslapd-db-private-mem on; "
                   "No other process is allowed to access the database\n",
                   0, 0, 0);
@@ -1473,11 +1473,11 @@ dblayer_start(struct ldbminfo *li, int dbmode)
          (priv->dblayer_lock_config != priv->dblayer_previous_lock_config)) &&
         !(dbmode & (DBLAYER_ARCHIVE_MODE|DBLAYER_EXPORT_MODE)) ) {
         if (priv->dblayer_cachesize != priv->dblayer_previous_cachesize) {
-            LDAPDebug(LDAP_DEBUG_ANY, "resizing db cache size: %lu -> %lu\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "resizing db cache size: %lu -> %lu\n",
                       priv->dblayer_previous_cachesize, priv->dblayer_cachesize, 0);
         }
         if (priv->dblayer_ncache != priv->dblayer_previous_ncache) {
-            LDAPDebug(LDAP_DEBUG_ANY, "resizing db cache count: %d -> %d\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "resizing db cache count: %d -> %d\n",
                       priv->dblayer_previous_ncache, priv->dblayer_ncache, 0);
         }
         if (priv->dblayer_lock_config != priv->dblayer_previous_lock_config) {
@@ -1491,7 +1491,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
                 priv->dblayer_lock_config = 10000;
             }
             if (priv->dblayer_lock_config != priv->dblayer_previous_lock_config) {
-                LDAPDebug(LDAP_DEBUG_ANY, "resizing max db lock count: %d -> %d\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "resizing max db lock count: %d -> %d\n",
                       priv->dblayer_previous_lock_config, priv->dblayer_lock_config, 0);
             }
         }
@@ -1501,7 +1501,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
          * the DB_ENV (pEnv) needs to be created again.
          */
         if ((return_value = dblayer_make_env(&pEnv, li)) != 0) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "ERROR -- Failed to create DBENV (returned: %d).\n",
                       return_value, 0, 0);
         }
@@ -1514,7 +1514,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
         if(priv->dblayer_logbuf_size >= 32768) {
             pEnv->dblayer_DB_ENV->set_lg_bsize(pEnv->dblayer_DB_ENV,priv->dblayer_logbuf_size);
         } else {
-            LDAPDebug(LDAP_DEBUG_ANY, "using default value for log bufsize because configured value (%lu) is too small.\n", 
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "using default value for log bufsize because configured value (%lu) is too small.\n", 
             priv->dblayer_logbuf_size, 0, 0);
         }
     }
@@ -1537,7 +1537,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
             return_value = thisenv->remove(thisenv, region_dir, DB_FORCE);
             if (0 != return_value)
             {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "dblayer_start: failed to remove old db env "
                           "in %s: %s\n", region_dir, 
                           dblayer_strerror(return_value), 0);
@@ -1547,7 +1547,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
 
             if ((return_value = dblayer_make_env(&pEnv, li)) != 0)
             {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "ERROR -- Failed to create DBENV (returned: %d).\n",
                           return_value, 0, 0);
                 return return_value;
@@ -1566,17 +1566,17 @@ dblayer_start(struct ldbminfo *li, int dbmode)
                  * https://blackflag.mcom.com/show_bug.cgi?id=557319
                  * Crash ns-slapd while running scalab01 after restart slapd
                  */
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "mmap in opening database environment (recovery mode) "
                           "failed trying to allocate %lu bytes. (OS err %d - %s)\n",
                           li->li_dbcachesize, return_value, dblayer_strerror(return_value));
                 dblayer_free_env(&priv->dblayer_env);
                 priv->dblayer_env = CATASTROPHIC;
             } else {
-                LDAPDebug(LDAP_DEBUG_ANY, "Database Recovery Process FAILED. "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Database Recovery Process FAILED. "
                           "The database is not recoverable. err=%d: %s\n",
                           return_value, dblayer_strerror(return_value), 0);
-                LDAPDebug(LDAP_DEBUG_ANY, 
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                           "Please make sure there is enough disk space for "
                           "dbcache (%lu bytes) and db region files\n",
                           li->li_dbcachesize, 0, 0);
@@ -1586,7 +1586,7 @@ dblayer_start(struct ldbminfo *li, int dbmode)
             open_flags &= ~(DB_RECOVER | DB_RECOVER_FATAL);
             pEnv->dblayer_DB_ENV->close(pEnv->dblayer_DB_ENV, 0);
             if ((return_value = dblayer_make_env(&pEnv, li)) != 0) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "ERROR -- Failed to create DBENV (returned: %d).\n",
                           return_value, 0, 0);
                 return return_value;
@@ -1665,14 +1665,14 @@ dblayer_start(struct ldbminfo *li, int dbmode)
                  * https://blackflag.mcom.com/show_bug.cgi?id=557319
                  * Crash ns-slapd while running scalab01 after restart slapd
                  */
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "mmap in opening database environment "
                       "failed trying to allocate %d bytes. (OS err %lu - %s)\n",
                       li->li_dbcachesize, return_value, dblayer_strerror(return_value));
                 dblayer_free_env(&priv->dblayer_env);
                 priv->dblayer_env = CATASTROPHIC;
             } else {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "Opening database environment (%s) failed. err=%d: %s\n",
                       region_dir, return_value, dblayer_strerror(return_value));
             }
@@ -1713,7 +1713,7 @@ check_and_set_import_cache(struct ldbminfo *li)
                        pagesize, pages);
         return ENOENT;
     }
-    LDAPDebug(LDAP_DEBUG_ANY, "check_and_set_import_cache: "
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "check_and_set_import_cache: "
                   "pagesize: %ld, pages: %ld, procpages: %ld\n",
                   pagesize, pages, procpages);
 
@@ -1757,7 +1757,7 @@ check_and_set_import_cache(struct ldbminfo *li)
 
     page_delta = pages - import_pages;
     if (page_delta < hard_limit) {
-        LDAPDebug(LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
             "After allocating import cache %ldKB, "
             "the available memory is %ldKB, "
             "which is less than the hard limit %ldKB. "
@@ -1767,7 +1767,7 @@ check_and_set_import_cache(struct ldbminfo *li)
         return ENOMEM;
     }
     if (page_delta < soft_limit) {
-        LDAPDebug(LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
             "WARNING: After allocating import cache %ldKB, "
             "the available memory is %ldKB, "
             "which is less than the soft limit %ldKB. "
@@ -1833,21 +1833,21 @@ int dblayer_instance_start(backend *be, int mode)
     priv = (dblayer_private*)li->li_dblayer_private;
     pEnv = priv->dblayer_env;
     if (CATASTROPHIC == pEnv || NULL == pEnv) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "instance %s: dbenv is not available (0x%x).\n", 
                   inst?inst->inst_name:"unknown", pEnv, 0);
         return return_value;
     }
 
     if (NULL != inst->inst_id2entry) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Warning: DB instance \"%s\" already started.\n",
                   inst->inst_name, 0, 0);
         return 0;
     }
 
     if (attrcrypt_init(inst)) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Error: unable to initialize attrcrypt system for %s\n",
                   inst->inst_name, 0, 0);
         return return_value;
@@ -1866,12 +1866,12 @@ int dblayer_instance_start(backend *be, int mode)
         return_value = dblayer_grok_directory(inst_dirp,
                                           DBLAYER_DIRECTORY_READWRITE_ACCESS);
     } else {
-        LDAPDebug(LDAP_DEBUG_ANY,"Can't start because the database instance "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Can't start because the database instance "
                       "directory is NULL\n", 0, 0, 0);
         goto errout;
     }
     if (0 != return_value) {
-        LDAPDebug(LDAP_DEBUG_ANY,"Can't start because the database instance "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Can't start because the database instance "
                       "directory \"%s\" either doesn't exist, "
                       "or the db files are not accessible\n",
                       inst_dirp, 0, 0);
@@ -1889,7 +1889,7 @@ int dblayer_instance_start(backend *be, int mode)
             char *dataversion = NULL;
 
             if (dbversion_read(li, inst_dirp, &ldbmversion, &dataversion) != 0) {
-                LDAPDebug(LDAP_DEBUG_ANY, "Warning: Unable to read dbversion "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: Unable to read dbversion "
                           "file in %s\n", inst->inst_dir_name, 0, 0);
             } else {
                 int rval = 0;
@@ -1905,7 +1905,7 @@ int dblayer_instance_start(backend *be, int mode)
                 rval = check_db_inst_version(inst);
                 if (rval & DBVERSION_NOT_SUPPORTED)
                 {
-                    LDAPDebug(LDAP_DEBUG_ANY, "Instance %s does not have the "
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Instance %s does not have the "
                               "expected version\n", inst->inst_name, 0, 0);
                     PR_ASSERT(0);
                     slapi_ch_free_string(&dataversion);
@@ -1943,7 +1943,7 @@ int dblayer_instance_start(backend *be, int mode)
                 rval = ldbm_upgrade(inst, rval);
                 if (0 != rval)
                 {
-                    LDAPDebug(LDAP_DEBUG_ANY, "Upgrading instance %s failed\n",
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Upgrading instance %s failed\n",
                               inst->inst_name, 0, 0);
                     PR_ASSERT(0);
                     return_value = -1;
@@ -1952,7 +1952,7 @@ int dblayer_instance_start(backend *be, int mode)
                 /**
                 if (rval & DBVERSION_NEED_IDL_OLD2NEW)
                 {
-                    LDAPDebug(LDAP_DEBUG_ANY, 
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                         "Instance %s: idl-switch is new while db idl format is "
                         "old, modify nsslapd-idl-switch in dse.ldif to old\n",
                         inst->inst_name, 0, 0);
@@ -1961,7 +1961,7 @@ int dblayer_instance_start(backend *be, int mode)
                 }
                 else if (rval & DBVERSION_NEED_IDL_NEW2OLD)
                 {
-                    LDAPDebug(LDAP_DEBUG_ANY, 
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                         "Instance %s: idl-switch is old while db idl format is "
                         "new, modify nsslapd-idl-switch in dse.ldif to new\n",
                         inst->inst_name, 0, 0);
@@ -2008,7 +2008,7 @@ int dblayer_instance_start(backend *be, int mode)
              * but nsslapd-db-private-import-mem should work with import,
              * as well */
             if (priv->dblayer_private_import_mem) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "WARNING: Import is running with "
                   "nsslapd-db-private-import-mem on; "
                   "No other process is allowed to access the database\n",
@@ -2038,7 +2038,7 @@ int dblayer_instance_start(backend *be, int mode)
             /* use our own env */
             return_value = dblayer_make_env(&mypEnv, li);
             if (return_value != 0) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "Unable to create new DB_ENV for import/export! %d\n",
                           return_value, 0, 0);
                 goto out;
@@ -2059,7 +2059,7 @@ int dblayer_instance_start(backend *be, int mode)
                                                        oflags,
                                                        priv->dblayer_file_mode);
             if (return_value != 0) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "Unable to open new DB_ENV for import/export! %d\n",
                           return_value, 0, 0);
                 goto out;
@@ -2072,7 +2072,7 @@ int dblayer_instance_start(backend *be, int mode)
         inst->inst_id2entry = NULL;
         return_value = db_create(&inst->inst_id2entry, mypEnv->dblayer_DB_ENV, 0);
         if (0 != return_value) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "Unable to create id2entry db file! %d\n",
                       return_value, 0, 0);
             goto out;
@@ -2083,7 +2083,7 @@ int dblayer_instance_start(backend *be, int mode)
             (priv->dblayer_page_size == 0) ? DBLAYER_PAGESIZE :
             priv->dblayer_page_size);
         if (0 != return_value) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "dbp->set_pagesize(%lu or %lu) failed %d\n",
                       priv->dblayer_page_size, DBLAYER_PAGESIZE,
                       return_value);
@@ -2121,7 +2121,7 @@ int dblayer_instance_start(backend *be, int mode)
                 (priv->dblayer_page_size == 0) ? DBLAYER_PAGESIZE :
                 priv->dblayer_page_size);
             if (0 != return_value) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "dbp->set_pagesize(%lu or %lu) failed %d\n",
                       priv->dblayer_page_size, DBLAYER_PAGESIZE,
                       return_value);
@@ -2143,7 +2143,7 @@ int dblayer_instance_start(backend *be, int mode)
                 dbp, NULL/* txnid */, id2entry_file, subname, DB_BTREE,
                 open_flags, priv->dblayer_file_mode, return_value);
         if (0 != return_value) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "dbp->open(\"%s\") failed: %s (%d)\n",
                       id2entry_file, dblayer_strerror(return_value),
                       return_value);
@@ -2153,7 +2153,7 @@ int dblayer_instance_start(backend *be, int mode)
             if (strstr(dblayer_strerror(return_value),
                        "No such file or directory"))
             {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "Instance %s is not registered as a db data directory. "
                       "Please restart the server to create it.\n",
                       inst?inst->inst_name:"unknown", pEnv, 0);
@@ -2161,7 +2161,7 @@ int dblayer_instance_start(backend *be, int mode)
             else if (strstr(dblayer_strerror(return_value),
                             "Permission denied"))
             {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "Instance directory %s may not be writable\n",
                           inst_dirp, 0, 0);
             }
@@ -2200,14 +2200,14 @@ out:
      * being imported or is in normal mode
      */
     if (inst->inst_nextid > MAXID && !(mode & DBLAYER_EXPORT_MODE)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "dblayer_instance_start fail: backend '%s' "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_instance_start fail: backend '%s' "
             "has no IDs left. DATABASE MUST BE REBUILT.\n",
             be->be_name, 0, 0);
         return 1;
     }
 
     if (return_value != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY, "dblayer_instance_start fail: %s (%d)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_instance_start fail: %s (%d)\n",
             dblayer_strerror(return_value), return_value, 0);   
     }
 errout:
@@ -2299,7 +2299,7 @@ dblayer_get_aux_id2entry_ext(backend *be, DB **ppDB, DB_ENV **ppEnv,
     inst = (ldbm_instance *) be->be_instance_info;
     if (NULL == inst)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "No instance/env: persistent id2entry is not available\n", 0, 0, 0);
         goto done;
     }
@@ -2307,7 +2307,7 @@ dblayer_get_aux_id2entry_ext(backend *be, DB **ppDB, DB_ENV **ppEnv,
     li = inst->inst_li;
     if (NULL == li)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "No ldbm info: persistent id2entry is not available\n", 0, 0, 0);
         goto done;
     }
@@ -2315,7 +2315,7 @@ dblayer_get_aux_id2entry_ext(backend *be, DB **ppDB, DB_ENV **ppEnv,
     opriv = li->li_dblayer_private;
     if (NULL == opriv)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "No dblayer info: persistent id2entry is not available\n", 0, 0, 0);
         goto done;
     }
@@ -2330,7 +2330,7 @@ dblayer_get_aux_id2entry_ext(backend *be, DB **ppDB, DB_ENV **ppEnv,
     }
     else
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
           "Instance dir is NULL: persistent id2entry is not available\n",
           0, 0, 0);
         goto done;
@@ -2340,7 +2340,7 @@ dblayer_get_aux_id2entry_ext(backend *be, DB **ppDB, DB_ENV **ppEnv,
     prst = PR_GetFileInfo64(inst_dirp, &prfinfo);
     if (PR_FAILURE == prst || PR_FILE_DIRECTORY != prfinfo.type)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "No inst dir: persistent id2entry is not available\n", 0, 0, 0);
         goto done;
     }
@@ -2400,7 +2400,7 @@ dblayer_get_aux_id2entry_ext(backend *be, DB **ppDB, DB_ENV **ppEnv,
     rval = dbp->set_pagesize(dbp, (priv->dblayer_page_size == 0) ?
                         DBLAYER_PAGESIZE : priv->dblayer_page_size);
     if (rval) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "dbp->set_pagesize(%lu or %lu) failed %d\n",
                   priv->dblayer_page_size, DBLAYER_PAGESIZE, rval);
         goto err;
@@ -2419,7 +2419,7 @@ dblayer_get_aux_id2entry_ext(backend *be, DB **ppDB, DB_ENV **ppEnv,
     DB_OPEN(envflags, dbp, NULL/* txnid */, id2entry_file, subname, DB_BTREE,
             dbflags, priv->dblayer_file_mode, rval);
     if (rval) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "dbp->open(\"%s\") failed: %s (%d)\n",
                   id2entry_file, dblayer_strerror(rval), rval);
         if (strstr(dblayer_strerror(rval), "Permission denied")) {
@@ -2471,7 +2471,7 @@ int dblayer_release_aux_id2entry(backend *be, DB *pDB, DB_ENV *pEnv)
     inst = (ldbm_instance *) be->be_instance_info;
     if (NULL == inst)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "No instance/env: persistent id2entry is not available\n", 0, 0, 0);
         goto done;
     }
@@ -2553,7 +2553,7 @@ int dblayer_instance_close(backend *be)
     }
 
     if (attrcrypt_cleanup_private(inst)) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Error: failed to clean up attrcrypt system for %s\n",
                   inst->inst_name, 0, 0);
     }
@@ -2620,7 +2620,7 @@ void dblayer_pre_close(struct ldbminfo *li)
         PRIntervalTime cvwaittime = PR_MillisecondsToInterval(DBLAYER_SLEEP_INTERVAL * 100);
         int timedout = 0;
         /* Print handy-dandy log message */
-        LDAPDebug(LDAP_DEBUG_ANY,"Waiting for %d database threads to stop\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Waiting for %d database threads to stop\n",
                   threadcount, 0,0);
         PR_Lock(priv->thread_count_lock);
         /* Tell them to stop - we wait until the last possible moment to invoke
@@ -2653,14 +2653,14 @@ void dblayer_pre_close(struct ldbminfo *li)
         }
         PR_Unlock(priv->thread_count_lock); 
         if (timedout) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "Timeout after [%d] milliseconds; leave %d database thread(s)...\n",
                       (DBLAYER_SLEEP_INTERVAL * 100), threadcount,0);
             priv->dblayer_bad_stuff_happened = 1;
             goto timeout_escape;
         }
     }
-    LDAPDebug(LDAP_DEBUG_ANY,"All database threads now stopped\n",0,0,0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"All database threads now stopped\n",0,0,0);
 timeout_escape:
     return;
 }
@@ -2932,7 +2932,7 @@ dblayer_open_file(backend *be, char* indexname, int open_flag,
             !is_fullpath(inst->inst_dir_name))
 
         {
-            LDAPDebug(LDAP_DEBUG_ANY, 
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                 "The instance path %s is not registered for db_data_dir, "
                 "although %s is a relative path.\n",
                 inst->inst_parent_dir_name, inst->inst_dir_name, 0);
@@ -3188,7 +3188,7 @@ dblayer_db_remove_ex(dblayer_private_env *env, char const path[], char const dbN
   
   rc = db_create(&db, db_env, 0); /* must use new handle to database */
   if (0 != rc) {
-    LDAPDebug(LDAP_DEBUG_ANY, "db_remove: Failed to create db (%d) %s\n",
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db_remove: Failed to create db (%d) %s\n",
                   rc, dblayer_strerror(rc), 0);
     goto done;
   }
@@ -3415,7 +3415,7 @@ dblayer_txn_begin_ext(struct ldbminfo *li, back_txnid parent_txn, back_txn *txn,
                 int txn_id = new_txn.back_txn_txn->id(new_txn.back_txn_txn);
                 PR_Lock(sync_txn_log_flush);
                 txn_in_progress_count++;
-                LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_begin: batchcount: %d, txn_in_progress: %d, curr_txn: %x\n", trans_batch_count, txn_in_progress_count, txn_id);
+                LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "txn_begin: batchcount: %d, txn_in_progress: %d, curr_txn: %x\n", trans_batch_count, txn_in_progress_count, txn_id);
                 PR_Unlock(sync_txn_log_flush);
             }
             dblayer_push_pvt_txn(&new_txn);
@@ -3429,7 +3429,7 @@ dblayer_txn_begin_ext(struct ldbminfo *li, back_txnid parent_txn, back_txn *txn,
     }
     if (0 != return_value) 
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Serious Error---Failed in dblayer_txn_begin, err=%d (%s)\n",
                   return_value, dblayer_strerror(return_value), 0);
     }
@@ -3515,7 +3515,7 @@ int dblayer_txn_commit_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
                 PR_Lock(sync_txn_log_flush);
                 txn_batch_slot = trans_batch_count++;
                 txn_log_flush_pending[txn_batch_slot] = txn_id;
-                LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_commit (before notify): batchcount: %d, "
+                LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "txn_commit (before notify): batchcount: %d, "
                         "txn_in_progress: %d, curr_txn: %x\n", trans_batch_count,
                         txn_in_progress_count, txn_id);
                 /*
@@ -3538,7 +3538,7 @@ int dblayer_txn_commit_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
                     PR_WaitCondVar(sync_txn_log_flush_done, PR_INTERVAL_NO_TIMEOUT);
                 }
                 txn_in_progress_count--;
-                LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_commit (before unlock): batchcount: %d, "
+                LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "txn_commit (before unlock): batchcount: %d, "
                         "txn_in_progress: %d, curr_txn %x\n", trans_batch_count,
                         txn_in_progress_count, txn_id);
                 PR_Unlock(sync_txn_log_flush);
@@ -3554,7 +3554,7 @@ int dblayer_txn_commit_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
 
     if (0 != return_value) 
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Serious Error---Failed in dblayer_txn_commit, err=%d (%s)\n",
                   return_value, dblayer_strerror(return_value), 0);
         if (LDBM_OS_ERR_IS_DISKFULL(return_value)) {
@@ -3622,7 +3622,7 @@ int dblayer_txn_abort_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
             PR_Lock(sync_txn_log_flush);
             txn_in_progress_count--;
             PR_Unlock(sync_txn_log_flush);
-            LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_abort : batchcount: %d, txn_in_progress: %d, curr_txn: %x\n", trans_batch_count, txn_in_progress_count, txn_id);
+            LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "txn_abort : batchcount: %d, txn_in_progress: %d, curr_txn: %x\n", trans_batch_count, txn_in_progress_count, txn_id);
         }
         return_value = TXN_ABORT(db_txn);
         /* if we were given a transaction, and it is the same as the
@@ -3644,7 +3644,7 @@ int dblayer_txn_abort_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
 
     if (0 != return_value) 
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Serious Error---Failed in dblayer_txn_abort, err=%d (%s)\n",
                   return_value, dblayer_strerror(return_value), 0);
         if (LDBM_OS_ERR_IS_DISKFULL(return_value)) {
@@ -3774,7 +3774,7 @@ dblayer_start_perf_thread(struct ldbminfo *li)
                                  SLAPD_DEFAULT_THREAD_STACKSIZE) )
     {
         PRErrorCode prerr = PR_GetError();
-        LDAPDebug(LDAP_DEBUG_ANY, "failed to create database perf thread, "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "failed to create database perf thread, "
                   SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                   prerr, slapd_pr_strerror(prerr), 0);
         return_value = -1;
@@ -3802,7 +3802,7 @@ static int perf_threadmain(void *param)
     }
 
     DECR_THREAD_COUNT(priv);
-    LDAPDebug(LDAP_DEBUG_TRACE, "Leaving perf_threadmain\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Leaving perf_threadmain\n", 0, 0, 0);
     return 0;
 }
 
@@ -3820,7 +3820,7 @@ dblayer_start_deadlock_thread(struct ldbminfo *li)
                                  SLAPD_DEFAULT_THREAD_STACKSIZE) )
     {
         PRErrorCode prerr = PR_GetError();
-        LDAPDebug(LDAP_DEBUG_ANY, "failed to create database deadlock thread, "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "failed to create database deadlock thread, "
                   SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                   prerr, slapd_pr_strerror(prerr), 0);
         return_value = -1;
@@ -4251,7 +4251,7 @@ dblayer_start_txn_test_thread(struct ldbminfo *li)
                                  SLAPD_DEFAULT_THREAD_STACKSIZE) )
     {
         PRErrorCode prerr = PR_GetError();
-        LDAPDebug(LDAP_DEBUG_ANY, "failed to create txn test thread, "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "failed to create txn test thread, "
                   SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                   prerr, slapd_pr_strerror(prerr), 0);
         return_value = -1;
@@ -4289,7 +4289,7 @@ static int deadlock_threadmain(void *param)
                 int rejected = 0;
 
                 if ((rval = LOCK_DETECT(db_env, flags, deadlock_policy, &rejected)) != 0) {
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                               "Serious Error---Failed in deadlock detect (aborted at 0x%x), err=%d (%s)\n",
                               rejected, rval, dblayer_strerror(rval));
                 } else if (rejected) {
@@ -4302,12 +4302,12 @@ static int deadlock_threadmain(void *param)
     }
 
     DECR_THREAD_COUNT(priv);
-    LDAPDebug(LDAP_DEBUG_TRACE, "Leaving deadlock_threadmain\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Leaving deadlock_threadmain\n", 0, 0, 0);
     return 0;
 }
 
 #define checkpoint_debug_message(debug, fmt, a1, a2, a3) \
-    if (debug) { LDAPDebug(LDAP_DEBUG_ANY,fmt,a1,a2,a3); }
+    if (debug) { LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,fmt,a1,a2,a3); }
 
 /* this thread tries to do two things: 
     1. catch a group of transactions that are pending allowing a worker thread 
@@ -4336,7 +4336,7 @@ dblayer_start_log_flush_thread(dblayer_private *priv)
                                      PR_UNJOINABLE_THREAD, 
                                      SLAPD_DEFAULT_THREAD_STACKSIZE) ) {
             PRErrorCode prerr = PR_GetError();
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "failed to create database log flush thread, "
                 SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                 prerr, slapd_pr_strerror(prerr), 0);
@@ -4381,7 +4381,7 @@ static int log_flush_threadmain(void *param)
                     PR_Unlock(sync_txn_log_flush);
                     break;
                 }
-                LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (in loop): batchcount: %d, "
+                LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "log_flush_threadmain (in loop): batchcount: %d, "
                         "txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
                 /*
                  * if here, do flush the txn logs if any of the following conditions are met
@@ -4390,7 +4390,7 @@ static int log_flush_threadmain(void *param)
                  * - do_flush indicate that the max waiting interval is exceeded
                  */
                 if(trans_batch_count >= trans_batch_limit || trans_batch_count >= txn_in_progress_count || do_flush) {
-                    LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (working): batchcount: %d, "
+                    LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "log_flush_threadmain (working): batchcount: %d, "
                             "txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
                     LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
                     for (i=0;i<trans_batch_count;i++){
@@ -4399,7 +4399,7 @@ static int log_flush_threadmain(void *param)
                     trans_batch_count = 0;
                     last_flush = PR_IntervalNow();
                     do_flush = 0;
-                    LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (before notify): batchcount: %d, "
+                    LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "log_flush_threadmain (before notify): batchcount: %d, "
                             "txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
                     PR_NotifyAllCondVar(sync_txn_log_flush_done);
                 }
@@ -4415,7 +4415,7 @@ static int log_flush_threadmain(void *param)
                     PR_WaitCondVar(sync_txn_log_do_flush, interval_wait);
                 }
                 PR_Unlock(sync_txn_log_flush);
-                LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (wakeup): batchcount: %d, "
+                LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "log_flush_threadmain (wakeup): batchcount: %d, "
                           "txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
             } else {
                 DS_Sleep(interval_def);
@@ -4426,7 +4426,7 @@ static int log_flush_threadmain(void *param)
     }
 
     DECR_THREAD_COUNT(priv);
-    LDAPDebug(LDAP_DEBUG_TRACE, "Leaving log_flush_threadmain\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Leaving log_flush_threadmain\n", 0, 0, 0);
     return 0;
 }
 
@@ -4444,7 +4444,7 @@ dblayer_start_checkpoint_thread(struct ldbminfo *li)
                                  SLAPD_DEFAULT_THREAD_STACKSIZE) )
     {
         PRErrorCode prerr = PR_GetError();
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "failed to create database checkpoint thread, "
                   SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                   prerr, slapd_pr_strerror(prerr), 0);
@@ -4488,7 +4488,7 @@ static int checkpoint_threadmain(void *param)
     home_dir = dblayer_get_home_dir(li, NULL);
     if (NULL == home_dir || '\0' == *home_dir)
     {
-        LDAPDebug(LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
             "Checkpoint thread failed due to missing db home directory info\n",
             0, 0, 0);
         goto error_return;
@@ -4541,7 +4541,7 @@ static int checkpoint_threadmain(void *param)
                                      "Checkpoint Done\n", 0, 0, 0);
             if (rval != 0) {
                 /* bad error */
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "Serious Error---Failed to checkpoint database, "
                     "err=%d (%s)\n", rval, dblayer_strerror(rval), 0);
                 if (LDBM_OS_ERR_IS_DISKFULL(rval)) {
@@ -4569,7 +4569,7 @@ static int checkpoint_threadmain(void *param)
                                      "Checkpoint Done\n", 0, 0, 0);
             if (rval != 0) {
                 /* bad error */
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "Serious Error---Failed to checkpoint database, "
                     "err=%d (%s)\n", rval, dblayer_strerror(rval), 0);
                 if (LDBM_OS_ERR_IS_DISKFULL(rval)) {
@@ -4612,11 +4612,11 @@ static int checkpoint_threadmain(void *param)
                 rc = db->compact(db, txn.back_txn_txn, NULL/*start*/, NULL/*stop*/, 
                                  &c_data, DB_FREE_SPACE, NULL/*end*/);
                 if (rc) {
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                               "compactdb: failed to compact %s; db error - %d %s\n",
                               inst->inst_name, rc, db_strerror(rc));
                     if((rc = dblayer_txn_abort(inst->inst_be, &txn))){
-                        LDAPDebug(LDAP_DEBUG_ANY, "compactdb: failed to abort txn (%s) db error - %d %s\n",
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "compactdb: failed to abort txn (%s) db error - %d %s\n",
                                   inst->inst_name, rc, db_strerror(rc));
                         break;
                     }
@@ -4625,7 +4625,7 @@ static int checkpoint_threadmain(void *param)
                                    "compactdb: compact %s - %d pages freed\n",
                                    inst->inst_name, c_data.compact_pages_free);
                     if((rc = dblayer_txn_commit(inst->inst_be, &txn))){
-                        LDAPDebug(LDAP_DEBUG_ANY, "compactdb: failed to commit txn (%s) db error - %d %s\n",
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "compactdb: failed to commit txn (%s) db error - %d %s\n",
                                   inst->inst_name, rc, db_strerror(rc));
                         break;
                     }
@@ -4656,7 +4656,7 @@ static int checkpoint_threadmain(void *param)
                     checkpoint_debug_message(debug_checkpointing,
                                 "Renaming %s -> %s\n",*listp, new_filename, 0);
                     if(rename(*listp, new_filename) != 0){
-                        LDAPDebug(LDAP_DEBUG_ANY, "checkpoint_threadmain: failed to rename log (%s) to (%s)\n",
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "checkpoint_threadmain: failed to rename log (%s) to (%s)\n",
                                 *listp, new_filename, 0);
                         rval = -1;
                         goto error_return;
@@ -4696,7 +4696,7 @@ dblayer_start_trickle_thread(struct ldbminfo *li)
                                  SLAPD_DEFAULT_THREAD_STACKSIZE) )
     {
         PRErrorCode prerr = PR_GetError();
-        LDAPDebug(LDAP_DEBUG_ANY, "failed to create database trickle thread, "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "failed to create database trickle thread, "
                   SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                   prerr, slapd_pr_strerror(prerr), 0);
         return_value = -1;
@@ -4735,7 +4735,7 @@ static int trickle_threadmain(void *param)
                                          priv->dblayer_trickle_percentage,
                                          &pages_written)) != 0)
                 {
-                    LDAPDebug(LDAP_DEBUG_ANY,"Serious Error---Failed to trickle, err=%d (%s)\n",rval,dblayer_strerror(rval), 0);
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Serious Error---Failed to trickle, err=%d (%s)\n",rval,dblayer_strerror(rval), 0);
                 }
                 if (pages_written > 0) 
                 {
@@ -4746,7 +4746,7 @@ static int trickle_threadmain(void *param)
     }
 
     DECR_THREAD_COUNT(priv);
-    LDAPDebug(LDAP_DEBUG_TRACE, "Leaving trickle_threadmain priv\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Leaving trickle_threadmain priv\n", 0, 0, 0);
     return 0;
 }
 
@@ -4986,7 +4986,7 @@ static int commit_good_database(dblayer_private *priv)
         priv->dblayer_file_mode );
     if (NULL == prfd)
     {
-        LDAPDebug( LDAP_DEBUG_ANY,"Fatal Error---Failed to write guardian file %s, database corruption possible" SLAPI_COMPONENT_NAME_NSPR " %d (%s)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Fatal Error---Failed to write guardian file %s, database corruption possible" SLAPI_COMPONENT_NAME_NSPR " %d (%s)\n",
             filename, PR_GetError(), slapd_pr_strerror(PR_GetError()) );
         return -1;
     } 
@@ -5004,7 +5004,7 @@ static int commit_good_database(dblayer_private *priv)
         return 0;
     } else
     {
-        LDAPDebug( LDAP_DEBUG_ANY,"Fatal Error---Failed to write guardian file, database corruption possible\n", 0,0, 0 );
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Fatal Error---Failed to write guardian file, database corruption possible\n", 0,0, 0 );
         (void)PR_Delete(filename);
         return -1;
     }
@@ -5069,7 +5069,7 @@ static int read_metadata(struct ldbminfo *li)
                    so we should check for condition 3.
                    */
                 if (!dbversion_exists(li, home_dir)) {
-                    LDAPDebug( LDAP_DEBUG_ANY,"Fatal Error---database is corrupt. Server can't start. Most likely cause is a previously aborted import. Either re-import or delete the database and re-start the server.\n", 0,0, 0 );
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Fatal Error---database is corrupt. Server can't start. Most likely cause is a previously aborted import. Either re-import or delete the database and re-start the server.\n", 0,0, 0 );
                     return -1;
                 } else {
                     priv->dblayer_recovery_required = 1;
@@ -5122,7 +5122,7 @@ static int read_metadata(struct ldbminfo *li)
     (void)PR_Close(prfd);
     return_value = PR_Delete(filename); /* very important that this happen ! */
     if (PR_SUCCESS != return_value) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "Fatal Error---Failed to delete guardian file, "
             "database corruption possible\n", 0, 0, 0 );
     }
@@ -5145,7 +5145,7 @@ static int dblayer_force_checkpoint(struct ldbminfo *li)
   
   if (priv->dblayer_enable_transactions) {
     
-    LDAPDebug(LDAP_DEBUG_TRACE, "Checkpointing database ...\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Checkpointing database ...\n", 0, 0, 0);
     
     /* 
      * DB workaround. Newly created environments do not know what the
@@ -5161,21 +5161,21 @@ static int dblayer_force_checkpoint(struct ldbminfo *li)
       if (ret != DB_INCOMPLETE)
 #endif
       {
-        LDAPDebug(LDAP_DEBUG_ANY, "Checkpoint FAILED, error %s (%d)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Checkpoint FAILED, error %s (%d)\n",
                   dblayer_strerror(ret), ret, 0);
         break;
       }
 #if 1000*DB_VERSION_MAJOR + 100*DB_VERSION_MINOR < 4100
       
-      LDAPDebug(LDAP_DEBUG_ANY, "Busy: retrying checkpoint\n", 0, 0, 0);
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Busy: retrying checkpoint\n", 0, 0, 0);
       
       /* teletubbies: "again! again!" */
       ret = dblayer_txn_checkpoint(li, pEnv, PR_TRUE, PR_FALSE, PR_TRUE);
       if (ret == DB_INCOMPLETE) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Busy: giving up on checkpoint\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Busy: giving up on checkpoint\n", 0, 0, 0);
         break;
       } else if (ret != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Checkpoint FAILED, error %s (%d)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Checkpoint FAILED, error %s (%d)\n",
                   dblayer_strerror(ret), ret, 0);
         break;
       }
@@ -5260,7 +5260,7 @@ static int _dblayer_delete_instance_dir(ldbm_instance *inst, int startdb)
         rval = dblayer_start(li, DBLAYER_NORMAL_MODE|DBLAYER_NO_DBTHREADS_MODE);
         if (rval)
         {
-            LDAPDebug(LDAP_DEBUG_ANY, "_dblayer_delete_instance_dir: dblayer_start failed! %s (%d)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "_dblayer_delete_instance_dir: dblayer_start failed! %s (%d)\n",
                 dblayer_strerror(rval), rval, 0);
             goto done;
         }
@@ -5286,10 +5286,10 @@ static int _dblayer_delete_instance_dir(ldbm_instance *inst, int startdb)
              goto done;
         }
         if (inst_dirp && *inst_dirp) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "_dblayer_delete_instance_dir: inst_dir is NULL\n", 0, 0, 0);
         } else {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "_dblayer_delete_instance_dir: PR_OpenDir(%s) failed (%d): %s\n", 
               inst_dirp, PR_GetError(),slapd_pr_strerror(PR_GetError()));
         }
@@ -5334,7 +5334,7 @@ static int _dblayer_delete_instance_dir(ldbm_instance *inst, int startdb)
         rval = dblayer_close(li, DBLAYER_NORMAL_MODE);
         if (rval)
         {
-            LDAPDebug(LDAP_DEBUG_ANY, "_dblayer_delete_instance_dir: dblayer_close failed! %s (%d)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "_dblayer_delete_instance_dir: dblayer_close failed! %s (%d)\n",
                 dblayer_strerror(rval), rval, 0);
         }
     }
@@ -5394,7 +5394,7 @@ dblayer_delete_database_ex(struct ldbminfo *li, char *instance, char *cldir)
         if (inst->inst_be->be_instance_info != NULL) {
 			if ((NULL != instance) && (strcasecmp(inst->inst_name,instance) != 0)) 
 			{
-				LDAPDebug(LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"dblayer_delete_database: skipping instance %s\n",inst->inst_name , 0, 0);	
 			} else 
 			{
@@ -5406,7 +5406,7 @@ dblayer_delete_database_ex(struct ldbminfo *li, char *instance, char *cldir)
 				}
 				if (ret != 0)
 				{
-					LDAPDebug(LDAP_DEBUG_ANY,
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"dblayer_delete_database: WARNING _dblayer_delete_instance_dir failed (%d)\n", ret, 0, 0);
 					return ret;
 				}	
@@ -5429,7 +5429,7 @@ dblayer_delete_database_ex(struct ldbminfo *li, char *instance, char *cldir)
     dirhandle = PR_OpenDir(priv->dblayer_home_directory);
     if (! dirhandle)
     {
-        LDAPDebug(LDAP_DEBUG_ANY, "PR_OpenDir (%s) failed (%d): %s\n", 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "PR_OpenDir (%s) failed (%d): %s\n", 
         priv->dblayer_home_directory,
         PR_GetError(),slapd_pr_strerror(PR_GetError()));
         return -1;
@@ -5473,7 +5473,7 @@ dblayer_delete_database_ex(struct ldbminfo *li, char *instance, char *cldir)
 	{
 		ret = dblayer_delete_transaction_logs(log_dir);
 		if(ret) {
-		  LDAPDebug(LDAP_DEBUG_ANY,
+		  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		  "dblayer_delete_database: dblayer_delete_transaction_logs failed (%d)\n",
 		  ret, 0, 0);
 		  return -1;
@@ -5685,7 +5685,7 @@ dblayer_copyfile(char *source, char *destination, int overwrite, int mode)
                 break;
             } else {
                 /* means error */
-                LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copyfile: failed to write by \"%s\"; real: %d bytes, exp: %d bytes\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_copyfile: failed to write by \"%s\"; real: %d bytes, exp: %d bytes\n",
                           strerror(errno), return_value, bytes_to_write);
                 if (return_value > 0) {
                     bytes_to_write -= return_value;
@@ -5792,7 +5792,7 @@ dblayer_copy_directory(struct ldbminfo *li,
     } else {
         inst = ldbm_instance_find_by_name(li, relative_instance_name);
         if (NULL == inst) {
-            LDAPDebug(LDAP_DEBUG_ANY, "Backend instance \"%s\" does not exist; "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Backend instance \"%s\" does not exist; "
                       "Instance path %s could be invalid.\n",
                       relative_instance_name, src_dir, 0);
             return return_value;
@@ -5808,7 +5808,7 @@ dblayer_copy_directory(struct ldbminfo *li,
                                               inst_dir, MAXPATHLEN);
         if (!inst_dirp || !*inst_dirp)
         {
-            LDAPDebug(LDAP_DEBUG_ANY, "Instance dir is NULL.\n", 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Instance dir is NULL.\n", 0, 0, 0);
             return return_value;
         }
         len = strlen(inst_dirp);
@@ -5881,7 +5881,7 @@ dblayer_copy_directory(struct ldbminfo *li,
                 }
                 if (mkdir_p(new_dest_dir, 0700) != PR_SUCCESS)
                 {
-                    LDAPDebug(LDAP_DEBUG_ANY, "Can't create new directory %s, "
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Can't create new directory %s, "
                         SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                         new_dest_dir, PR_GetError(),
                         slapd_pr_strerror(PR_GetError()));
@@ -5893,7 +5893,7 @@ dblayer_copy_directory(struct ldbminfo *li,
             filename2 = slapi_ch_smprintf("%s/%s", new_dest_dir, direntry->name);
 
             if (restore) {
-                LDAPDebug(LDAP_DEBUG_ANY, "Restoring file %d (%s)\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Restoring file %d (%s)\n",
                           *cnt, filename2, 0);
                 if (task) {
                     slapi_task_log_notice(task,
@@ -5902,7 +5902,7 @@ dblayer_copy_directory(struct ldbminfo *li,
                         "Restoring file %d (%s)", *cnt, filename2);
                 }
             } else {
-                LDAPDebug(LDAP_DEBUG_ANY, "Backing up file %d (%s)\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Backing up file %d (%s)\n",
                           *cnt, filename2, 0);
                 if (task) {
                     slapi_task_log_notice(task,
@@ -6139,7 +6139,7 @@ dblayer_backup(struct ldbminfo *li, char *dest_dir, Slapi_Task *task)
                                                   dest_dir, 0 /* backup */,
                                                   &cnt, 0, 0, 0);
             if (return_value) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "Backup: error in copying directory "
                           "(%s -> %s): err=%d\n",
                           inst_dirp, dest_dir, return_value);
@@ -6167,7 +6167,7 @@ dblayer_backup(struct ldbminfo *li, char *dest_dir, Slapi_Task *task)
                                                   0 /* backup */,
                                                   &cnt, 0, 0, 1);
             if (return_value) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "Backup: error in copying directory "
                           "(%s -> %s): err=%d\n",
                           changelogdir, changelog_destdir, return_value);
@@ -6305,7 +6305,7 @@ dblayer_backup(struct ldbminfo *li, char *dest_dir, Slapi_Task *task)
     }
     return_value = dblayer_copyfile(pathname1, pathname2, 0, priv->dblayer_file_mode);
     if (0 > return_value) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Backup: error in copying version file "
                   "(%s -> %s): err=%d\n",
                   pathname1, pathname2, return_value);
@@ -6385,7 +6385,7 @@ int dblayer_delete_transaction_logs(const char * log_dir)
         {
             if (NULL == direntry->name) {
                 /* NSPR doesn't behave like the docs say it should */
-                LDAPDebug(LDAP_DEBUG_ANY, "PR_ReadDir failed (%d): %s\n", 
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "PR_ReadDir failed (%d): %s\n", 
                 PR_GetError(),slapd_pr_strerror(PR_GetError()), 0);
                 break;
             }
@@ -6397,7 +6397,7 @@ int dblayer_delete_transaction_logs(const char * log_dir)
             is_a_logfile = dblayer_is_logfilename(direntry->name);
             if (is_a_logfile && (NULL != log_dir) && (0 != strlen(log_dir)) )
             {
-                LDAPDebug(LDAP_DEBUG_ANY, "Deleting log file: (%s)\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Deleting log file: (%s)\n",
                           filename1, 0, 0);
                 unlink(filename1);
             }
@@ -6406,7 +6406,7 @@ int dblayer_delete_transaction_logs(const char * log_dir)
     }
     else if (PR_FILE_NOT_FOUND_ERROR != PR_GetError())
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "dblayer_delete_transaction_logs: PR_OpenDir(%s) failed (%d): %s\n",
              log_dir, PR_GetError(),slapd_pr_strerror(PR_GetError()));
         rc=1;
@@ -6458,7 +6458,7 @@ static int dblayer_copy_dirand_contents(char* src_dir, char* dst_dir, int mode,
 
        PR_snprintf(filename1, MAXPATHLEN, "%s/%s", src_dir, direntry->name);
        PR_snprintf(filename2, MAXPATHLEN, "%s/%s", dst_dir, direntry->name);
-       LDAPDebug(LDAP_DEBUG_ANY, "Moving file %s\n",
+       LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Moving file %s\n",
                           filename2, 0, 0);
       /* Is this entry a directory? */
       tmp_rval = PR_GetFileInfo64(filename1, &info);
@@ -6524,7 +6524,7 @@ static int dblayer_fri_trim(char *fri_dir_path, char* bename)
 			{
 				if(strcasecmp(direntry->name,bename)!=0)
 				{
-					LDAPDebug(LDAP_DEBUG_ANY, "Removing file %s from staging area\n",
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Removing file %s from staging area\n",
                          filename, 0, 0);
 					ldbm_delete_dirs(filename);
 				}
@@ -6534,7 +6534,7 @@ static int dblayer_fri_trim(char *fri_dir_path, char* bename)
 			if ((strcmp(direntry->name,"DBVERSION") == 0)||
 				    (strncmp(direntry->name,"__",2) == 0)||
 					(strncmp(direntry->name,"log",3) == 0)){
-				LDAPDebug(LDAP_DEBUG_ANY, "Removing file %s from staging area\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Removing file %s from staging area\n",
                          filename, 0, 0);
 				PR_Delete(filename);
 			}
@@ -6579,18 +6579,18 @@ static int dblayer_fri_restore(char *home_dir, char *src_dir, dblayer_private *p
 		fribak_dir_path = slapi_ch_smprintf("%s/../%s",home_dir,fribak_dir_name);
 		if((-1 == PR_MkDir(fribak_dir_path,NEWDIR_MODE)))
 		{
-		  LDAPDebug(LDAP_DEBUG_ANY, "dblayer_fri_restore: %s exists\n",fribak_dir_path, 0, 0);
-		  LDAPDebug(LDAP_DEBUG_ANY, "dblayer_fri_restore: Removing %s.\n",fribak_dir_path, 0, 0);
+		  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_fri_restore: %s exists\n",fribak_dir_path, 0, 0);
+		  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_fri_restore: Removing %s.\n",fribak_dir_path, 0, 0);
 		  retval = ldbm_delete_dirs(fribak_dir_path);
 		  if (retval)
 		  {
-			LDAPDebug(LDAP_DEBUG_ANY, "dblayer_fri_restore: Removal of %s failed!\n", fribak_dir_path, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_fri_restore: Removal of %s failed!\n", fribak_dir_path, 0, 0);
 			goto error;
 		  }
 		  PR_MkDir(fribak_dir_path,NEWDIR_MODE);
 		  if (retval != PR_SUCCESS)
 		  {
-			LDAPDebug(LDAP_DEBUG_ANY, "dblayer_fri_restore: Creation of %s failed!\n", fribak_dir_path, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_fri_restore: Creation of %s failed!\n", fribak_dir_path, 0, 0);
 			goto error;
 		  }
 		}
@@ -6599,21 +6599,21 @@ static int dblayer_fri_restore(char *home_dir, char *src_dir, dblayer_private *p
 		retval = dblayer_copy_dirand_contents(src_dir, fribak_dir_path, mode, task);
 		if (retval) 
 		{
-			LDAPDebug(LDAP_DEBUG_ANY, "dblayer_fri_restore: Copy contents to %s failed!\n", fribak_dir_path, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_fri_restore: Copy contents to %s failed!\n", fribak_dir_path, 0, 0);
 			goto error;
 		}
 		/* Next, run recovery on the files */
 		retval = dblayer_recover_environment_path(fribak_dir_path, priv);
 		if (retval) 
 		{
-			LDAPDebug(LDAP_DEBUG_ANY, "dblayer_fri_restore: Recovery failed!\n", 0, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_fri_restore: Recovery failed!\n", 0, 0, 0);
 			goto error;
 		}
 		/* Files nicely recovered, next we stip out what we don't need from the backup set */
 		retval = dblayer_fri_trim(fribak_dir_path,bename);
 		if (retval) 
 		{
-			LDAPDebug(LDAP_DEBUG_ANY, "dblayer_fri_restore: Trim failed!\n", 0, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dblayer_fri_restore: Trim failed!\n", 0, 0, 0);
 			goto error;
 		}
 		*new_src_dir = fribak_dir_path;
@@ -7084,7 +7084,7 @@ dblayer_file_open(char *fname, int flags, int mode, PRFileDesc **prfd)
 
     if (NULL == *prfd) rc = PR_GetError();
     if (rc && rc != PR_FILE_NOT_FOUND_ERROR ) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                        "Failed to open file: %s, error: (%d) %s\n",
                        fname, rc, slapd_pr_strerror(rc));
     }
@@ -7323,7 +7323,7 @@ int dblayer_update_db_ext(ldbm_instance *inst, char *oldext, char *newext)
 
     if (NULL == inst)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "update_db_ext: Null instance is passed\n", 0, 0, 0);
         return -1;    /* non zero */
     }
@@ -7331,7 +7331,7 @@ int dblayer_update_db_ext(ldbm_instance *inst, char *oldext, char *newext)
     priv = (dblayer_private*)li->li_dblayer_private;
     inst_dirp = dblayer_get_full_inst_dir(li, inst, inst_dir, MAXPATHLEN);
     if (NULL == inst_dirp || '\0' == *inst_dirp) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "update_db_ext: instance dir is NULL\n", 0, 0, 0);
         return -1;    /* non zero */
     }
@@ -7352,21 +7352,21 @@ int dblayer_update_db_ext(ldbm_instance *inst, char *oldext, char *newext)
         rval = db_create(&thisdb, priv->dblayer_env->dblayer_DB_ENV, 0);
         if (0 != rval)
         {
-            LDAPDebug(LDAP_DEBUG_ANY, "db_create returned %d (%s)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db_create returned %d (%s)\n",
                     rval, dblayer_strerror(rval), 0);
             goto done;
         }
         nfile = slapi_ch_smprintf("%s/%s%s", inst_dirp, a->ai_type, newext);
-        LDAPDebug(LDAP_DEBUG_TRACE, "update_db_ext: rename %s -> %s\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "update_db_ext: rename %s -> %s\n",
             ofile, nfile, 0);
 
         rval = thisdb->rename(thisdb, (const char *)ofile, NULL /* subdb */,
                                   (const char *)nfile, 0);
         if (0 != rval)
         {
-            LDAPDebug(LDAP_DEBUG_ANY, "rename returned %d (%s)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "rename returned %d (%s)\n",
                 rval, dblayer_strerror(rval), 0);
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "update_db_ext: index (%s) Failed to update index %s -> %s\n",
                 inst->inst_name, ofile, nfile);
             goto done;
@@ -7378,21 +7378,21 @@ int dblayer_update_db_ext(ldbm_instance *inst, char *oldext, char *newext)
     rval = db_create(&thisdb, priv->dblayer_env->dblayer_DB_ENV, 0);
     if (0 != rval)
     {
-        LDAPDebug(LDAP_DEBUG_ANY, "db_create returned %d (%s)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db_create returned %d (%s)\n",
                     rval, dblayer_strerror(rval), 0);
         goto done;
     }
     ofile = slapi_ch_smprintf("%s/%s%s", inst_dirp, ID2ENTRY, oldext);
     nfile = slapi_ch_smprintf("%s/%s%s", inst_dirp, ID2ENTRY, newext);
-    LDAPDebug(LDAP_DEBUG_TRACE, "update_db_ext: rename %s -> %s\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "update_db_ext: rename %s -> %s\n",
             ofile, nfile, 0);
     rval = thisdb->rename(thisdb, (const char *)ofile, NULL /* subdb */,
                                   (const char *)nfile, 0);
     if (0 != rval)
     {
-        LDAPDebug(LDAP_DEBUG_ANY, "rename returned %d (%s)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "rename returned %d (%s)\n",
                 rval, dblayer_strerror(rval), 0);
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "update_db_ext: index (%s) Failed to update index %s -> %s\n",
                 inst->inst_name, ofile, nfile);
     }
@@ -7416,7 +7416,7 @@ int dblayer_delete_indices(ldbm_instance *inst)
 
     if (NULL == inst)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "update_index_ext: Null instance is passed\n", 0, 0, 0);
         return rval;
     }
@@ -7434,7 +7434,7 @@ void dblayer_set_recovery_required(struct ldbminfo *li)
 {
     if (NULL == li || NULL == li->li_dblayer_private)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,"set_recovery_required: no dblayer info\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"set_recovery_required: no dblayer info\n",
                   0, 0, 0);
         return;
     }
diff --git a/ldap/servers/slapd/back-ldbm/dbversion.c b/ldap/servers/slapd/back-ldbm/dbversion.c
index 4d28cd6..e8d9e79 100644
--- a/ldap/servers/slapd/back-ldbm/dbversion.c
+++ b/ldap/servers/slapd/back-ldbm/dbversion.c
@@ -62,7 +62,7 @@ dbversion_write(struct ldbminfo *li, const char *directory,
     if (( prfd = PR_Open( filename, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE,
                           SLAPD_DEFAULT_FILE_MODE  )) == NULL )
     {
-        LDAPDebug( LDAP_DEBUG_ANY, "Could not open file \"%s\" for writing "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Could not open file \"%s\" for writing "
                    SLAPI_COMPONENT_NAME_NSPR " %d (%s)\n",
                    filename, PR_GetError(), slapd_pr_strerror(PR_GetError()) );
         rc= -1;
@@ -100,7 +100,7 @@ dbversion_write(struct ldbminfo *li, const char *directory,
         len = strlen(buf);
         if ( slapi_write_buffer( prfd, buf, len ) != (PRInt32)len )
         {
-            LDAPDebug( LDAP_DEBUG_ANY, "Could not write to file \"%s\"\n", filename, 0, 0 );
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Could not write to file \"%s\"\n", filename, 0, 0 );
             rc= -1;
         }
         if(rc==0 && dataversion!=NULL)
@@ -109,7 +109,7 @@ dbversion_write(struct ldbminfo *li, const char *directory,
             len = strlen( buf );
             if ( slapi_write_buffer( prfd, buf, len ) != (PRInt32)len )
             {
-                LDAPDebug( LDAP_DEBUG_ANY, "Could not write to file \"%s\"\n", filename, 0, 0 );
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Could not write to file \"%s\"\n", filename, 0, 0 );
                 rc= -1;
             }
         }
diff --git a/ldap/servers/slapd/back-ldbm/dn2entry.c b/ldap/servers/slapd/back-ldbm/dn2entry.c
index 7656688..3db2b3f 100644
--- a/ldap/servers/slapd/back-ldbm/dn2entry.c
+++ b/ldap/servers/slapd/back-ldbm/dn2entry.c
@@ -45,7 +45,7 @@ dn2entry_ext(
 	struct backentry	*e = NULL;
 	char *indexname = "";
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> dn2entry_ext \"%s\"\n", slapi_sdn_get_dn(sdn), 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> dn2entry_ext \"%s\"\n", slapi_sdn_get_dn(sdn), 0, 0 );
 
 	inst = (ldbm_instance *) be->be_instance_info;
 
@@ -118,7 +118,7 @@ dn2entry_ext(
 				 * entrydn index, but we could not read the entry
 				 * from the id2entry index. what should we do?
 				 */
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					    "dn2entry_ext: the dn \"%s\" was in the %s index, "
 					    "but it did not exist in id2entry of instance %s.\n",
 					    slapi_sdn_get_dn(sdn), indexname, inst->inst_name);
@@ -126,7 +126,7 @@ dn2entry_ext(
 		}
 	}
 bail:
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= dn2entry_ext %p\n", e, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= dn2entry_ext %p\n", e, 0, 0 );
 	return( e );
 }
 
@@ -159,7 +159,7 @@ dn2ancestor(
 {
     struct backentry *e = NULL;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> dn2ancestor \"%s\"\n", slapi_sdn_get_dn(sdn), 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> dn2ancestor \"%s\"\n", slapi_sdn_get_dn(sdn), 0, 0 );
 
     /* first, check to see if the given sdn is empty or a root suffix of the
        given backend - if so, it has no parent */
@@ -221,7 +221,7 @@ dn2ancestor(
        e is the entry of the ancestor of sdn OR e is the suffix entry
        OR e is NULL
        ancestordn contains the unnormalized DN of e or is empty */
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= dn2ancestor %p\n", e, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= dn2ancestor %p\n", e, 0, 0 );
     return( e );
 }
 
@@ -255,7 +255,7 @@ get_copy_of_entry(Slapi_PBlock *pb, const entry_address *addr, back_txn *txn, in
 	{
 		if(must_exist)
 		{
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			           "Operation error fetching %s (%s), error %d.\n", 
 			           addr->sdn?slapi_sdn_get_dn(addr->sdn):"Null DN",
 			           (addr->uniqueid==NULL?"null":addr->uniqueid), err );
diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c
index e87cf30..49e83cb 100644
--- a/ldap/servers/slapd/back-ldbm/filterindex.c
+++ b/ldap/servers/slapd/back-ldbm/filterindex.c
@@ -65,7 +65,7 @@ filter_candidates_ext(
     IDList          *result;
     int             ftype;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> filter_candidates\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> filter_candidates\n", 0, 0, 0 );
 
     if (!allidslimit) {
         allidslimit = compute_allids_limit(pb, li);
@@ -74,7 +74,7 @@ filter_candidates_ext(
     /* check if this is to be serviced by a virtual index */
     if(INDEX_FILTER_EVALUTED == index_subsys_evaluate_filter(f, (Slapi_DN*)slapi_be_getsuffix(be, 0), (IndexEntryList**)&result))
     {
-        LDAPDebug( LDAP_DEBUG_TRACE, "<= filter_candidates %lu (vattr)\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= filter_candidates %lu (vattr)\n",
                (u_long)IDL_NIDS(result), 0, 0 );
         return result;
     }
@@ -88,7 +88,7 @@ filter_candidates_ext(
         slapi_pblock_get(pb, SLAPI_TXN, &txn.back_txn_txn);
         result = vlv_find_index_by_filter_txn(be, base, f, &txn);
         if (result) {
-            LDAPDebug( LDAP_DEBUG_TRACE, "<= filter_candidates %lu (vlv)\n",
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= filter_candidates %lu (vlv)\n",
                     (u_long)IDL_NIDS(result), 0, 0 );
             return result;
         }
@@ -97,66 +97,66 @@ filter_candidates_ext(
     result = NULL;
     switch ( (ftype = slapi_filter_get_choice( f )) ) {
     case LDAP_FILTER_EQUALITY:
-        LDAPDebug( LDAP_DEBUG_FILTER, "\tEQUALITY\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "\tEQUALITY\n", 0, 0, 0 );
         result = ava_candidates( pb, be, f, LDAP_FILTER_EQUALITY, nextf, range, err, allidslimit );
         break;
 
     case LDAP_FILTER_SUBSTRINGS:
-        LDAPDebug( LDAP_DEBUG_FILTER, "\tSUBSTRINGS\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "\tSUBSTRINGS\n", 0, 0, 0 );
         result = substring_candidates( pb, be, f, err, allidslimit );
         break;
 
     case LDAP_FILTER_GE:
-        LDAPDebug( LDAP_DEBUG_FILTER, "\tGE\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "\tGE\n", 0, 0, 0 );
         result = ava_candidates( pb, be, f, LDAP_FILTER_GE, nextf, range,
             err, allidslimit );
         break;
 
     case LDAP_FILTER_LE:
-        LDAPDebug( LDAP_DEBUG_FILTER, "\tLE\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "\tLE\n", 0, 0, 0 );
         result = ava_candidates( pb, be, f, LDAP_FILTER_LE, nextf, range,
             err, allidslimit );
         break;
 
     case LDAP_FILTER_PRESENT:
-        LDAPDebug( LDAP_DEBUG_FILTER, "\tPRESENT\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "\tPRESENT\n", 0, 0, 0 );
         result = presence_candidates( pb, be, f, err, allidslimit );
         break;
 
     case LDAP_FILTER_APPROX:
-        LDAPDebug( LDAP_DEBUG_FILTER, "\tAPPROX\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "\tAPPROX\n", 0, 0, 0 );
         result = ava_candidates( pb, be, f, LDAP_FILTER_APPROX, nextf,
             range, err, allidslimit );
         break;
 
     case LDAP_FILTER_EXTENDED:
-        LDAPDebug( LDAP_DEBUG_FILTER, "\tEXTENSIBLE\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "\tEXTENSIBLE\n", 0, 0, 0 );
         result = extensible_candidates( pb, be, f, err, allidslimit );
         break;
 
     case LDAP_FILTER_AND:
-        LDAPDebug( LDAP_DEBUG_FILTER, "\tAND\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "\tAND\n", 0, 0, 0 );
         result = list_candidates( pb, be, base, f, LDAP_FILTER_AND, err, allidslimit );
         break;
 
     case LDAP_FILTER_OR:
-        LDAPDebug( LDAP_DEBUG_FILTER, "\tOR\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "\tOR\n", 0, 0, 0 );
         result = list_candidates( pb, be, base, f, LDAP_FILTER_OR, err, allidslimit );
         break;
 
     case LDAP_FILTER_NOT:
-        LDAPDebug( LDAP_DEBUG_FILTER, "\tNOT\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "\tNOT\n", 0, 0, 0 );
         result = idl_allids( be );
         break;
 
     default:
-        LDAPDebug( LDAP_DEBUG_FILTER,
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
             "filter_candidates: unknown type 0x%X\n",
             ftype, 0, 0 );
         break;
     }
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= filter_candidates %lu\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= filter_candidates %lu\n",
                    (u_long)IDL_NIDS(result), 0, 0 );
     return( result );
 }
@@ -197,10 +197,10 @@ ava_candidates(
     back_txn      txn = {NULL};
     int           pr_idx = -1;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> ava_candidates\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ava_candidates\n", 0, 0, 0 );
 
     if ( slapi_filter_get_ava( f, &type, &bval ) != 0 ) {
-        LDAPDebug( LDAP_DEBUG_TRACE, "  slapi_filter_get_ava failed\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "  slapi_filter_get_ava failed\n",
             0, 0, 0 );
         return( NULL );
     }
@@ -227,7 +227,7 @@ ava_candidates(
             op = "~=";
             break;
         }
-        LDAPDebug( LDAP_DEBUG_TRACE, "   %s%s%s\n", type, op,
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "   %s%s%s\n", type, op,
             encode( bval, buf ) );
     }
 #endif
@@ -235,13 +235,13 @@ ava_candidates(
     switch ( ftype ) {
         case LDAP_FILTER_GE:
             idl = range_candidates(pb, be, type, bval, NULL, err, &sattr, allidslimit);
-            LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ava_candidates %lu\n",
                        (u_long)IDL_NIDS(idl), 0, 0 );
             goto done;
             break;
         case LDAP_FILTER_LE:
             idl = range_candidates(pb, be, type, NULL, bval, err, &sattr, allidslimit);
-            LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ava_candidates %lu\n",
                        (u_long)IDL_NIDS(idl), 0, 0 );
             goto done;
             break;
@@ -252,7 +252,7 @@ ava_candidates(
             indextype = (char*)indextype_APPROX;
             break;
         default:
-            LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates invalid filter\n", 0, 0, 0 );
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ava_candidates invalid filter\n", 0, 0, 0 );
             goto done;
             break;
     }
@@ -312,7 +312,7 @@ ava_candidates(
         slapi_attr_assertion2keys_ava_sv( &sattr, &sv, &ivals, ftype );
         value_done(&sv);
         if ( ivals == NULL || *ivals == NULL ) {
-            LDAPDebug( LDAP_DEBUG_TRACE,
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                 "<= ava_candidates ALLIDS (no keys)\n", 0, 0, 0 );
             idl = idl_allids( be );
             goto done;
@@ -324,7 +324,7 @@ ava_candidates(
             pagedresults_set_unindexed( pb->pb_conn, pb->pb_op, pr_idx );
         }
          valuearray_free( &ivals );
-         LDAPDebug( LDAP_DEBUG_TRACE, "<= ava_candidates %lu\n",
+         LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ava_candidates %lu\n",
                    (u_long)IDL_NIDS(idl), 0, 0 );
     }
 done:
@@ -346,10 +346,10 @@ presence_candidates(
     int     unindexed = 0;
     back_txn      txn = {NULL};
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> presence_candidates\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> presence_candidates\n", 0, 0, 0 );
 
     if ( slapi_filter_get_type( f, &type ) != 0 ) {
-        LDAPDebug( LDAP_DEBUG_ANY, "   slapi_filter_get_type failed\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "   slapi_filter_get_type failed\n",
             0, 0, 0 );
         return( NULL );
     }
@@ -367,7 +367,7 @@ presence_candidates(
 
     if (idl != NULL && ALLIDS(idl) && strcasecmp(type, "nscpentrydn") == 0) {
         /* try the equality index instead */
-        LDAPDebug(LDAP_DEBUG_TRACE, 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
                       "fallback to eq index as pres index gave allids\n", 
                       0, 0, 0);
         idl_free(&idl);
@@ -376,7 +376,7 @@ presence_candidates(
                                    NULL, NULL, 0, &txn, err, allidslimit);
     }
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= presence_candidates %lu\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= presence_candidates %lu\n",
                    (u_long)IDL_NIDS(idl), 0, 0 );
     return( idl );
 }
@@ -395,7 +395,7 @@ extensible_candidates(
     int mrOP = 0;
     Slapi_Operation *op = NULL;
     back_txn txn = {NULL};
-    LDAPDebug (LDAP_DEBUG_TRACE, "=> extensible_candidates\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> extensible_candidates\n", 0, 0, 0);
     slapi_pblock_get(glob_pb, SLAPI_TXN, &txn.back_txn_txn);
     if ( ! slapi_mr_filter_index (f, pb) &&    !slapi_pblock_get (pb, SLAPI_PLUGIN_MR_QUERY_OPERATOR, &mrOP))
     {
@@ -525,7 +525,7 @@ return_idl:
     op = NULL;
     slapi_pblock_set (pb, SLAPI_OPERATION, op);
     slapi_pblock_destroy (pb);
-    LDAPDebug (LDAP_DEBUG_TRACE, "<= extensible_candidates %lu\n", 
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= extensible_candidates %lu\n", 
                    (u_long)IDL_NIDS(idl), 0, 0);
     return idl;
 }
@@ -555,14 +555,14 @@ range_candidates(
     int operator = 0;
     Operation *op = NULL;
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "=> range_candidates attr=%s\n", type, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> range_candidates attr=%s\n", type, 0, 0);
 
     slapi_pblock_get(pb, SLAPI_TXN, &txn.back_txn_txn);
 
     if (low_val != NULL) {
         slapi_attr_assertion2keys_ava(sattr, low_val, &lows, LDAP_FILTER_EQUALITY);
         if (lows == NULL || *lows == NULL) {
-            LDAPDebug( LDAP_DEBUG_TRACE,
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                        "<= range_candidates ALLIDS (no keys)\n", 0, 0, 0 );
             idl = idl_allids( be );
             goto done;
@@ -573,7 +573,7 @@ range_candidates(
     if (high_val != NULL) {
         slapi_attr_assertion2keys_ava(sattr, high_val, &highs, LDAP_FILTER_EQUALITY);
         if (highs == NULL || *highs == NULL) {
-            LDAPDebug( LDAP_DEBUG_TRACE,
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                        "<= range_candidates ALLIDS (no keys)\n", 0, 0, 0 );
             idl = idl_allids( be );
             goto done;
@@ -606,7 +606,7 @@ done:
     if (lows) ber_bvecfree(lows);
     if (highs) ber_bvecfree(highs);
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= range_candidates %lu\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= range_candidates %lu\n",
                (u_long)IDL_NIDS(idl), 0, 0 );
 
     return idl;
@@ -656,7 +656,7 @@ list_candidates(
     struct berval *vpairs[2] = {NULL, NULL};
     int is_and = 0;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> list_candidates 0x%x\n", ftype, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> list_candidates 0x%x\n", ftype, 0, 0 );
 
     /* 
      * Optimize bounded range queries such as (&(cn>=A)(cn<=B)).
@@ -753,7 +753,7 @@ list_candidates(
         slapi_attr_init(&sattr, tpairs[0]);
         idl = range_candidates(pb, be, tpairs[0], vpairs[0], vpairs[1], err, &sattr, allidslimit);
         attr_done(&sattr);
-        LDAPDebug( LDAP_DEBUG_TRACE, "<= list_candidates %lu\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= list_candidates %lu\n",
                    (u_long)IDL_NIDS(idl), 0, 0 );
         goto out;
     }
@@ -779,7 +779,7 @@ list_candidates(
 
             /* Fetch the IDL for foo */
             /* Later we'll remember to call idl_notin() */
-            LDAPDebug( LDAP_DEBUG_TRACE,"NOT filter\n", 0, 0, 0 );
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"NOT filter\n", 0, 0, 0 );
             if (filter_is_subtype(slapi_filter_list_first(f))) {
                 /*
                  * If subtype is included in the filter (e.g., !(cn;fr=<CN>)),
@@ -806,7 +806,7 @@ list_candidates(
                 attr_done(&sattr);
                 if (tmp == NULL && ftype == LDAP_FILTER_AND)
                 {
-                    LDAPDebug( LDAP_DEBUG_TRACE,
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                         "<= list_candidates NULL\n", 0, 0, 0 );
                     idl_free( &idl );
                     idl = NULL;
@@ -816,7 +816,7 @@ list_candidates(
             /* Proceed as normal */
             else if ( (tmp = filter_candidates_ext( pb, be, base, f, nextf, range, err, allidslimit ))
                 == NULL && ftype == LDAP_FILTER_AND ) {
-                    LDAPDebug( LDAP_DEBUG_TRACE,
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                         "<= list_candidates NULL\n", 0, 0, 0 );
                     idl_free( &idl );
                     idl = NULL;
@@ -879,7 +879,7 @@ list_candidates(
         }
     }
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= list_candidates %lu\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= list_candidates %lu\n",
                    (u_long)IDL_NIDS(idl), 0, 0 );
 out:
     if (is_and) {
@@ -918,10 +918,10 @@ substring_candidates(
     int          pr_idx = -1;
     struct attrinfo *ai = NULL;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> sub_candidates\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> sub_candidates\n", 0, 0, 0 );
 
     if (slapi_filter_get_subfilt( f, &type, &initial, &any, &final ) != 0) {
-        LDAPDebug( LDAP_DEBUG_ANY, "  slapi_filter_get_subfilt fails\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "  slapi_filter_get_subfilt fails\n",
             0, 0, 0 );
         return( NULL );
     }
@@ -939,7 +939,7 @@ substring_candidates(
     if ( ivals == NULL || *ivals == NULL ) {
         slapi_pblock_set( pb, SLAPI_OPERATION_NOTES, &opnote );
         pagedresults_set_unindexed( pb->pb_conn, pb->pb_op, pr_idx );
-        LDAPDebug( LDAP_DEBUG_TRACE,
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
             "<= sub_candidates ALLIDS (no keys)\n", 0, 0, 0 );
         return( idl_allids( be ) );
     }
@@ -956,7 +956,7 @@ substring_candidates(
     }
     valuearray_free( &ivals );
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= sub_candidates %lu\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= sub_candidates %lu\n",
                    (u_long)IDL_NIDS(idl), 0, 0 );
     return( idl );
 }
@@ -977,7 +977,7 @@ keys2idl(
     IDList    *idl;
     int    i;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> keys2idl type %s indextype %s\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> keys2idl type %s indextype %s\n",
         type, indextype, 0 );
     idl = NULL;
     for ( i = 0; ivals[i] != NULL; i++ ) {
@@ -990,7 +990,7 @@ keys2idl(
         {
             char    buf[BUFSIZ];
 
-            LDAPDebug( LDAP_DEBUG_TRACE,
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                 "   ival[%d] = \"%s\" => %lu IDs\n", i,
                 encode( slapi_value_get_berval(ivals[i]), buf ), (u_long)IDL_NIDS(idl2) );
         }
diff --git a/ldap/servers/slapd/back-ldbm/findentry.c b/ldap/servers/slapd/back-ldbm/findentry.c
index 8b842e3..4942ada 100644
--- a/ldap/servers/slapd/back-ldbm/findentry.c
+++ b/ldap/servers/slapd/back-ldbm/findentry.c
@@ -46,7 +46,7 @@ check_entry_for_referral(Slapi_PBlock *pb, Slapi_Entry *entry, char *matched, co
 
 	url=(struct berval **) slapi_ch_malloc((numValues + 1) * sizeof(struct berval*));
 	if (!url) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"check_entry_for_referral: Out of memory\n",
 			0, 0, 0);
 		goto out;
@@ -62,7 +62,7 @@ check_entry_for_referral(Slapi_PBlock *pb, Slapi_Entry *entry, char *matched, co
 	slapi_send_ldap_result( pb, LDAP_REFERRAL, matched, NULL, 0, refscopy );
 	rc= 1;
 
-	LDAPDebug( LDAP_DEBUG_TRACE,
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		"<= %s sent referral to (%s) for (%s)\n",
 		callingfn,
 		refscopy ? refscopy[0]->bv_val : "",
@@ -133,7 +133,7 @@ find_entry_internal_dn(
 
 		/* wait for entry modify lock */
 		if ( !lock || cache_lock_entry( &inst->inst_cache, e ) == 0 ) {
-			LDAPDebug( LDAP_DEBUG_TRACE,
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 			    "<= find_entry_internal_dn found (%s)\n", slapi_sdn_get_dn(sdn), 0, 0 );
 			return( e );
 		}
@@ -141,13 +141,13 @@ find_entry_internal_dn(
 		 * this entry has been deleted - see if it was actually
 		 * replaced with a new copy, and try the whole thing again.
 		 */
-		LDAPDebug( LDAP_DEBUG_ARGS,
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG,
 		    "   find_entry_internal_dn retrying (%s)\n", slapi_sdn_get_dn(sdn), 0, 0 );
 		CACHE_RETURN( &inst->inst_cache, &e );
 		tries++;
 	}
 	if (tries >= LDBM_CACHE_RETRY_COUNT) {
-		LDAPDebug( LDAP_DEBUG_ANY,"find_entry_internal_dn retry count exceeded (%s)\n", slapi_sdn_get_dn(sdn), 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"find_entry_internal_dn retry count exceeded (%s)\n", slapi_sdn_get_dn(sdn), 0, 0 );
 	}
 	/*
 	 * there is no such entry in this server. see how far we
@@ -243,7 +243,7 @@ find_entry_internal_dn(
 	}
 
 	slapi_ch_free_string(&errbuf);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= find_entry_internal_dn not found (%s)\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= find_entry_internal_dn not found (%s)\n",
 	    slapi_sdn_get_dn(sdn), 0, 0 );
 	return( NULL );
 }
@@ -277,7 +277,7 @@ find_entry_internal_uniqueid(
 
 		/* wait for entry modify lock */
 		if ( !lock || cache_lock_entry( &inst->inst_cache, e ) == 0 ) {
-			LDAPDebug( LDAP_DEBUG_TRACE,
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 			    "<= find_entry_internal_uniqueid found; uniqueid = (%s)\n", 
 			uniqueid, 0, 0 );
 			return( e );
@@ -286,14 +286,14 @@ find_entry_internal_uniqueid(
 		 * this entry has been deleted - see if it was actually
 		 * replaced with a new copy, and try the whole thing again.
 		 */
-		LDAPDebug( LDAP_DEBUG_ARGS,
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG,
 			"   find_entry_internal_uniqueid retrying; uniqueid = (%s)\n", 
 			uniqueid, 0, 0 );
 		CACHE_RETURN( &inst->inst_cache, &e );
 		tries++;
 	}
 	if (tries >= LDBM_CACHE_RETRY_COUNT) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"find_entry_internal_uniqueid retry count exceeded; uniqueid = (%s)\n", 
 			uniqueid , 0, 0 );
 	}
@@ -302,7 +302,7 @@ find_entry_internal_uniqueid(
 	slapi_send_ldap_result( pb, ( 0 == err || DB_NOTFOUND == err ) ?
 		LDAP_NO_SUCH_OBJECT : LDAP_OPERATIONS_ERROR, NULL /* matched */, NULL,
 		0, NULL );
-	LDAPDebug( LDAP_DEBUG_TRACE, 
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 		"<= find_entry_internal_uniqueid not found; uniqueid = (%s)\n",
 	    uniqueid, 0, 0 );
 	return( NULL );
@@ -322,7 +322,7 @@ find_entry_internal(
 	/* check if we should search based on uniqueid or dn */
 	if (addr->uniqueid!=NULL)
 	{
-		LDAPDebug( LDAP_DEBUG_TRACE, "=> find_entry_internal (uniqueid=%s) lock %d\n",
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> find_entry_internal (uniqueid=%s) lock %d\n",
 		    addr->uniqueid, lock, 0 );
 		return (find_entry_internal_uniqueid (pb, be, addr->uniqueid, lock, txn));
 	}
@@ -330,7 +330,7 @@ find_entry_internal(
 	{
 		struct backentry *entry = NULL;
 
-		LDAPDebug( LDAP_DEBUG_TRACE, "=> find_entry_internal (dn=%s) lock %d\n",
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> find_entry_internal (dn=%s) lock %d\n",
 		           slapi_sdn_get_dn(addr->sdn), lock, 0 );
 		if (addr->sdn) {
 			entry = find_entry_internal_dn (pb, be, addr->sdn, lock, txn, flags, rc);
diff --git a/ldap/servers/slapd/back-ldbm/id2entry.c b/ldap/servers/slapd/back-ldbm/id2entry.c
index aa012c1..e6521d9 100644
--- a/ldap/servers/slapd/back-ldbm/id2entry.c
+++ b/ldap/servers/slapd/back-ldbm/id2entry.c
@@ -36,11 +36,11 @@ id2entry_add_ext(backend *be, struct backentry *e, back_txn *txn,
     struct backentry *encrypted_entry = NULL;
     char *entrydn = NULL;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> id2entry_add( %lu, \"%s\" )\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> id2entry_add( %lu, \"%s\" )\n",
                                  (u_long)e->ep_id, backentry_get_ndn(e), 0 );
 
     if ( (rc = dblayer_get_id2entry( be, &db )) != 0 ) {
-        LDAPDebug( LDAP_DEBUG_ANY, "Could not open/create id2entry\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Could not open/create id2entry\n",
             0, 0, 0 );
         rc = -1;
         goto done;
@@ -56,7 +56,7 @@ id2entry_add_ext(backend *be, struct backentry *e, back_txn *txn,
     if (encrypt) {
         rc = attrcrypt_encrypt_entry(be, e, &encrypted_entry);
         if (rc) {
-            LDAPDebug( LDAP_DEBUG_ANY, "attrcrypt_encrypt_entry failed in id2entry_add\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "attrcrypt_encrypt_entry failed in id2entry_add\n",
                 0, 0, 0 );
             rc = -1;
             goto done;
@@ -82,7 +82,7 @@ id2entry_add_ext(backend *be, struct backentry *e, back_txn *txn,
                     if (cache_replace( &inst->inst_dncache, oldbdn, bdn ) != 0) {
                         /* The entry was not in the cache for some reason (this
                          * should not happen since CACHE_ADD said it existed above). */
-                        LDAPDebug( LDAP_DEBUG_ANY, "id2entry_add_ext(): Entry disappeared "
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "id2entry_add_ext(): Entry disappeared "
                                    "from cache (%s)\n", oldbdn->dn_sdn, 0, 0 );
                     }
                 }
@@ -189,7 +189,7 @@ done:
         backentry_free(&encrypted_entry);
     }
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= id2entry_add %d\n", rc, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= id2entry_add %d\n", rc, 0, 0 );
     return( rc );
 }
 
@@ -211,11 +211,11 @@ id2entry_delete( backend *be, struct backentry *e, back_txn *txn )
     int    rc;
     char temp_id[sizeof(ID)];
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> id2entry_delete( %lu, \"%s\" )\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> id2entry_delete( %lu, \"%s\" )\n",
         (u_long)e->ep_id, backentry_get_ndn(e), 0 );
 
     if ( (rc = dblayer_get_id2entry( be, &db )) != 0 ) {
-        LDAPDebug( LDAP_DEBUG_ANY, "Could not open/create id2entry\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Could not open/create id2entry\n",
             0, 0, 0 );
         return( -1 );
     }
@@ -245,7 +245,7 @@ id2entry_delete( backend *be, struct backentry *e, back_txn *txn )
     rc = db->del( db,db_txn,&key,0 );
     dblayer_release_id2entry( be, db );
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= id2entry_delete %d\n", rc, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= id2entry_delete %d\n", rc, 0, 0 );
     return( rc );
 }
 
diff --git a/ldap/servers/slapd/back-ldbm/idl.c b/ldap/servers/slapd/back-ldbm/idl.c
index ada7879..7ecdc81 100644
--- a/ldap/servers/slapd/back-ldbm/idl.c
+++ b/ldap/servers/slapd/back-ldbm/idl.c
@@ -72,7 +72,7 @@ static void idl_init_maxids(struct ldbminfo *li,idl_private *priv)
     }
     priv->idl_maxindirect = (li->li_allidsthreshold / priv->idl_maxids) + 1;
     priv->idl_allidslimit = (priv->idl_maxids * priv->idl_maxindirect);
-    LDAPDebug (LDAP_DEBUG_ARGS,
+    LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG,
         "idl_init_private: blksize %lu, maxids %i, maxindirect %i\n",
         (unsigned long)blksize, priv->idl_maxids, priv->idl_maxindirect);
 }
@@ -195,7 +195,7 @@ idl_fetch_one(
 	DBT	data = {0};
 	IDList	*idl = NULL;
 
-	/* LDAPDebug( LDAP_DEBUG_TRACE, "=> idl_fetch_one\n", 0, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> idl_fetch_one\n", 0, 0, 0 ); */
 
 	data.flags = DB_DBT_MALLOC;
 
@@ -205,14 +205,14 @@ idl_fetch_one(
 		{
 			char *msg;
 			if ( EPERM == *err && *err != errno ) {
-		    	    LDAPDebug( LDAP_DEBUG_ANY,
+		    	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			      "idl_fetch_one(%s): Database failed to run, "
 			      "There is either insufficient disk space or "
 			      "insufficient memory available for database.\n",
 			      ((char*)key->dptr)[ key->dsize - 1 ] ?
 			      "" : (char*)key->dptr, 0, 0 );
 			} else {
-			    LDAPDebug( LDAP_DEBUG_ANY,
+			    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			      "idl_fetch_one error %d %s\n",
 			      *err, (msg = dblayer_strerror( *err )) ? msg : "", 0 );
 			}
@@ -246,7 +246,7 @@ idl_old_fetch(
 	int	i;
 	unsigned long nids;
 
-	/* LDAPDebug( LDAP_DEBUG_TRACE, "=> idl_fetch\n", 0, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> idl_fetch\n", 0, 0, 0 ); */
 	if ( (idl = idl_fetch_one( li, db, key, txn, err )) == NULL ) {
 		return( NULL );
 	}
@@ -324,16 +324,16 @@ idl_old_fetch(
 
 		/* Check for inconsistencies: */
 		if ( tmp[i]->b_ids[0] != thisID ) {
-		    LDAPDebug (LDAP_DEBUG_ANY, "idl_fetch_one(%s)->b_ids[0] == %lu\n",
+		    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_fetch_one(%s)->b_ids[0] == %lu\n",
 			       k2.dptr, (u_long)tmp[i]->b_ids[0], 0);
 		}
 		if ( nextID != NOID ) {
 		    if ( nextID <= thisID ) {
-			LDAPDebug (LDAP_DEBUG_ANY, "indirect block (%s) contains %lu, %lu\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "indirect block (%s) contains %lu, %lu\n",
 				   key->dptr, (u_long)thisID, (u_long)nextID);
 		    }
 		    if ( nextID <= tmp[i]->b_ids[(tmp[i]->b_nids)-1] ) {
-			LDAPDebug (LDAP_DEBUG_ANY, "idl_fetch_one(%s)->b_ids[last] == %lu"
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_fetch_one(%s)->b_ids[last] == %lu"
 				   " >= %lu (next indirect ID)\n",
 				   k2.dptr, (u_long)tmp[i]->b_ids[(tmp[i]->b_nids)-1], (u_long)nextID);
 		    }
@@ -363,7 +363,7 @@ idl_old_fetch(
 	}
 	slapi_ch_free((void**)&tmp );
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= idl_fetch %lu ids (%lu max)\n", (u_long)idl->b_nids,
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= idl_fetch %lu ids (%lu max)\n", (u_long)idl->b_nids,
 	    (u_long)idl->b_nmax, 0 );
 	return( idl );
 }
@@ -380,7 +380,7 @@ idl_store(
   int        rc;
   DBT        data = {0};
   
-  /* LDAPDebug( LDAP_DEBUG_TRACE, "=> idl_store\n", 0, 0, 0 ); */
+  /* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> idl_store\n", 0, 0, 0 ); */
   
   data.dptr = (char *) idl;
   data.dsize = (2 + idl->b_nmax) * sizeof(ID);
@@ -389,7 +389,7 @@ idl_store(
   if ( 0 != rc ) {
     char *msg;
     if ( EPERM == rc && rc != errno ) {
-      LDAPDebug( LDAP_DEBUG_ANY,
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                  "idl_store(%s): Database failed to run, "
                  "There is insufficient memory available for database.\n",
                  ((char*)key->dptr)[ key->dsize - 1 ] ? "" : (char*)key->dptr, 0, 0 );
@@ -402,13 +402,13 @@ idl_store(
                  ((char*)key->dptr)[ key->dsize - 1 ] ? "" : (char*)key->dptr,
                  rc, (msg = dblayer_strerror( rc )) ? msg : "" );
       if (rc == DB_RUNRECOVERY) {
-        LDAPDebug(LDAP_DEBUG_ANY, "%s\n", "Note: idl_store failures can be an indication of insufficient disk space.", 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s\n", "Note: idl_store failures can be an indication of insufficient disk space.", 0, 0);
         ldbm_nasty("idl_store",71,rc);
       }
     }
   }
   
-  /* LDAPDebug( LDAP_DEBUG_TRACE, "<= idl_store %d\n", rc, 0, 0 ); */
+  /* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= idl_store %d\n", rc, 0, 0 ); */
   return( rc );
 }
 
@@ -471,13 +471,13 @@ idl_change_first(
 	int	rc;
 	char	*msg;
 
-	/* LDAPDebug( LDAP_DEBUG_TRACE, "=> idl_change_first\n", 0, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> idl_change_first\n", 0, 0, 0 ); */
 
 	/* delete old key block */
 	rc = db->del( db, txn, bkey, 0 );
 	if ( (rc != 0) && (DB_LOCK_DEADLOCK != rc) )
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "idl_change_first del (%s) err %d %s\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_change_first del (%s) err %d %s\n",
 			   bkey->dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 		if (rc == DB_RUNRECOVERY) {
 		    ldbm_nasty("idl_store",72,rc);
@@ -507,7 +507,7 @@ do { \
     char* fmt = slapi_ch_malloc (strlen(func) + strlen(note) + strlen(FORMAT) + 30); \
     if (fmt != NULL) { \
 	sprintf (fmt, "%s(%%s,%lu) %s: %s\n", func, (u_long)id, note, FORMAT); \
-	LDAPDebug (LDAP_DEBUG_ANY, fmt, key->dptr, ARG1, ARG2); \
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, fmt, key->dptr, ARG1, ARG2); \
 	slapi_ch_free((void**)&fmt); \
     } \
 } while(0)
@@ -590,7 +590,7 @@ idl_old_insert_key(
 		if ( rc != 0 && rc != DB_NOTFOUND ) {
 			if ( rc != DB_LOCK_DEADLOCK )
 			{
-				LDAPDebug( LDAP_DEBUG_ANY, "idl_insert_key 0 BAD %d %s\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_insert_key 0 BAD %d %s\n",
 					   rc, (msg = dblayer_strerror( rc )) ? msg : "", 0 );
 			}
 			return( rc );
@@ -600,7 +600,7 @@ idl_old_insert_key(
 		rc = idl_store( be, db, key, idl, txn );
 		if ( rc != 0 && rc != DB_LOCK_DEADLOCK )
 		{
-			LDAPDebug( LDAP_DEBUG_ANY, "idl_insert_key 1 BAD %d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_insert_key 1 BAD %d %s\n",
 				   rc, (msg = dblayer_strerror( rc )) ? msg : "", 0 );
 		}
 
@@ -638,7 +638,7 @@ idl_old_insert_key(
 				idl_unlock_list(a->ai_idl,key);
 				if ( rc != 0 && rc != DB_LOCK_DEADLOCK)
 				{
-					LDAPDebug( LDAP_DEBUG_ANY, "idl_insert_key 2 BAD %d %s\n",
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_insert_key 2 BAD %d %s\n",
 						   rc, (msg = dblayer_strerror( rc )) ? msg : "", 0 );
 				}
 				if (NULL != disposition) {
@@ -666,7 +666,7 @@ idl_old_insert_key(
 				idl_free( &tmp2 );
 				if ( rc != DB_LOCK_DEADLOCK )
 				{
-					LDAPDebug( LDAP_DEBUG_ANY, "idl_insert_key 3 BAD %d %s\n",
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_insert_key 3 BAD %d %s\n",
 						   rc, (msg = dblayer_strerror( rc )) ? msg : "", 0 );
 				}
 				return( rc );
@@ -692,7 +692,7 @@ idl_old_insert_key(
 				idl_free( &tmp2 );
 				if ( rc != DB_LOCK_DEADLOCK )
 				{
-					LDAPDebug( LDAP_DEBUG_ANY, "idl_insert_key 4 BAD %d %s\n",
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_insert_key 4 BAD %d %s\n",
 						   rc, (msg = dblayer_strerror( rc )) ? msg : "", 0 );
 				}
 				return( rc );
@@ -710,7 +710,7 @@ idl_old_insert_key(
 		idl_unlock_list(a->ai_idl,key);
 		if ( rc != 0 && rc != DB_LOCK_DEADLOCK )
 		{
-			LDAPDebug( LDAP_DEBUG_ANY, "idl_insert_key 5 BAD %d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_insert_key 5 BAD %d %s\n",
 				   rc, (msg = dblayer_strerror( rc )) ? msg : "", 0 );
 		}
 		return( rc );
@@ -729,7 +729,7 @@ idl_old_insert_key(
 		;	/* NULL */
 	if ( id == idl->b_ids[i] ) {	/* already in a block */
 #ifdef _DEBUG_LARGE_BLOCKS
-		LDAPDebug( LDAP_DEBUG_ANY, 
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 		    "id %lu for key (%s) is already in block %d\n",
 		    (u_long)id, key.dptr, i);
 #endif
@@ -750,12 +750,12 @@ idl_old_insert_key(
 		if ( rc != 0 ) {
 			if ( rc != DB_LOCK_DEADLOCK )
 			{
-				LDAPDebug( LDAP_DEBUG_ANY, "idl_insert_key 5.5 BAD %d %s\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_insert_key 5.5 BAD %d %s\n",
 					   rc, (msg = dblayer_strerror( rc )) ? msg : "", 0 );
 			}
 			return( rc );
 		}
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "nonexistent continuation block (%s)\n", k2.dptr, 0, 0 );
 		idl_unlock_list(a->ai_idl,key);
 		idl_free( &idl );
@@ -815,7 +815,7 @@ idl_old_insert_key(
 			    == NULL ) {
 				if ( rc != DB_LOCK_DEADLOCK )
 				{
-					LDAPDebug( LDAP_DEBUG_ANY,
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					    "idl_fetch_one (%s) returns NULL\n",
 					    k3.dptr, 0, 0 );
 				}
@@ -868,10 +868,10 @@ idl_old_insert_key(
 						break;
 					case 2:	/* already there - how? */
 					case 3: /* split block - how? */
-						LDAPDebug( LDAP_DEBUG_ANY,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"not expecting (%d) from idl_insert_maxids of %lu in (%s)\n",
 						    rc, (u_long)id, k2.dptr );
-						LDAPDebug( LDAP_DEBUG_ANY,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 						    "likely database corruption\n",
 						    0, 0, 0 );
 						rc = 0;
@@ -900,10 +900,10 @@ idl_old_insert_key(
 				 * we started this insert. what can we do
 				 * aside from log a warning?
 				 */
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
     "not expecting return %d from idl_insert_maxids of id %lu in block with key (%s)\n",
 				    rc, (u_long)tmp->b_ids[tmp->b_nids-1], k3.dptr );
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				    "likely database corruption\n", 0, 0, 0 );
 				/* FALL */
 			case 3:		/* block is full */
@@ -1134,7 +1134,7 @@ int idl_old_store_block(
 					slapi_ch_free(&(cont_key.data));
 					if ( ret != 0 && ret != DB_LOCK_DEADLOCK )
 					{
-						LDAPDebug( LDAP_DEBUG_ANY, "idl_store_block(%s) 1 BAD %d %s\n",key->data, ret, dblayer_strerror( ret ));
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_store_block(%s) 1 BAD %d %s\n",key->data, ret, dblayer_strerror( ret ));
 						goto done;
 					}
 					/* Put the lead ID number in the header block */
@@ -1358,7 +1358,7 @@ idl_old_delete_key(
 	IDList	*idl, *didl;
 	DBT	contkey = {0};
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> idl_delete_key(%s,%lu)\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> idl_delete_key(%s,%lu)\n",
 		   key->dptr, (u_long)id, 0 );
 
 	idl_Wlock_list(a->ai_idl,key);
@@ -1367,11 +1367,11 @@ idl_old_delete_key(
 		idl_unlock_list(a->ai_idl,key);
 		if ( rc != 0 && rc != DB_NOTFOUND && rc != DB_LOCK_DEADLOCK )
 		{
-			LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key(%s) 0 BAD %d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key(%s) 0 BAD %d %s\n",
 				   key->dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 		}
 		if ( 0 == rc || DB_NOTFOUND == rc ) rc = -666;
-		LDAPDebug( LDAP_DEBUG_TRACE, "<= idl_delete_key(%s,%lu) %d !idl_fetch_one\n",
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= idl_delete_key(%s,%lu) %d !idl_fetch_one\n",
 			   key->dptr, (u_long)id, rc );
 		return rc;
 	}
@@ -1384,7 +1384,7 @@ idl_old_delete_key(
 			rc = idl_store( be, db, key, idl, txn );
 			if ( rc != 0 && rc != DB_LOCK_DEADLOCK )
 			{
-				LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key(%s) 1 BAD %d %s\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key(%s) 1 BAD %d %s\n",
 					   key->dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 			}
 			break;
@@ -1393,7 +1393,7 @@ idl_old_delete_key(
 			rc = db->del( db, txn, key, 0 );
 			if ( rc != 0 && rc != DB_LOCK_DEADLOCK )
 			{
-				LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key(%s) 2 BAD %d %s\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key(%s) 2 BAD %d %s\n",
 					   key->dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 				if (rc == DB_RUNRECOVERY) {
 				    ldbm_nasty("",74,rc);
@@ -1408,14 +1408,14 @@ idl_old_delete_key(
 			break;
 
 		default:
-			LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key(%s) 3 BAD idl_delete\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key(%s) 3 BAD idl_delete\n",
 				   key->dptr, 0, 0 );
 			break;
 		}
 
 		idl_free( &idl );
 		idl_unlock_list(a->ai_idl,key);
-		LDAPDebug( LDAP_DEBUG_TRACE, "<= idl_delete_key(%s,%lu) %d (not indirect)\n",
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= idl_delete_key(%s,%lu) %d (not indirect)\n",
 			   key->dptr, (u_long)id, rc );
 		return( rc );
 	}
@@ -1436,7 +1436,7 @@ idl_old_delete_key(
 	if ( i == 0 && id < idl->b_ids[i] ) {
 		idl_free( &idl );
 		idl_unlock_list(a->ai_idl,key);
-		LDAPDebug( LDAP_DEBUG_TRACE, "<= idl_delete_key(%s,%lu) -666 (id not found)\n",
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= idl_delete_key(%s,%lu) -666 (id not found)\n",
 			   key->dptr, (u_long)id, 0 );
 		return( -666 );
 	}
@@ -1451,10 +1451,10 @@ idl_old_delete_key(
 		idl_unlock_list(a->ai_idl,key);
 		if ( rc != DB_LOCK_DEADLOCK )
 		{
-			LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key(%s) 5 BAD %d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key(%s) 5 BAD %d %s\n",
 				   contkey.dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 		}
-		LDAPDebug( LDAP_DEBUG_TRACE, "<= idl_delete_key(%s,%lu) %d idl_fetch_one(contkey)\n",
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= idl_delete_key(%s,%lu) %d idl_fetch_one(contkey)\n",
 			   contkey.dptr, (u_long)id, rc );
 		slapi_ch_free( (void **)&(contkey.dptr) );
 		return( rc );
@@ -1466,7 +1466,7 @@ idl_old_delete_key(
 		if ( (rc = idl_store( be, db, &contkey, didl, txn )) != 0 ) {
 		    if ( rc != DB_LOCK_DEADLOCK )
 		    {
-			LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key(%s) BAD %d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key(%s) BAD %d %s\n",
 				   contkey.dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 		    }
 		}
@@ -1479,7 +1479,7 @@ idl_old_delete_key(
 		rc = idl_change_first( be, db, key, idl, i, &contkey, didl, txn );
 		if ( rc != 0 && rc != DB_LOCK_DEADLOCK )
 		{
-			LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key(%s) 7 BAD %d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key(%s) 7 BAD %d %s\n",
 				   contkey.dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 		}
 		if (0 != rc) {
@@ -1495,14 +1495,14 @@ idl_old_delete_key(
 		    rc = idl_store( be, db, key, idl, txn );
 		    if ( rc != 0 && rc != DB_LOCK_DEADLOCK )
 		    {
-			LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key: idl_store(%s) BAD %d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key: idl_store(%s) BAD %d %s\n",
 				   key->dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 		    }
 		} else { /* This index is entirely empty.  Delete the header: */
 		    rc = db->del( db, txn, key, 0 );
 		    if ( rc != 0 && rc != DB_LOCK_DEADLOCK )
 		    {
-			LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key: db->del(%s) BAD %d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key: db->del(%s) BAD %d %s\n",
 				   key->dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 			if (rc == DB_RUNRECOVERY) {
 			    ldbm_nasty("",75,rc);
@@ -1514,7 +1514,7 @@ idl_old_delete_key(
 		    rc = db->del( db, txn, &contkey, 0 );
 		    if ( rc != 0 && rc != DB_LOCK_DEADLOCK )
 		    {
-			LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key: db->del(%s) BAD %d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key: db->del(%s) BAD %d %s\n",
 				   contkey.dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 			if (rc == DB_RUNRECOVERY) {
 			    ldbm_nasty("",76,rc);
@@ -1529,7 +1529,7 @@ idl_old_delete_key(
 		idl_check_indirect( idl, i, didl, NULL, "idl_delete_key", "3", key, id );
 		break;
 	case 4:		/* all ids block - should not happen */
-		LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key: cont block (%s) is allids\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key: cont block (%s) is allids\n",
 			   contkey.dptr, 0, 0 );
 		rc = 0;
 		break;
@@ -1540,10 +1540,10 @@ idl_old_delete_key(
 	idl_unlock_list(a->ai_idl,key);
 	if ( rc != 0 && rc != DB_LOCK_DEADLOCK )
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "idl_delete_key(%s) 9 BAD %d %s\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "idl_delete_key(%s) 9 BAD %d %s\n",
 			   key->dptr, rc, (msg = dblayer_strerror( rc )) ? msg : "" );
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= idl_delete_key(%s,%lu) %d (indirect)\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= idl_delete_key(%s,%lu) %d (indirect)\n",
 		   key->dptr, (u_long)id, rc );
 	return( rc );
 }
diff --git a/ldap/servers/slapd/back-ldbm/idl_new.c b/ldap/servers/slapd/back-ldbm/idl_new.c
index e05f577..a20587e 100644
--- a/ldap/servers/slapd/back-ldbm/idl_new.c
+++ b/ldap/servers/slapd/back-ldbm/idl_new.c
@@ -207,7 +207,7 @@ idl_new_fetch(
         if (DB_NOTFOUND != ret) {
 #ifdef DB_USE_BULK_FETCH
             if (ret == DB_BUFFER_SMALL) {
-                LDAPDebug(LDAP_DEBUG_ANY, "database index is corrupt; "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "database index is corrupt; "
                           "data item for key %s is too large for our buffer "
                           "(need=%d actual=%d)\n",
                           key.data, data.size, data.ulen);
@@ -238,7 +238,7 @@ idl_new_fetch(
                 break;
             }
             if (dataret.size != sizeof(ID)) {
-                LDAPDebug(LDAP_DEBUG_ANY, "database index is corrupt; "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "database index is corrupt; "
                           "key %s has a data item with the wrong size (%d)\n", 
                           key.data, dataret.size, 0);
                 goto error;
@@ -255,7 +255,7 @@ idl_new_fetch(
             /* we got another ID, add it to our IDL */
             idl_rc = idl_append_extend(&idl, id);
             if (idl_rc) {
-                LDAPDebug(LDAP_DEBUG_ANY, "unable to extend id list (err=%d)\n", idl_rc, 0, 0);
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to extend id list (err=%d)\n", idl_rc, 0, 0);
                 idl_free(&idl);
                 goto error;
             }
@@ -263,7 +263,7 @@ idl_new_fetch(
             count++;
         }
 
-        LDAPDebug(LDAP_DEBUG_TRACE, "bulk fetch buffer nids=%d\n", count, 0, 0); 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "bulk fetch buffer nids=%d\n", count, 0, 0); 
 #if defined(DB_ALLIDS_ON_READ)	
         /* enforce the allids read limit */
         if ((NEW_IDL_NO_ALLID != *flag_err) && (NULL != a) &&
@@ -271,7 +271,7 @@ idl_new_fetch(
         	idl->b_nids = 1;
         	idl->b_ids[0] = ALLID;
         	ret = DB_NOTFOUND; /* fool the code below into thinking that we finished the dups */
-        	LDAPDebug(LDAP_DEBUG_BACKLDBM, "search for key for attribute index %s "
+        	LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "search for key for attribute index %s "
         		  "exceeded allidslimit %d - count is %d\n",
         		  a->ai_type, allidslimit, count);
         	break;
@@ -321,10 +321,10 @@ idl_new_fetch(
     if (idl != NULL && idl->b_nids == 1 && idl->b_ids[0] == ALLID) {
         idl_free(&idl);
         idl = idl_allids(be);
-        LDAPDebug(LDAP_DEBUG_TRACE, "idl_new_fetch %s returns allids\n", 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "idl_new_fetch %s returns allids\n", 
                   key.data, 0, 0);
     } else {
-        LDAPDebug(LDAP_DEBUG_TRACE, "idl_new_fetch %s returns nids=%lu\n", 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "idl_new_fetch %s returns nids=%lu\n", 
                   key.data, (u_long)IDL_NIDS(idl), 0);
     }
 
@@ -465,7 +465,7 @@ idl_new_range_fetch(
         if (DB_NOTFOUND != ret) {
 #ifdef DB_USE_BULK_FETCH
             if (ret == DB_BUFFER_SMALL) {
-                LDAPDebug(LDAP_DEBUG_ANY, "database index is corrupt; "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "database index is corrupt; "
                           "data item for key %s is too large for our buffer "
                           "(need=%d actual=%d)\n",
                           cur_key.data, data.size, data.ulen);
@@ -532,7 +532,7 @@ idl_new_range_fetch(
                 break;
             }
             if (dataret.size != sizeof(ID)) {
-                LDAPDebug(LDAP_DEBUG_ANY, "database index is corrupt; "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "database index is corrupt; "
                           "key %s has a data item with the wrong size (%d)\n", 
                           cur_key.data, dataret.size, 0);
                 goto error;
@@ -580,7 +580,7 @@ idl_new_range_fetch(
             count++;
         }
 
-        LDAPDebug(LDAP_DEBUG_TRACE, "bulk fetch buffer nids=%d\n", count, 0, 0); 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "bulk fetch buffer nids=%d\n", count, 0, 0); 
 #if defined(DB_ALLIDS_ON_READ)
         /* enforce the allids read limit */
         if ((NEW_IDL_NO_ALLID != *flag_err) && ai && (idl != NULL) &&
@@ -827,12 +827,12 @@ int idl_new_insert_key(
     } else {
         /* check for allidslimit exceeded in database */
         if (cursor->c_count(cursor, &count, 0) != 0) {
-            LDAPDebug(LDAP_DEBUG_ANY, "could not obtain count for key %s\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "could not obtain count for key %s\n",
                       key->data, 0, 0);
             goto error;
         }
         if ((size_t)count > idl_new_get_allidslimit(a, 0)) {
-            LDAPDebug(LDAP_DEBUG_TRACE, "allidslimit exceeded for key %s\n",
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "allidslimit exceeded for key %s\n",
                       key->data, 0, 0);
             cursor->c_close(cursor);
             cursor = NULL;
@@ -987,7 +987,7 @@ static int idl_new_store_allids(backend *be, DB *db, DBT *key, DB_TXN *txn)
         goto error;
     }
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "key %s has been set to allids\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "key %s has been set to allids\n",
               key->data, 0, 0);
 
 error:
@@ -1082,12 +1082,12 @@ int idl_new_store_block(
 #if defined(DB_ALLIDS_ON_WRITE)
     /* check for allidslimit exceeded in database */
     if (cursor->c_count(cursor, &count, 0) != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY, "could not obtain count for key %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "could not obtain count for key %s\n",
                   key->data, 0, 0);
         goto error;
     }
     if ((size_t)count > idl_new_get_allidslimit(a, 0)) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "allidslimit exceeded for key %s\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "allidslimit exceeded for key %s\n",
                   key->data, 0, 0);
         cursor->c_close(cursor);
         cursor = NULL;
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index c3fca2b..62daa7c 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -68,7 +68,7 @@ static int import_generate_uniqueid(ImportJob *job, Slapi_Entry *e)
         if (rc == UID_SUCCESS) {
             slapi_entry_set_uniqueid (e, newuniqueid);
         } else {
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                        "import_generate_uniqueid: failed to generate "
                        "uniqueid for %s; error=%d.\n", 
                        slapi_entry_get_dn_const(e), rc, 0 );
@@ -930,7 +930,7 @@ index_producer(void *param)
     /* get a cursor to we can walk over the table */
     db_rval = db->cursor(db, NULL, &dbc, 0);
     if ( db_rval || !dbc ) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "Failed to get cursor for reindexing\n", 0, 0, 0 );
         dblayer_release_id2entry(be, db);
         goto error;
@@ -966,7 +966,7 @@ index_producer(void *param)
         
         if (0 != db_rval) {
             if (DB_NOTFOUND != db_rval) {
-                LDAPDebug(LDAP_DEBUG_ANY, "%s: Failed to read database, "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: Failed to read database, "
                     "errno=%d (%s)\n", inst->inst_name, db_rval,
                     dblayer_strerror(db_rval));
                 if (job->task) {
@@ -1090,7 +1090,7 @@ index_producer(void *param)
                         "%s: WARNING: skipping badly formatted entry (id %lu)",
                         inst->inst_name, (u_long)temp_id);
                 }
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "%s: WARNING: skipping badly formatted entry (id %lu)\n",
                     inst->inst_name, (u_long)temp_id, 0);
                 continue;
@@ -1528,7 +1528,7 @@ upgradedn_producer(void *param)
                         "%s: Finished to read database", inst->inst_name);
                 }
             } else {
-                LDAPDebug(LDAP_DEBUG_ANY, "%s: Failed to read database, "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: Failed to read database, "
                     "errno=%d (%s)\n", inst->inst_name, db_rval,
                     dblayer_strerror(db_rval));
                 if (job->task) {
@@ -1662,7 +1662,7 @@ upgradedn_producer(void *param)
                         "%s: WARNING: skipping badly formatted entry (id %lu)",
                         inst->inst_name, (u_long)temp_id);
             }
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "%s: WARNING: skipping badly formatted entry (id %lu)\n",
                       inst->inst_name, (u_long)temp_id, 0);
             continue;
@@ -1782,7 +1782,7 @@ upgradedn_producer(void *param)
                         char *newrdn = slapi_create_dn_string("%s %u", rdn, temp_id);
                         char *parentdn = slapi_dn_parent(normdn);
                         /* This entry is a conflict of alt_id */
-                        LDAPDebug(LDAP_DEBUG_ANY,
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                   "Entry %s (%lu) is a conflict of (%lu)\n",
                                   normdn, temp_id, alt_id);
                         LDAPDebug2Args(LDAP_DEBUG_ANY, "Renaming \"%s\" to \"%s\"\n",
@@ -1804,7 +1804,7 @@ upgradedn_producer(void *param)
                                           slapi_ch_strdup(rdn), 0);
                     rc = slapi_entry_add_rdn_values(e);
                     if (rc) {
-                        LDAPDebug(LDAP_DEBUG_ANY, "%s: Failed to add rdn values"
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: Failed to add rdn values"
                                   " to an entry: %s (id %lu)\n",
                                   inst->inst_name, normdn, (u_long)temp_id);
                         goto error;
@@ -1834,7 +1834,7 @@ upgradedn_producer(void *param)
 
             rdnp = PL_strchr(rdn, '=');
             if (NULL == rdnp) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "%s: WARNING: skipping an entry with corrupted RDN \"%s\" "
                     "(id %lu)\n",
                     inst->inst_name, rdn, (u_long)temp_id);
@@ -1865,7 +1865,7 @@ upgradedn_producer(void *param)
                  */
                 rc = slapi_entry_add_rdn_values(e);
                 if (rc) {
-                    LDAPDebug(LDAP_DEBUG_ANY, "%s: Failed to add rdn values "
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: Failed to add rdn values "
                               "to an entry: %s (id %lu)\n",
                               inst->inst_name, normdn, (u_long)temp_id);
                     slapi_entry_free(e); e = NULL;
@@ -1928,7 +1928,7 @@ upgradedn_producer(void *param)
                                                   slapi_ch_strdup(a->a_type),
                                                   slapi_ch_strdup(*ud_valp),
                                                   isentrydn?0:OLD_DN_NORMALIZE);
-                            LDAPDebug(LDAP_DEBUG_TRACE,
+                            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                                     "%s: Found upgradedn candidate: %s (id %lu)\n", 
                                     inst->inst_name, valueptr, (u_long)temp_id);
                             if (!entryrdn_get_switch() && isentrydn) {
@@ -1940,7 +1940,7 @@ upgradedn_producer(void *param)
                                  */
                                 rc = slapi_entry_add_rdn_values(e);
                                 if (rc) {
-                                    LDAPDebug(LDAP_DEBUG_ANY,
+                                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                               "%s: Failed to add rdn values "
                                               "to an entry: %s (id %lu)\n",
                                               inst->inst_name, normdn, (u_long)temp_id);
@@ -1969,7 +1969,7 @@ upgradedn_producer(void *param)
                 charray_free(ud_vals);
                 ud_vals = NULL;
                 if (skipit) {
-                    LDAPDebug(LDAP_DEBUG_ANY, "%s: WARNING: skipping an entry "
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: WARNING: skipping an entry "
                                   "with a corrupted dn (syntax value): %s "
                                   "(id %lu)\n",
                                   inst->inst_name, 
@@ -3034,7 +3034,7 @@ import_worker(void *param)
 
 error:
     if (ret == DB_RUNRECOVERY) {
-        LDAPDebug(LDAP_DEBUG_ANY,"cannot import; database recovery needed\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"cannot import; database recovery needed\n",
                   0,0,0);
     } else if (ret == DB_LOCK_DEADLOCK) {
         /* can this occur? */
@@ -3082,7 +3082,7 @@ static int bulk_import_start(Slapi_PBlock *pb)
     PR_Lock(job->inst->inst_config_mutex);
     if (job->inst->inst_flags & INST_FLAG_BUSY) {
         PR_Unlock(job->inst->inst_config_mutex);
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm: '%s' is already in the middle of "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm: '%s' is already in the middle of "
                   "another task and cannot be disturbed.\n",
                   job->inst->inst_name, 0, 0);
         FREE(job);
@@ -3152,7 +3152,7 @@ static int bulk_import_start(Slapi_PBlock *pb)
                              SLAPD_DEFAULT_THREAD_STACKSIZE);
     if (thread == NULL) {
         PRErrorCode prerr = PR_GetError();
-        LDAPDebug(LDAP_DEBUG_ANY, "unable to spawn import thread, "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to spawn import thread, "
                                   SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                                   prerr, slapd_pr_strerror(prerr), 0);
         PR_Unlock(job->wire_lock);
@@ -3381,7 +3381,7 @@ void factory_destructor(void *extension, void *object, void *parent)
      * aborted!
      */
     thread = job->main_thread;
-    LDAPDebug(LDAP_DEBUG_ANY, "ERROR bulk import abandoned\n",
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR bulk import abandoned\n",
               0, 0, 0);
     import_abort_all(job, 1);
     /* wait for import_main to finish... */
@@ -3468,7 +3468,7 @@ int ldbm_back_wire_import(Slapi_PBlock *pb)
     }
 
     /* ??? unknown state */
-    LDAPDebug(LDAP_DEBUG_ANY,
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "ERROR: ldbm_back_wire_import: unknown state %d\n",
               state, 0, 0);
     return -1;
@@ -3508,14 +3508,14 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
     {
         filename = slapi_ch_smprintf("%s/%s", dest_dir, file_name);
     }
-    LDAPDebug(LDAP_DEBUG_TRACE, "dse_conf_backup(%s): backup file %s\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "dse_conf_backup(%s): backup file %s\n",
               filter, filename, 0);
 
     /* Open the file to write */
     if ((prfd = PR_Open(filename, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE,
                         SLAPD_DEFAULT_FILE_MODE)) == NULL)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "dse_conf_backup(%s): open %s failed: (%s)\n",
                 filter, filename, slapd_pr_strerror(PR_GetError()));
         rval = -1;
@@ -3524,7 +3524,7 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
 
     srch_pb = slapi_pblock_new();
     if (!srch_pb) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "dse_conf_backup(%s): out of memory\n",
                 filter, 0, 0);
         rval = -1;
@@ -3538,7 +3538,7 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
     for (ep = entries; ep != NULL && *ep != NULL; ep++)
     {
         size_t l = strlen(slapi_entry_get_dn_const(*ep)) + 5 /* "dn: \n" */;
-        LDAPDebug(LDAP_DEBUG_TRACE, "\ndn: %s\n", 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "\ndn: %s\n", 
                  slapi_entry_get_dn_const(*ep), 0, 0);
 
         if (l <= sizeof(tmpbuf))
@@ -3549,7 +3549,7 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
         prrval = PR_Write(prfd, tp, l);
         if ((size_t)prrval != l)
         {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "dse_conf_backup(%s): write %s failed: %d (%s)\n",
                 filter, PR_GetError(), slapd_pr_strerror(PR_GetError()));
             rval = -1;
@@ -3578,7 +3578,7 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
             {
                 attr_val = slapi_value_get_berval(sval);
                 l = strlen(attr_val->bv_val) + attr_name_len + 3; /* : \n" */
-                LDAPDebug(LDAP_DEBUG_TRACE, "%s: %s\n", attr_name,
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "%s: %s\n", attr_name,
                             attr_val->bv_val, 0);
                 if (l <= sizeof(tmpbuf))
                     tp = tmpbuf;
@@ -3588,7 +3588,7 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
                 prrval = PR_Write(prfd, tp, l);
                 if ((size_t)prrval != l)
                 {
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                         "dse_conf_backup(%s): write %s failed: %d (%s)\n",
                         filter, PR_GetError(), slapd_pr_strerror(PR_GetError()));
                     rval = -1;
@@ -3605,7 +3605,7 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char
             prrval = PR_Write(prfd, "\n", 1);
             if ((int)prrval != 1)
             {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "dse_conf_backup(%s): write %s failed: %d (%s)\n",
                     filter, PR_GetError(), slapd_pr_strerror(PR_GetError()));
                 rval = -1;
@@ -3631,7 +3631,7 @@ out:
         prrval = PR_Close(prfd);
         if (PR_SUCCESS != prrval)
         {
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "Fatal Error---Failed to back up dse indexes %d (%s)\n",
                 PR_GetError(), slapd_pr_strerror(PR_GetError()), 0);
             rval = -1;
@@ -3677,7 +3677,7 @@ dse_conf_verify_core(struct ldbminfo *li, char *src_dir, char *file_name, char *
 
     if (PR_SUCCESS != PR_Access(filename, PR_ACCESS_READ_OK))
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "Warning: config backup file %s not found in backup\n",
             file_name, 0, 0);
         rval = 0;
@@ -3687,7 +3687,7 @@ dse_conf_verify_core(struct ldbminfo *li, char *src_dir, char *file_name, char *
     fd = dblayer_open_huge_file(filename, O_RDONLY, 0);
     if (fd < 0)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "Warning: can't open config backup file: %s\n", filename, 0, 0);
         rval = -1;
         goto out;
@@ -3717,7 +3717,7 @@ dse_conf_verify_core(struct ldbminfo *li, char *src_dir, char *file_name, char *
         e = slapi_str2entry(estr, 0);
         slapi_ch_free_string(&estr);
         if (!e) {
-            LDAPDebug(LDAP_DEBUG_ANY, "WARNING: skipping bad LDIF entry "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: skipping bad LDIF entry "
                 "ending line %d of file \"%s\"", curr_lineno, filename, 0);
             continue;
         }
@@ -3753,7 +3753,7 @@ dse_conf_verify_core(struct ldbminfo *li, char *src_dir, char *file_name, char *
     if (0 != slapi_entries_diff(backup_entries, curr_entries, 1 /* test_all */,
                                 log_str, 1 /* force_update */, li->li_identity))
     {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING!!: current %s is "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING!!: current %s is "
                   "different from backed up configuration; "
                   "The backup is restored.\n", log_str, 0, 0);
     }
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
index 8ddbf70..0853bba 100644
--- a/ldap/servers/slapd/back-ldbm/import.c
+++ b/ldap/servers/slapd/back-ldbm/import.c
@@ -212,13 +212,13 @@ void import_log_notice(ImportJob *job, char *format, ...)
     }
     /* also save it in the logs for posterity */
     if (job->flags & (FLAG_UPGRADEDNFORMAT|FLAG_UPGRADEDNFORMAT_V1)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "upgradedn %s: %s\n", job->inst->inst_name,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "upgradedn %s: %s\n", job->inst->inst_name,
                   buffer, 0);
     } else if (job->flags & FLAG_REINDEXING) {
-        LDAPDebug(LDAP_DEBUG_ANY, "reindex %s: %s\n", job->inst->inst_name,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "reindex %s: %s\n", job->inst->inst_name,
                   buffer, 0);
     } else {
-        LDAPDebug(LDAP_DEBUG_ANY, "import %s: %s\n", job->inst->inst_name,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "import %s: %s\n", job->inst->inst_name,
                   buffer, 0);
     }
 }
@@ -482,7 +482,7 @@ static int import_start_threads(ImportJob *job)
                         PR_PRIORITY_NORMAL, PR_GLOBAL_BOUND_THREAD,
                         PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE)) {
         PRErrorCode prerr = PR_GetError();
-        LDAPDebug(LDAP_DEBUG_ANY, "unable to spawn import foreman thread, "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to spawn import foreman thread, "
                   SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                   prerr, slapd_pr_strerror(prerr), 0);
         FREE(foreman);
@@ -512,7 +512,7 @@ static int import_start_threads(ImportJob *job)
                 PR_UNJOINABLE_THREAD,
                 SLAPD_DEFAULT_THREAD_STACKSIZE)) {
             PRErrorCode prerr = PR_GetError();
-            LDAPDebug(LDAP_DEBUG_ANY, "unable to spawn import worker thread, "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to spawn import worker thread, "
                     SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                     prerr, slapd_pr_strerror(prerr), 0);
             FREE(worker);
@@ -1251,7 +1251,7 @@ int import_main_offline(void *arg)
                 producer, PR_PRIORITY_NORMAL, PR_GLOBAL_BOUND_THREAD,
                 PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE)) {
                 PRErrorCode prerr = PR_GetError();
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "unable to spawn upgrade dn producer thread, "
                           SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                           prerr, slapd_pr_strerror(prerr), 0);
@@ -1265,7 +1265,7 @@ int import_main_offline(void *arg)
                 PR_UNJOINABLE_THREAD,
                 SLAPD_DEFAULT_THREAD_STACKSIZE)) {
                 PRErrorCode prerr = PR_GetError();
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "unable to spawn index producer thread, "
                           SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                           prerr, slapd_pr_strerror(prerr), 0);
@@ -1280,7 +1280,7 @@ int import_main_offline(void *arg)
                             PR_UNJOINABLE_THREAD,
                             SLAPD_DEFAULT_THREAD_STACKSIZE)) {
                         PRErrorCode prerr = PR_GetError();
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                         "unable to spawn import producer thread, "
                         SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                         prerr, slapd_pr_strerror(prerr), 0);
@@ -1734,7 +1734,7 @@ int ldbm_back_ldif2ldbm_deluxe(Slapi_PBlock *pb)
                                  SLAPD_DEFAULT_THREAD_STACKSIZE);
         if (thread == NULL) {
             PRErrorCode prerr = PR_GetError();
-            LDAPDebug(LDAP_DEBUG_ANY, "unable to spawn import thread, "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to spawn import thread, "
                         SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                         prerr, slapd_pr_strerror(prerr), 0);
             import_free_job(job);
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index 81d6621..7b454c5 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -353,7 +353,7 @@ index_addordel_entry(
     int		rc, result;
     Slapi_Attr		*attr;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> index_%s_entry( \"%s\", %lu )\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> index_%s_entry( \"%s\", %lu )\n",
                (flags & BE_INDEX_ADD) ? "add" : "del",
                backentry_get_ndn(e), (u_long)e->ep_id );
 
@@ -472,7 +472,7 @@ index_addordel_entry(
         }
     }
     
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= index_%s_entry%s %d\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= index_%s_entry%s %d\n",
                (flags & BE_INDEX_ADD) ? "add" : "del", 
                (flags & BE_INDEX_TOMBSTONE) ? " (tombstone)" : "", result );
     return( result );
@@ -903,7 +903,7 @@ index_read_ext_allids(
 		LDAPDebug0Args( LDAP_DEBUG_ANY, "index_read_ext: NULL prefix\n" );
 		return NULL;
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> index_read( \"%s\" %s \"%s\" )\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> index_read( \"%s\" %s \"%s\" )\n",
 		   type, prefix, encode (val, buf));
 
 	basetype = typebuf;
@@ -919,7 +919,7 @@ index_read_ext_allids(
 		return NULL;
 	}
 
-	LDAPDebug( LDAP_DEBUG_ARGS, "   indextype: \"%s\" indexmask: 0x%x\n",
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   indextype: \"%s\" indexmask: 0x%x\n",
 	    indextype, ai->ai_indexmask, 0 );
 
 	/* If entryrdn switch is on AND the type is entrydn AND the prefix is '=', 
@@ -954,7 +954,7 @@ index_read_ext_allids(
 	if ( !is_indexed( indextype, ai->ai_indexmask, ai->ai_index_rules ) ) {
 		idl =  idl_allids( be );
                 if (unindexed != NULL) *unindexed = 1;
-		LDAPDebug( LDAP_DEBUG_TRACE, "<= index_read %lu candidates "
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= index_read %lu candidates "
 		    "(allids - not indexed)\n", (u_long)IDL_NIDS(idl), 0, 0 );
 		index_free_prefix( prefix );
 		slapi_ch_free_string( &basetmp );
@@ -973,7 +973,7 @@ index_read_ext_allids(
 		if (unindexed != NULL) *unindexed = 1;
 		LDAPDebug1Arg( LDAP_DEBUG_BACKLDBM, "<= index_read %lu candidates "
 		    "(do not use index)\n", (u_long)IDL_NIDS(idl) );
-		LDAPDebug( LDAP_DEBUG_BACKLDBM, "<= index_read index attr %s type %s "
+		LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "<= index_read index attr %s type %s "
 		    "for value %s does not use index\n", basetype, indextype,
 		    (val && val->bv_val) ? val->bv_val : "ALL" );
 		index_free_prefix( prefix );
@@ -981,7 +981,7 @@ index_read_ext_allids(
 		return( idl );
 	}
 	if ( (*err = dblayer_get_index_file( be, ai, &db, DBOPEN_CREATE )) != 0 ) {
-		LDAPDebug( LDAP_DEBUG_TRACE,
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		    "<= index_read NULL (index file open for attr %s)\n",
 		    basetype, 0, 0 );
 		index_free_prefix (prefix);
@@ -997,7 +997,7 @@ index_read_ext_allids(
 		/* If necessary, encrypt this index key */
 		ret = attrcrypt_encrypt_index_key(be, ai, val, &encrypted_val);
 		if (ret) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "index_read failed to encrypt index key for %s\n",
 		    basetype, 0, 0 );
 		}
@@ -1054,7 +1054,7 @@ index_read_ext_allids(
 		ber_bvfree(encrypted_val);
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= index_read %lu candidates\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= index_read %lu candidates\n",
                    (u_long)IDL_NIDS(idl), 0, 0 );
 	return( idl );
 }
@@ -1235,7 +1235,7 @@ index_range_read_ext(
     int coreop = operator & SLAPI_OP_RANGE;
 
     if (!pb) {
-        LDAPDebug(LDAP_DEBUG_ANY, "index_range_read: NULL pblock\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "index_range_read: NULL pblock\n",
                   0, 0, 0);
         return NULL;
     }
@@ -1286,7 +1286,7 @@ index_range_read_ext(
       case SLAPI_OP_GREATER:
         break;
       default:
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "<= index_range_read(%s,%s) NULL (operator %i)\n",
               type, prefix, coreop );
         index_free_prefix(prefix);
@@ -1297,18 +1297,18 @@ index_range_read_ext(
         index_free_prefix(prefix);
         return NULL;
     }
-    LDAPDebug( LDAP_DEBUG_ARGS, "   indextype: \"%s\" indexmask: 0x%x\n",
+    LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   indextype: \"%s\" indexmask: 0x%x\n",
         indextype, ai->ai_indexmask, 0 );
     if ( !is_indexed( indextype, ai->ai_indexmask, ai->ai_index_rules )) {
         idl = idl_allids( be );
-        LDAPDebug( LDAP_DEBUG_TRACE,
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
             "<= index_range_read(%s,%s) %lu candidates (allids)\n",
             type, prefix, (u_long)IDL_NIDS(idl) );
         index_free_prefix(prefix);
         return( idl );
     }
     if ( (*err = dblayer_get_index_file( be, ai, &db, DBOPEN_CREATE )) != 0 ) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "<= index_range_read(%s,%s) NULL (could not open index file)\n",
             type, prefix, 0 );
         index_free_prefix(prefix);
@@ -1321,7 +1321,7 @@ index_range_read_ext(
     *err = db->cursor(db,db_txn,&dbc,0);
     if (0 != *err ) {
         ldbm_nasty(errmsg, 1060, *err);
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "<= index_range_read(%s,%s) NULL: db->cursor() == %i\n",
             type, prefix, *err );
         dblayer_release_index_file( be, ai, db );
@@ -1379,7 +1379,7 @@ index_range_read_ext(
                     goto error;
                 } else {
                     ldbm_nasty(errmsg, 1070, *err);
-                    LDAPDebug( LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                         "index_range_read(%s,%s) seek to end of index file err %i\n",
                         type, prefix, *err );
                 }
@@ -1411,9 +1411,9 @@ index_range_read_ext(
     }
     /* if (LDAP_DEBUG_FILTER)  {
         char encbuf [BUFSIZ];
-        LDAPDebug( LDAP_DEBUG_FILTER, "   lowerkey=%s(%li bytes)\n",
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "   lowerkey=%s(%li bytes)\n",
               encoded (&lowerkey, encbuf), (long)lowerkey.dsize, 0 );
-        LDAPDebug( LDAP_DEBUG_FILTER, "   upperkey=%s(%li bytes)\n",
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "   upperkey=%s(%li bytes)\n",
               encoded (&upperkey, encbuf), (long)upperkey.dsize, 0 );
     } */
     data.flags = DB_DBT_MALLOC;
@@ -1437,7 +1437,7 @@ index_range_read_ext(
         } else { 
             idl = idl_allids( be ); 
             ldbm_nasty(errmsg, 1080, *err);
-            LDAPDebug( LDAP_DEBUG_ANY, 
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                 "<= index_range_read(%s,%s) allids (seek to lower key in index file err %i)\n", 
                 type, prefix, *err ); 
         } 
@@ -1456,7 +1456,7 @@ index_range_read_ext(
     if (coreop == SLAPI_OP_GREATER) {
         *err = index_range_next_key(db, &cur_key, db_txn);
         if (*err) {
-            LDAPDebug(LDAP_DEBUG_ANY, "<= index_range_read(%s,%s) op==GREATER, no next key: %i)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "<= index_range_read(%s,%s) op==GREATER, no next key: %i)\n",
                 type, prefix, *err );
             goto error;
         }
@@ -1481,7 +1481,7 @@ index_range_read_ext(
             IDList *tmp;
             /*
             char encbuf [BUFSIZ];
-            LDAPDebug( LDAP_DEBUG_FILTER, "   cur_key=%s(%li bytes)\n",
+            LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "   cur_key=%s(%li bytes)\n",
                    encoded (&cur_key, encbuf), (long)cur_key.dsize, 0 );
             */
             /* lookthrough limit and size limit check */
@@ -1624,7 +1624,7 @@ error:
     DBT_FREE_PAYLOAD(upperkey);
 
     dblayer_release_index_file( be, ai, db );
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= index_range_read(%s,%s) %lu candidates\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= index_range_read(%s,%s) %lu candidates\n",
                    type, prefix, (u_long)IDL_NIDS(idl) );
     return( idl );
 }
@@ -1673,13 +1673,13 @@ addordel_values(
 	char	*realbuf;
 	char	*prefix;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> %s_values\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> %s_values\n",
 		   (flags & BE_INDEX_ADD) ? "add" : "del", 0, 0);
 
 	prefix = index_index2prefix( indextype );
 
 	if (prefix == NULL) {
-		LDAPDebug( LDAP_DEBUG_ANY, "<= %s_values: NULL prefix\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "<= %s_values: NULL prefix\n",
 			(flags & BE_INDEX_ADD) ? "add" : "del", 0, 0 );
 		return( -1 );
 	}
@@ -1709,7 +1709,7 @@ addordel_values(
 		index_free_prefix (prefix);
 		if (NULL != key.dptr && prefix != key.dptr)
 			slapi_ch_free( (void**)&key.dptr );
-		LDAPDebug( LDAP_DEBUG_TRACE, "<= %s_values %d\n",
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= %s_values %d\n",
 			   (flags & BE_INDEX_ADD) ? "add" : "del", rc, 0 );
 		return( rc );
 	}
@@ -1743,7 +1743,7 @@ addordel_values(
 		{
 			char encbuf[BUFSIZ];
 
-			LDAPDebug (LDAP_DEBUG_TRACE, "   %s_value(\"%s\")\n",
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "   %s_value(\"%s\")\n",
 				   (flags & BE_INDEX_ADD) ? "add" : "del",
 				   encoded (&key, encbuf), 0);
 		}
@@ -1787,7 +1787,7 @@ addordel_values(
 	{
             ldbm_nasty(errmsg, 1110, rc);
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= %s_values %d\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= %s_values %d\n",
 	    (flags & BE_INDEX_ADD) ? "add" : "del", rc, 0 );
 	return( rc );
 }
@@ -1820,7 +1820,7 @@ addordel_values_sv(
     const struct berval *bvp;
     struct berval *encrypted_bvp = NULL;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> %s_values\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> %s_values\n",
                (flags & BE_INDEX_ADD) ? "add" : "del", 0, 0);
 
     prefix = index_index2prefix( indextype );
@@ -1856,7 +1856,7 @@ addordel_values_sv(
             slapi_ch_free( (void**)&key.dptr );
         }
         index_free_prefix (prefix);
-        LDAPDebug( LDAP_DEBUG_TRACE, "<= %s_values %d\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= %s_values %d\n",
                    (flags & BE_INDEX_ADD) ? "add" : "del", rc, 0 );
         return( rc );
     }
@@ -1872,7 +1872,7 @@ addordel_values_sv(
 				rc = attrcrypt_encrypt_index_key(be,a,bvp,&encrypted_bvp);
 				if (rc) 
 				{
-					LDAPDebug (LDAP_DEBUG_ANY, "Failed to encrypt index key for %s\n", a->ai_type ,0,0);
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to encrypt index key for %s\n", a->ai_type ,0,0);
 				} else {
 					bvp = encrypted_bvp;
 				}
@@ -1912,7 +1912,7 @@ addordel_values_sv(
         {
             char encbuf[BUFSIZ];
 
-            LDAPDebug (LDAP_DEBUG_TRACE, "   %s_value(\"%s\")\n",
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "   %s_value(\"%s\")\n",
                        (flags & BE_INDEX_ADD) ? "add" : "del",
                        encoded (&key, encbuf), 0);
         }
@@ -1956,7 +1956,7 @@ addordel_values_sv(
     {
         ldbm_nasty(errmsg, 1140, rc);
     }
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= %s_values %d\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= %s_values %d\n",
                (flags & BE_INDEX_ADD) ? "add" : "del", rc, 0 );
     return( rc );
 }
@@ -2012,7 +2012,7 @@ index_addordel_values_ext_sv(
     char	buf[SLAPD_TYPICAL_ATTRIBUTE_NAME_MAX_LENGTH];
     char	*basetmp, *basetype;
     
-    LDAPDebug( LDAP_DEBUG_TRACE,
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                "=> index_addordel_values_ext_sv( \"%s\", %lu )\n", type, (u_long)id, 0 );
 
     basetype = buf;
@@ -2027,10 +2027,10 @@ index_addordel_values_ext_sv(
 		slapi_ch_free_string( &basetmp );
         return( 0 );
     }
-    LDAPDebug( LDAP_DEBUG_ARGS, "   index_addordel_values_ext_sv indexmask 0x%x\n",
+    LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   index_addordel_values_ext_sv indexmask 0x%x\n",
                ai->ai_indexmask, 0, 0 );
     if ( (err = dblayer_get_index_file( be, ai, &db, DBOPEN_CREATE )) != 0 ) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "<= index_read NULL (could not open index attr %s)\n",
                    basetype, 0, 0 );
 		slapi_ch_free_string( &basetmp );
@@ -2183,7 +2183,7 @@ index_addordel_values_ext_sv(
         slapi_ch_free( (void**)&basetmp );
     }
 
-    LDAPDebug (LDAP_DEBUG_TRACE, "<= index_addordel_values_ext_sv\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= index_addordel_values_ext_sv\n", 0, 0, 0 );
     return( 0 );
 
  bad:
diff --git a/ldap/servers/slapd/back-ldbm/init.c b/ldap/servers/slapd/back-ldbm/init.c
index 04cc936..c2f462a 100644
--- a/ldap/servers/slapd/back-ldbm/init.c
+++ b/ldap/servers/slapd/back-ldbm/init.c
@@ -54,7 +54,7 @@ ldbm_back_init( Slapi_PBlock *pb )
 	struct slapdplugin *p;
 	static int interface_published = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> ldbm_back_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldbm_back_init\n", 0, 0, 0 );
 
    	slapi_pblock_get(pb, SLAPI_PLUGIN, &p);
 	
@@ -76,7 +76,7 @@ ldbm_back_init( Slapi_PBlock *pb )
 	
 	/* initialize dblayer  */
 	if (dblayer_init(li)) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: dblayer_init failed\n",0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_back_init: dblayer_init failed\n",0, 0, 0 );
 		goto fail;
 	}
 
@@ -90,7 +90,7 @@ ldbm_back_init( Slapi_PBlock *pb )
         if (slapi_register_object_extension(p->plg_name, SLAPI_EXT_CONNECTION,
             factory_constructor, factory_destructor,
             &li->li_bulk_import_object, &li->li_bulk_import_handle) != 0) {
-            LDAPDebug(LDAP_DEBUG_ANY, "ldbm_back_init: "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_back_init: "
                       "slapi_register_object_extension failed.\n", 0, 0, 0);
             goto fail;
         }
@@ -102,25 +102,25 @@ ldbm_back_init( Slapi_PBlock *pb )
 	rc = slapi_pblock_set( pb, SLAPI_PLUGIN_PRIVATE, (void *) li );
 	
 	if ((li->li_dbcache_mutex = PR_NewLock()) == NULL ) {
-            LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: PR_NewLock failed\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_back_init: PR_NewLock failed\n",
 		0, 0, 0 );
             goto fail;
         }
 
 	if ((li->li_shutdown_mutex = PR_NewLock()) == NULL ) {
-            LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: PR_NewLock failed\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_back_init: PR_NewLock failed\n",
 		0, 0, 0 );
             goto fail;
         }
 
 	if ((li->li_config_mutex = PR_NewLock()) == NULL ) {
-            LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: PR_NewLock failed\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_back_init: PR_NewLock failed\n",
 		0, 0, 0 );
             goto fail;
         }
 
 	if ((li->li_dbcache_cv = PR_NewCondVar( li->li_dbcache_mutex )) == NULL ) {
-            LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: PR_NewCondVar failed\n", 0, 0, 0 );
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_back_init: PR_NewCondVar failed\n", 0, 0, 0 );
             goto fail;
         }
 
@@ -208,7 +208,7 @@ ldbm_back_init( Slapi_PBlock *pb )
 	    (void *) ldbm_back_ctrl_info );
 
 	if ( rc != 0 ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init failed\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_back_init failed\n", 0, 0, 0 );
 		goto fail;
 	}
 	
@@ -221,14 +221,14 @@ ldbm_back_init( Slapi_PBlock *pb )
 
 		if( slapi_apib_register(IDL_v1_0_GUID, IDL_api) )
 		{
-			LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: failed to publish IDL interface\n", 0, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_back_init: failed to publish IDL interface\n", 0, 0, 0);
 			goto fail;
 		}
 
 		interface_published = 1;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= ldbm_back_init\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldbm_back_init\n", 0, 0, 0 );
 
 	return( 0 );
 
diff --git a/ldap/servers/slapd/back-ldbm/instance.c b/ldap/servers/slapd/back-ldbm/instance.c
index f059e8a..1f99c3e 100644
--- a/ldap/servers/slapd/back-ldbm/instance.c
+++ b/ldap/servers/slapd/back-ldbm/instance.c
@@ -37,7 +37,7 @@ int ldbm_instance_create(backend *be, char *name)
     /* initialize the entry cache */
     if (! cache_init(&(inst->inst_cache), DEFAULT_CACHE_SIZE,
                      DEFAULT_CACHE_ENTRIES, CACHE_TYPE_ENTRY)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm_instance_create: cache_init failed\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_instance_create: cache_init failed\n",
                   0, 0, 0);
         rc = -1;
         goto error;
@@ -59,7 +59,7 @@ int ldbm_instance_create(backend *be, char *name)
     /* Lock for the list of open db handles */
     inst->inst_handle_list_mutex = PR_NewLock();
     if (NULL == inst->inst_handle_list_mutex) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm_instance_create: PR_NewLock failed\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_instance_create: PR_NewLock failed\n",
                   0, 0, 0);
         rc = -1;
         goto error;
@@ -68,28 +68,28 @@ int ldbm_instance_create(backend *be, char *name)
     /* Lock used to synchronize modify operations. */
     inst->inst_db_mutex = PR_NewMonitor();
     if (NULL == inst->inst_db_mutex) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm_instance_create: PR_NewMonitor failed\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_instance_create: PR_NewMonitor failed\n",
                   0, 0, 0);
         rc = -1;
         goto error;
     }
 
     if ((inst->inst_config_mutex = PR_NewLock()) == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm_instance_create: PR_NewLock failed\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_instance_create: PR_NewLock failed\n",
                   0, 0, 0);
         rc = -1;
         goto error;
     }
 
     if ((inst->inst_nextid_mutex = PR_NewLock()) == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm_instance_create: PR_NewLock failed\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_instance_create: PR_NewLock failed\n",
                   0, 0, 0);
         rc = -1;
         goto error;
     }
 
     if ((inst->inst_indexer_cv = PR_NewCondVar(inst->inst_nextid_mutex)) == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm_instance_create: PR_NewCondVar failed\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_instance_create: PR_NewCondVar failed\n", 0, 0, 0 );
         rc = -1;
         goto error;
     }
@@ -254,7 +254,7 @@ ldbm_instance_start(backend *be)
 
     if (be->be_state != BE_STATE_STOPPED &&
         be->be_state != BE_STATE_DELETED) {
-        LDAPDebug( LDAP_DEBUG_TRACE, 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
                    "ldbm_instance_start: warning - backend is in a wrong state - %d\n", 
                    be->be_state, 0, 0 );
         PR_Unlock (be->be_state_lock);
@@ -280,7 +280,7 @@ ldbm_instance_stop(backend *be)
     PR_Lock (be->be_state_lock);
 
     if (be->be_state != BE_STATE_STARTED) {
-        LDAPDebug( LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                    "ldbm_back_close: warning - backend %s is in the wrong state - %d\n", 
                    inst ? inst->inst_name : "", be->be_state, 0 );
         PR_Unlock (be->be_state_lock);
@@ -392,7 +392,7 @@ ldbm_instance_destructor(void **arg)
 {
     ldbm_instance *inst = (ldbm_instance *) *arg;
 
-    LDAPDebug(LDAP_DEBUG_ANY, "Destructor for instance %s called\n", 
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Destructor for instance %s called\n", 
               inst->inst_name, 0, 0);
 
     slapi_counter_destroy(&(inst->inst_ref_count));
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c
index f462376..ba15f5a 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_add.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c
@@ -393,7 +393,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 						slapi_sdn_set_dn_byval(&parentsdn, slapi_entry_get_dn_const(parententry->ep_entry));
 					}
 				} else {
-					LDAPDebug(LDAP_DEBUG_BACKLDBM, "find_entry2modify_only returned NULL parententry pdn: %s, uniqueid: %s\n",
+					LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "find_entry2modify_only returned NULL parententry pdn: %s, uniqueid: %s\n",
 					          slapi_sdn_get_dn(&parentsdn), slapi_sdn_get_dn(&parentsdn), addr.uniqueid?addr.uniqueid:"none");
 				}
 				modify_init(&parent_modify_c,parententry);
@@ -477,7 +477,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 				if ((operation_is_flag_set(operation,OP_FLAG_ACTION_SCHEMA_CHECK))
 				     && (slapi_entry_schema_check(pb, e) != 0))
 				{
-					LDAPDebug(LDAP_DEBUG_TRACE, "entry failed schema check\n", 0, 0, 0);
+					LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "entry failed schema check\n", 0, 0, 0);
 					ldap_result_code = LDAP_OBJECT_CLASS_VIOLATION;
 					slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &ldap_result_message);
 					goto error_return;
@@ -486,7 +486,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 				/* Check attribute syntax */
 				if (slapi_entry_syntax_check(pb, e, 0) != 0)
 				{
-					LDAPDebug(LDAP_DEBUG_TRACE, "entry failed syntax check\n", 0, 0, 0);
+					LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "entry failed syntax check\n", 0, 0, 0);
 					ldap_result_code = LDAP_INVALID_SYNTAX;
 					slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &ldap_result_message);
 					goto error_return;
@@ -541,7 +541,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 				slapi_entry_attr_delete(addingentry->ep_entry, SLAPI_ATTR_TOMBSTONE_CSN);
 				/* Now also remove the nscpEntryDN */
 				if (slapi_entry_attr_delete(addingentry->ep_entry, SLAPI_ATTR_NSCP_ENTRYDN) != 0){
-					LDAPDebug(LDAP_DEBUG_REPL, "Resurrection of %s - Couldn't remove %s\n", dn, SLAPI_ATTR_NSCP_ENTRYDN, 0);
+					LDAPDebug(LDAP_DEBUG_REPL, LOG_DEBUG, "Resurrection of %s - Couldn't remove %s\n", dn, SLAPI_ATTR_NSCP_ENTRYDN, 0);
 				}
 				
 				/* And copy the reason from e */
@@ -549,7 +549,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 				if (reason) {
 					if (!slapi_entry_attr_hasvalue(addingentry->ep_entry, "nsds5ReplConflict", reason)) {
 						slapi_entry_add_string(addingentry->ep_entry, "nsds5ReplConflict", reason);
-						LDAPDebug(LDAP_DEBUG_REPL, "Resurrection of %s - Added Conflict reason %s\n", dn, reason, 0);
+						LDAPDebug(LDAP_DEBUG_REPL, LOG_DEBUG, "Resurrection of %s - Added Conflict reason %s\n", dn, reason, 0);
 					}
 					slapi_ch_free((void **)&reason);
 				}
@@ -602,7 +602,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 				 */
 				addingentry = backentry_init( e );
 				if ( ( addingentry->ep_id = next_id( be ) ) >= MAXID ) {
-				  LDAPDebug( LDAP_DEBUG_ANY,
+				  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 						 "add: maximum ID reached, cannot add entry to "
 						 "backend '%s'", be->be_name, 0, 0 );
 				  ldap_result_code = LDAP_OPERATIONS_ERROR;
@@ -865,12 +865,12 @@ ldbm_back_add( Slapi_PBlock *pb )
 		retval = id2entry_add_ext(be, addingentry, &txn, 1, &myrc);
 		if (DB_LOCK_DEADLOCK == retval)
 		{
-			LDAPDebug( LDAP_DEBUG_ARGS, "add 1 DEADLOCK\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "add 1 DEADLOCK\n", 0, 0, 0 );
 			/* Retry txn */
 			continue;
 		}
 		if (retval) {
-			LDAPDebug(LDAP_DEBUG_TRACE, "id2entry_add(%s) failed, err=%d %s\n",
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "id2entry_add(%s) failed, err=%d %s\n",
 			          slapi_entry_get_dn_const(addingentry->ep_entry),
 			          retval, (msg = dblayer_strerror( retval )) ? msg : "");
 			ADD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
@@ -887,12 +887,12 @@ ldbm_back_add( Slapi_PBlock *pb )
 			retval = index_addordel_string(be,SLAPI_ATTR_OBJECTCLASS, SLAPI_ATTR_VALUE_TOMBSTONE,
 			                 addingentry->ep_id, BE_INDEX_DEL|BE_INDEX_EQUALITY, &txn);
 			if (DB_LOCK_DEADLOCK == retval) {
-				LDAPDebug( LDAP_DEBUG_ARGS, "add 2 DB_LOCK_DEADLOCK\n", 0, 0, 0 );
+				LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "add 2 DB_LOCK_DEADLOCK\n", 0, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
 			if (retval) {
-				LDAPDebug(LDAP_DEBUG_TRACE, "index_addordel_string TOMBSTONE (%s), err=%d %s\n",
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "index_addordel_string TOMBSTONE (%s), err=%d %s\n",
 				          slapi_entry_get_dn_const(addingentry->ep_entry),
 				          retval, (msg = dblayer_strerror( retval )) ? msg : "");
 				ADD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
@@ -909,12 +909,12 @@ ldbm_back_add( Slapi_PBlock *pb )
 				retval = index_addordel_string(be, SLAPI_ATTR_TOMBSTONE_CSN, deletion_csn_str,
 								 tombstoneentry->ep_id, BE_INDEX_DEL|BE_INDEX_EQUALITY, &txn);
 				if (DB_LOCK_DEADLOCK == retval) {
-					LDAPDebug( LDAP_DEBUG_ARGS, "add 3 DB_LOCK_DEADLOCK\n", 0, 0, 0 );
+					LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "add 3 DB_LOCK_DEADLOCK\n", 0, 0, 0 );
 					/* Retry txn */
 					continue;
 				}
 				if (0 != retval) {
-					LDAPDebug(LDAP_DEBUG_TRACE, "index_addordel_string TOMBSTONE csn(%s), err=%d %s\n",
+					LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "index_addordel_string TOMBSTONE csn(%s), err=%d %s\n",
 							  slapi_entry_get_dn_const(tombstoneentry->ep_entry),
 							  retval, (msg = dblayer_strerror( retval )) ? msg : "");
 					ADD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
@@ -928,12 +928,12 @@ ldbm_back_add( Slapi_PBlock *pb )
 
 			retval = index_addordel_string(be,SLAPI_ATTR_UNIQUEID,slapi_entry_get_uniqueid(addingentry->ep_entry),addingentry->ep_id,BE_INDEX_DEL|BE_INDEX_EQUALITY,&txn);
 			if (DB_LOCK_DEADLOCK == retval) {
-				LDAPDebug( LDAP_DEBUG_ARGS, "add 4 DB_LOCK_DEADLOCK\n", 0, 0, 0 );
+				LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "add 4 DB_LOCK_DEADLOCK\n", 0, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
 			if (0 != retval) {
-				LDAPDebug(LDAP_DEBUG_TRACE, "index_addordel_string UNIQUEID (%s), err=%d %s\n",
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "index_addordel_string UNIQUEID (%s), err=%d %s\n",
 				          slapi_entry_get_dn_const(addingentry->ep_entry),
 				          retval, (msg = dblayer_strerror( retval )) ? msg : "");
 				ADD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
@@ -949,12 +949,12 @@ ldbm_back_add( Slapi_PBlock *pb )
 			                               addingentry->ep_id,
 			                               BE_INDEX_DEL|BE_INDEX_EQUALITY, &txn);
 			if (DB_LOCK_DEADLOCK == retval) {
-				LDAPDebug( LDAP_DEBUG_ARGS, "add 5 DB_LOCK_DEADLOCK\n", 0, 0, 0 );
+				LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "add 5 DB_LOCK_DEADLOCK\n", 0, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
 			if (0 != retval) {
-				LDAPDebug(LDAP_DEBUG_TRACE, "index_addordel_string ENTRYDN (%s), err=%d %s\n",
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "index_addordel_string ENTRYDN (%s), err=%d %s\n",
 				          slapi_entry_get_dn_const(addingentry->ep_entry),
 				          retval, (msg = dblayer_strerror( retval )) ? msg : "");
 				ADD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
@@ -969,7 +969,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 				if (tombstoneentry) {
 					retval = entryrdn_index_entry(be, tombstoneentry, BE_INDEX_DEL, &txn);
 					if (retval) {
-						LDAPDebug(LDAP_DEBUG_ANY, "Resurrecting %s: failed to remove entryrdn index, err=%d %s\n",
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Resurrecting %s: failed to remove entryrdn index, err=%d %s\n",
 						          slapi_entry_get_dn_const(tombstoneentry->ep_entry),
 						          retval, (msg = dblayer_strerror( retval )) ? msg : "");
 						goto error_return; 
@@ -987,7 +987,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 		}
 		if (DB_LOCK_DEADLOCK == retval)
 		{
-			LDAPDebug( LDAP_DEBUG_ARGS, "add 5 DEADLOCK\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "add 5 DEADLOCK\n", 0, 0, 0 );
 			/* retry txn */
 			continue;
 		}
@@ -1009,12 +1009,12 @@ ldbm_back_add( Slapi_PBlock *pb )
 				                conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, retval);
 			if (DB_LOCK_DEADLOCK == retval)
 			{
-				LDAPDebug( LDAP_DEBUG_ARGS, "add 6 DEADLOCK\n", 0, 0, 0 );
+				LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "add 6 DEADLOCK\n", 0, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
 			if (retval) {
-				LDAPDebug(LDAP_DEBUG_BACKLDBM, "modify_update_all: %s (%lu) failed; rc=%d\n",
+				LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "modify_update_all: %s (%lu) failed; rc=%d\n",
 				          slapi_entry_get_dn(addingentry->ep_entry), (u_long)addingentry->ep_id, retval);
 				ADD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
 				if (LDBM_OS_ERR_IS_DISKFULL(retval)) {
@@ -1031,7 +1031,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 		{
 			retval= vlv_update_all_indexes(&txn, be, pb, NULL, addingentry);
 			if (DB_LOCK_DEADLOCK == retval) {
-				LDAPDebug(LDAP_DEBUG_ARGS,
+				LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG,
 				          "add DEADLOCK vlv_update_index\n", 0, 0, 0 );
 				/* Retry txn */
 				continue;
@@ -1052,7 +1052,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 		if (!is_ruv && !is_fixup_operation && !NO_RUV_UPDATE(li)) {
 			ruv_c_init = ldbm_txn_ruv_modify_context( pb, &ruv_c );
 			if (-1 == ruv_c_init) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"ldbm_back_add: ldbm_txn_ruv_modify_context "
 					"failed to construct RUV modify context\n",
 					0, 0, 0);
@@ -1069,7 +1069,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 				continue;
 			}
 			if (0 != retval) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"modify_update_all failed, err=%d %s\n", retval,
 					(msg = dblayer_strerror( retval )) ? msg : "", 0 );
 				if (LDBM_OS_ERR_IS_DISKFULL(retval))
@@ -1085,7 +1085,7 @@ ldbm_back_add( Slapi_PBlock *pb )
 	}
 	if (retry_count == RETRY_TIMES) {
 		/* Failed */
-		LDAPDebug( LDAP_DEBUG_ANY, "Retry count exceeded in add\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Retry count exceeded in add\n", 0, 0, 0 );
 		ldap_result_code= LDAP_BUSY;
 		goto error_return;
 	}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index 7e44cfe..57898c6 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -664,7 +664,7 @@ attr_index_config(
 		 slapi_attr_first_value(attr, &sval);
 		 attrValue = slapi_value_get_berval(sval);
 	} else {
-		LDAPDebug(LDAP_DEBUG_ANY, "attr_index_config: Missing indexing arguments\n", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "attr_index_config: Missing indexing arguments\n", 0, 0, 0);
 		return -1;
 	}
 
@@ -701,7 +701,7 @@ attr_index_config(
 				a->ai_indexmask |= INDEX_SUB;
 			} else if ( strcasecmp( attrValue->bv_val, "none" ) == 0 ) {
 				if ( a->ai_indexmask != 0 ) {
-					LDAPDebug(LDAP_DEBUG_ANY,
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 						"%s: line %d: index type \"none\" cannot be combined with other types\n",
 						fname, lineno, 0);
 				}
@@ -717,7 +717,7 @@ attr_index_config(
 		}
 		if(hasIndexType == 0){
 			/* indexType missing, error out */
-			LDAPDebug(LDAP_DEBUG_ANY, "attr_index_config: Missing index type\n", 0, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "attr_index_config: Missing index type\n", 0, 0, 0);
 			attrinfo_delete(&a);
 			return -1;
 		}
@@ -841,12 +841,12 @@ attr_index_config(
 					official_rules[k++] = slapi_ch_strdup (officialOID);
 				} else {
 					char* preamble = slapi_ch_smprintf("%s: line %d", fname, lineno);
-					LDAPDebug (LDAP_DEBUG_ANY, "%s: use \"%s\" instead of \"%s\" (ignored)\n",
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: use \"%s\" instead of \"%s\" (ignored)\n",
 								  preamble, officialOID, attrValue->bv_val);
 					slapi_ch_free((void**)&preamble);
 				}
 			} else { /* we don't know what this is */
-				LDAPDebug (LDAP_DEBUG_ANY, "%s: line %d: "
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: line %d: "
 						   "unknown or invalid matching rule \"%s\" in index configuration (ignored)\n",
 						   fname, lineno, attrValue->bv_val);
 			}
@@ -876,7 +876,7 @@ attr_index_config(
 	}
 
 	if ((return_value = attr_index_idlistsize_config(e, a, myreturntext))) {
-		LDAPDebug(LDAP_DEBUG_ANY,"attr_index_config: %s: Failed to parse idscanlimit info: %d:%s\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"attr_index_config: %s: Failed to parse idscanlimit info: %d:%s\n",
 		          fname, return_value, myreturntext);
 	}
 
@@ -884,7 +884,7 @@ attr_index_config(
 	return_value = idl_init_private(be, a);
 	if (0 != return_value) {
 		/* fatal error, exit */
-		LDAPDebug(LDAP_DEBUG_ANY,"%s: line %d:Fatal Error: Failed to initialize attribute structure\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"%s: line %d:Fatal Error: Failed to initialize attribute structure\n",
 				fname, lineno, 0);
 		exit( 1 );
 	}
@@ -898,7 +898,7 @@ attr_index_config(
 	if (need_compare_fn) {
 		int rc = attr_get_value_cmp_fn( &a->ai_sattr, &a->ai_key_cmp_fn );
 		if (rc != LDAP_SUCCESS) {
-			LDAPDebug(LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 						  "The attribute [%s] does not have a valid ORDERING matching rule - error %d:s\n",
 						  a->ai_type, rc, ldap_err2string(rc));
 			a->ai_key_cmp_fn = NULL;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
index a6bdc5c..fa94d1d 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
@@ -153,12 +153,12 @@ attrcrypt_keymgmt_get_key(ldbm_instance *li, attrcrypt_cipher_state *acs, SECKEY
 	char *instance_name =  li->inst_name;
 	char *dn_string = NULL;
 	
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_keymgmt_get_key\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_keymgmt_get_key\n", 0, 0, 0);
 	dn_string = slapi_create_dn_string(dn_template,
 								acs->ace->cipher_display_name, instance_name,
 								li->inst_li->li_plugin->plg_name);
 	if (NULL == dn_string) {
-		LDAPDebug(LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				  "attrcrypt_keymgmt_get_key: "
 				  "failed create attrcrypt key dn for plugin %s, "
 				  "instance %s, cypher %s\n", 
@@ -171,7 +171,7 @@ attrcrypt_keymgmt_get_key(ldbm_instance *li, attrcrypt_cipher_state *acs, SECKEY
 	                                  (const char *)dn_string);
 bail:
 	slapi_ch_free_string(&dn_string);
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_keymgmt_get_key\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_keymgmt_get_key\n", 0, 0, 0);
 	return ret;
 }
 
@@ -181,7 +181,7 @@ attrcrypt_keymgmt_store_key(ldbm_instance *li, attrcrypt_cipher_state *acs, SECK
 {
 	int ret = 0;
 	SECItem wrapped_symmetric_key = {0};
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_keymgmt_store_key\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_keymgmt_store_key\n", 0, 0, 0);
 	/* Wrap the key and then store it in the right place in dse.ldif */
 	ret = attrcrypt_wrap_key(acs, key_to_store, public_key, &wrapped_symmetric_key);
 	if (!ret) {
@@ -214,13 +214,13 @@ attrcrypt_keymgmt_store_key(ldbm_instance *li, attrcrypt_cipher_state *acs, SECK
 		if (rc != LDAP_SUCCESS) {
 			char *resulttext = NULL;
 			slapi_pblock_get(pb, SLAPI_PB_RESULT_TEXT, &resulttext);
-			LDAPDebug(LDAP_DEBUG_ANY, "attrcrypt_keymgmt_store_key: failed to add config key entries to the DSE: %d: %s: %s\n", rc, ldap_err2string(rc), resulttext ? resulttext : "unknown");
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "attrcrypt_keymgmt_store_key: failed to add config key entries to the DSE: %d: %s: %s\n", rc, ldap_err2string(rc), resulttext ? resulttext : "unknown");
 			ret = -1;
 		}
 		slapi_ch_free((void**)&entry_string);
 		slapi_pblock_destroy(pb);
 	}
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_keymgmt_store_key\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_keymgmt_store_key\n", 0, 0, 0);
 	return ret;
 }
 
@@ -238,13 +238,13 @@ attrcrypt_wrap_key(attrcrypt_cipher_state *acs, PK11SymKey *symmetric_key, SECKE
 	SECKEYPublicKey *wrapping_key = public_key;
 	wrapped_symmetric_key->len = slapd_SECKEY_PublicKeyStrength(public_key);
 	wrapped_symmetric_key->data = (unsigned char *)slapi_ch_malloc(wrapped_symmetric_key->len);
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_wrap_key\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_wrap_key\n", 0, 0, 0);
 	s = slapd_pk11_PubWrapSymKey(wrap_mechanism, wrapping_key, symmetric_key, wrapped_symmetric_key);
 	if (SECSuccess != s) {
 		ret = -1;
-		LDAPDebug(LDAP_DEBUG_ANY,"attrcrypt_wrap_key: failed to wrap key for cipher %s\n", acs->ace->cipher_display_name, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"attrcrypt_wrap_key: failed to wrap key for cipher %s\n", acs->ace->cipher_display_name, 0, 0);
 	}
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_wrap_key\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_wrap_key\n", 0, 0, 0);
 	return ret;
 }
 
@@ -337,7 +337,7 @@ attrcrypt_fetch_public_key(SECKEYPublicKey **public_key)
 	PRErrorCode errorCode = 0;
 	char *default_cert_name = "server-cert";
 	char *cert_name = NULL;
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_fetch_public_key\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_fetch_public_key\n", 0, 0, 0);
 	*public_key = NULL;
 	/* Try to grok the server cert name from the SSL config */
 	ret = attrcrypt_get_ssl_cert_name(&cert_name);
@@ -348,14 +348,14 @@ attrcrypt_fetch_public_key(SECKEYPublicKey **public_key)
 	cert = slapd_pk11_findCertFromNickname(cert_name, NULL);
 	if (cert == NULL) {
 		errorCode = PR_GetError();
-                LDAPDebug(LDAP_DEBUG_ANY,"Can't find certificate %s in attrcrypt_fetch_public_key: %d - %s\n", cert_name, errorCode, slapd_pr_strerror(errorCode));
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Can't find certificate %s in attrcrypt_fetch_public_key: %d - %s\n", cert_name, errorCode, slapd_pr_strerror(errorCode));
 	}
 	if( cert != NULL ) {
 		key = slapd_CERT_ExtractPublicKey(cert);
 	}
 	if (key == NULL) {
                 errorCode = PR_GetError();
-                LDAPDebug(LDAP_DEBUG_ANY,"Can't get private key from cert %s in attrcrypt_fetch_public_key: %d - %s\n", cert_name, errorCode, slapd_pr_strerror(errorCode));
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Can't get private key from cert %s in attrcrypt_fetch_public_key: %d - %s\n", cert_name, errorCode, slapd_pr_strerror(errorCode));
 				ret = -1;
 	}
 	if (cert) {
@@ -369,7 +369,7 @@ attrcrypt_fetch_public_key(SECKEYPublicKey **public_key)
 	if (cert_name != default_cert_name) {
 		slapi_ch_free_string(&cert_name);
 	}
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_fetch_public_key\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_fetch_public_key\n", 0, 0, 0);
 	return ret;
 }
 
@@ -382,7 +382,7 @@ attrcrypt_fetch_private_key(SECKEYPrivateKey **private_key)
 	PRErrorCode errorCode = 0;
 	char *default_cert_name = "server-cert";
 	char *cert_name = NULL;
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_fetch_private_key\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_fetch_private_key\n", 0, 0, 0);
 	*private_key = NULL;
 	/* Try to grok the server cert name from the SSL config */
 	ret = attrcrypt_get_ssl_cert_name(&cert_name);
@@ -393,14 +393,14 @@ attrcrypt_fetch_private_key(SECKEYPrivateKey **private_key)
 	cert = slapd_pk11_findCertFromNickname(cert_name, NULL);
 	if (cert == NULL) {
 		errorCode = PR_GetError();
-        LDAPDebug(LDAP_DEBUG_ANY,"Can't find certificate %s in attrcrypt_fetch_private_key: %d - %s\n", cert_name, errorCode, slapd_pr_strerror(errorCode));
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Can't find certificate %s in attrcrypt_fetch_private_key: %d - %s\n", cert_name, errorCode, slapd_pr_strerror(errorCode));
 	}
 	if( cert != NULL ) {
 		key = slapd_get_unlocked_key_for_cert(cert, NULL);
 	}
 	if (key == NULL) {
                 errorCode = PR_GetError();
-                LDAPDebug(LDAP_DEBUG_ANY,"Can't get private key from cert %s in attrcrypt_fetch_private_key: %d - %s\n", cert_name, errorCode, slapd_pr_strerror(errorCode));
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Can't get private key from cert %s in attrcrypt_fetch_private_key: %d - %s\n", cert_name, errorCode, slapd_pr_strerror(errorCode));
 				ret = -1;
 	}
 	if (cert) {
@@ -414,7 +414,7 @@ attrcrypt_fetch_private_key(SECKEYPrivateKey **private_key)
 	if (cert_name != default_cert_name) {
 		slapi_ch_free_string(&cert_name);
 	}
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_fetch_private_key\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_fetch_private_key\n", 0, 0, 0);
 	return ret;
 }
 
@@ -510,7 +510,7 @@ attrcrypt_init(ldbm_instance *li)
 	attrcrypt_cipher_entry *ace = NULL;
 	SECKEYPrivateKey *private_key = NULL;
 	SECKEYPublicKey *public_key = NULL;
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_init\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_init\n", 0, 0, 0);
 	if (slapd_security_library_is_initialized()) {
 		/* In case the backend instance is restarted, 
 		 * inst_attrcrypt_state_private in li could have memory containing
@@ -561,10 +561,10 @@ attrcrypt_init(ldbm_instance *li)
 		private_key = NULL;
 	} else {
 		if (li->attrcrypt_configured) {
-			LDAPDebug(LDAP_DEBUG_ANY,"Warning: encryption is configured in backend %s, but because SSL is not enabled, database encryption is not available and the configuration will be overridden.\n", li->inst_name, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Warning: encryption is configured in backend %s, but because SSL is not enabled, database encryption is not available and the configuration will be overridden.\n", li->inst_name, 0, 0);
 		}
 	}
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_init : %d\n", ret, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_init : %d\n", ret, 0, 0);
 	return ret;
 }
 
@@ -578,22 +578,22 @@ attrcrypt_init(ldbm_instance *li)
 int attrcrypt_check_enable_cipher(attrcrypt_cipher_entry *ace)
 {
 	int ret = 0;
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_check_enable_cipher\n", 0, 0, 0);
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_check_enable_cipher\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_check_enable_cipher\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_check_enable_cipher\n", 0, 0, 0);
 	return ret;
 }
 
 int
 attrcrypt_cleanup(attrcrypt_cipher_state *acs)
 {
-    LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_cleanup\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_cleanup\n", 0, 0, 0);
     if (acs->key) {
 		slapd_pk11_FreeSymKey(acs->key);
 	}
     if (acs->slot) {
 		slapd_pk11_FreeSlot(acs->slot);
 	}
-    LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_cleanup\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_cleanup\n", 0, 0, 0);
 	return 0;
 }
 
@@ -604,11 +604,11 @@ attrcrypt_cleanup(attrcrypt_cipher_state *acs)
 int
 attrcrypt_cleanup_private(ldbm_instance *li)
 {
-	LDAPDebug(LDAP_DEBUG_TRACE, "-> attrcrypt_cleanup_private\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "-> attrcrypt_cleanup_private\n", 0, 0, 0);
 	if (li && li->inst_attrcrypt_state_private) {
         _back_crypt_cleanup_private(&(li->inst_attrcrypt_state_private));
 	}
-	LDAPDebug(LDAP_DEBUG_TRACE, "<- attrcrypt_cleanup_private\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<- attrcrypt_cleanup_private\n", 0, 0, 0);
 	return 0;
 }
 
@@ -647,7 +647,7 @@ static void log_bytes(char* format_string, unsigned char *bytes, size_t length)
 		print_ptr += sprintf(print_ptr, "%02x ", bytes[x]);
 	}
 
-	LDAPDebug(LDAP_DEBUG_ANY,format_string, print_buffer, length, 0);
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,format_string, print_buffer, length, 0);
 
 	slapi_ch_free((void**)&print_buffer);
 }
@@ -660,7 +660,7 @@ attrcrypt_crypto_op(attrcrypt_private *priv, backend *be, struct attrinfo *ai, c
 	int ret = -1;
 	attrcrypt_cipher_state *acs = NULL;
 
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_crypto_op\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_crypto_op\n", 0, 0, 0);
 	acs = attrcrypt_get_acs(be,ai->ai_attrcrypt);
 	if (NULL == acs) {
 		/* This happens if SSL/NSS has not been enabled */
@@ -668,14 +668,14 @@ attrcrypt_crypto_op(attrcrypt_private *priv, backend *be, struct attrinfo *ai, c
 	}
 #if defined(DEBUG_ATTRCRYPT)
 	if (encrypt) {
-		LDAPDebug(LDAP_DEBUG_ANY,"attrcrypt_crypto_op encrypt '%s' (%d)\n", in_data, in_size, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"attrcrypt_crypto_op encrypt '%s' (%d)\n", in_data, in_size, 0);
 	} else {
 		log_bytes("attrcrypt_crypto_op decrypt '%s' (%d)\n", (unsigned char *)in_data, in_size);
 	}
 #endif
 	ret = _back_crypt_crypto_op(priv, acs, in_data, in_size,
 	                            out_data, out_size, encrypt, be, ai);
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_crypto_op\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_crypto_op\n", 0, 0, 0);
 	return ret;
 }
 
@@ -689,7 +689,7 @@ attrcrypt_crypto_op_value(attrcrypt_private *priv, backend *be, struct attrinfo
 	size_t out_size = 0;
 	struct berval *bval = NULL;
 
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_crypto_op_value\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_crypto_op_value\n", 0, 0, 0);
 	
 	bval = (struct berval *) slapi_value_get_berval(invalue);
 	in_data = bval->bv_val;
@@ -706,7 +706,7 @@ attrcrypt_crypto_op_value(attrcrypt_private *priv, backend *be, struct attrinfo
 		slapi_ch_free((void**)&out_data);
 	}
 
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_crypto_op_value: %d\n", ret, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_crypto_op_value: %d\n", ret, 0, 0);
 	return ret;
 }
 
@@ -720,7 +720,7 @@ attrcrypt_crypto_op_value_replace(attrcrypt_private *priv, backend *be, struct a
 	size_t out_size = 0;
 	struct berval *bval = NULL;
 
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_crypto_op_value_replace\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_crypto_op_value_replace\n", 0, 0, 0);
 	
 	bval = (struct berval *) slapi_value_get_berval(inoutvalue);
 	in_data = bval->bv_val;
@@ -737,7 +737,7 @@ attrcrypt_crypto_op_value_replace(attrcrypt_private *priv, backend *be, struct a
 		slapi_ch_free((void**)&out_data);
 	}
 
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_crypto_op_value_replace: %d\n", ret, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_crypto_op_value_replace: %d\n", ret, 0, 0);
 	return ret;
 }
 
@@ -748,7 +748,7 @@ attrcrypt_crypto_op_values(attrcrypt_private *priv,  backend *be, struct attrinf
 	int i = 0;
 	Slapi_Value **encrypted_values = NULL;
 
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_crypto_op_values\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_crypto_op_values\n", 0, 0, 0);
 	encrypted_values = (Slapi_Value **) slapi_ch_calloc(sizeof(Slapi_Value *),local_valuearray_count(invalues) + 1);
 	for ( i = 0; (invalues[i] != NULL) && (ret == 0); i++ ) {
 		Slapi_Value *encrypted_value = NULL;
@@ -762,7 +762,7 @@ attrcrypt_crypto_op_values(attrcrypt_private *priv,  backend *be, struct attrinf
 		}
 	}
 	*outvalues = encrypted_values;
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_crypto_op_values: %d\n", ret, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_crypto_op_values: %d\n", ret, 0, 0);
 	return ret;
 }
 
@@ -772,7 +772,7 @@ attrcrypt_crypto_op_values_replace(attrcrypt_private *priv,  backend *be, struct
 	int ret = 0;
 	int i = 0;
 
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_crypto_op_values_replace\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_crypto_op_values_replace\n", 0, 0, 0);
 	for ( i = 0; (invalues[i] != NULL) && (ret == 0); i++ ) {
 
 		ret = attrcrypt_crypto_op_value_replace(priv,be,ai,invalues[i],encrypt);
@@ -780,7 +780,7 @@ attrcrypt_crypto_op_values_replace(attrcrypt_private *priv,  backend *be, struct
 			break;
 		}
 	}
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_crypto_op_values_replace\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_crypto_op_values_replace\n", 0, 0, 0);
 	return ret;
 }
 
@@ -802,7 +802,7 @@ attrcrypt_decrypt_entry(backend *be, struct backentry *e)
 		return ret;
 	}
 
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_decrypt_entry\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_decrypt_entry\n", 0, 0, 0);
 	/* Scan through the entry's attributes, looking to see if any are configured for crypto */
 	for ( rc = slapi_entry_first_attr( e->ep_entry, &attr ); rc == 0 && attr ; rc = slapi_entry_next_attr( e->ep_entry, attr, &attr )) {
 
@@ -820,7 +820,7 @@ attrcrypt_decrypt_entry(backend *be, struct backentry *e)
 				/* Now decrypt the attribute values in place on the original entry */
 				ret = attrcrypt_crypto_op_value_replace(ai->ai_attrcrypt,be,ai,value,0);
 				if (ret) {
-					LDAPDebug(LDAP_DEBUG_ANY,"attrcrypt_decrypt_entry: FAILING because decryption operation failed\n", 0, 0, 0);
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"attrcrypt_decrypt_entry: FAILING because decryption operation failed\n", 0, 0, 0);
 					return ret;
 				}
 				i = slapi_attr_next_value(attr,i,&value);
@@ -832,14 +832,14 @@ attrcrypt_decrypt_entry(backend *be, struct backentry *e)
 				/* Now decrypt the attribute values in place on the original entry */
 				ret = attrcrypt_crypto_op_value_replace(ai->ai_attrcrypt,be,ai,value,0);
 				if (ret) {
-					LDAPDebug(LDAP_DEBUG_ANY,"attrcrypt_decrypt_entry: FAILING because decryption operation failed\n", 0, 0, 0);
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"attrcrypt_decrypt_entry: FAILING because decryption operation failed\n", 0, 0, 0);
 					return ret;
 				}
 				i = attr_next_deleted_value(attr,i,&value);
 			} 
 		}
 	}
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_decrypt_entry\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_decrypt_entry\n", 0, 0, 0);
 	return ret;
 }
 
@@ -863,7 +863,7 @@ attrcrypt_encrypt_entry_inplace(backend *be, const struct backentry *inout)
 		return ret;
 	}
 
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_encrypt_entry_inplace\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_encrypt_entry_inplace\n", 0, 0, 0);
 	/* Scan the entry's attributes looking for any that are configured for encryption */
 	for ( rc = slapi_entry_first_attr( inout->ep_entry, &attr ); rc == 0;
 		rc = slapi_entry_next_attr( inout->ep_entry, attr, &attr ) ) {
@@ -882,7 +882,7 @@ attrcrypt_encrypt_entry_inplace(backend *be, const struct backentry *inout)
 			}
 		}
 	}
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_encrypt_entry_inplace\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_encrypt_entry_inplace\n", 0, 0, 0);
 	return ret;
 }
 
@@ -908,7 +908,7 @@ attrcrypt_encrypt_entry(backend *be, const struct backentry *in, struct backentr
 		return ret;
 	}
 
-	LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_encrypt_entry\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_encrypt_entry\n", 0, 0, 0);
 	*out = NULL;
 	/* Scan the entry's attributes looking for any that are configured for encryption */
 	for ( rc = slapi_entry_first_attr( in->ep_entry, &attr ); rc == 0;
@@ -932,7 +932,7 @@ attrcrypt_encrypt_entry(backend *be, const struct backentry *in, struct backentr
 				/* Now encrypt the attribute values in place on the new entry */
 				ret = attrcrypt_crypto_op_values(ai->ai_attrcrypt,be,ai,svals,&new_vals,1);
 				if (ret) {
-					LDAPDebug(LDAP_DEBUG_ANY,"Error: attrcrypt_crypto_op_values failed in attrcrypt_encrypt_entry\n", 0, 0, 0);
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Error: attrcrypt_crypto_op_values failed in attrcrypt_encrypt_entry\n", 0, 0, 0);
 					break;
 				}
 				/* DBDB does this call free the old value memory ? */
@@ -943,7 +943,7 @@ attrcrypt_encrypt_entry(backend *be, const struct backentry *in, struct backentr
 		}
 	}
 	*out = new_entry;
-	LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_encrypt_entry\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_encrypt_entry\n", 0, 0, 0);
 	return ret;
 }
 
@@ -968,7 +968,7 @@ attrcrypt_encrypt_index_key(backend *be, struct attrinfo *ai, const struct berva
 	}
 
 	if (ai->ai_attrcrypt) {
-		LDAPDebug(LDAP_DEBUG_TRACE,"-> attrcrypt_encrypt_index_key\n", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"-> attrcrypt_encrypt_index_key\n", 0, 0, 0);
 		ret = attrcrypt_crypto_op(ai->ai_attrcrypt,be,ai, in_data,in_size,&out_data,&out_size, 1);
 		if (0 == ret) {
 			out_berval = (struct berval *)ber_alloc();
@@ -981,7 +981,7 @@ attrcrypt_encrypt_index_key(backend *be, struct attrinfo *ai, const struct berva
 			out_berval->bv_val = out_data;
 			*out = out_berval;
 		}
-		LDAPDebug(LDAP_DEBUG_TRACE,"<- attrcrypt_encrypt_index_key\n", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"<- attrcrypt_encrypt_index_key\n", 0, 0, 0);
 	}
 	return ret;
 }
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt_config.c b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt_config.c
index 0fe9e8b..6059cd9 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt_config.c
@@ -66,7 +66,7 @@ ldbm_attrcrypt_parse_entry(ldbm_instance *inst, Slapi_Entry *e,
     /* Get the name of the attribute to index which will be the value
      * of the cn attribute. */
     if (slapi_entry_attr_find(e, "cn", &attr) != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Warning: malformed attribute encryption entry %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: malformed attribute encryption entry %s\n",
                   slapi_entry_get_dn(e), 0, 0);
         return LDAP_OPERATIONS_ERROR;
     }
@@ -82,7 +82,7 @@ ldbm_attrcrypt_parse_entry(ldbm_instance *inst, Slapi_Entry *e,
             attrValue = slapi_value_get_berval(sval);
 			*cipher = ldbm_attrcrypt_parse_cipher(attrValue->bv_val);  
 			if (0 == *cipher)
-				LDAPDebug(LDAP_DEBUG_ANY, "Warning: attempt to configure unrecognized cipher %s in encrypted attribute config entry %s\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: attempt to configure unrecognized cipher %s in encrypted attribute config entry %s\n",
 					attrValue->bv_val, slapi_entry_get_dn(e), 0);        
 		}
     }
@@ -161,7 +161,7 @@ ldbm_instance_attrcrypt_config_add_callback(Slapi_PBlock *pb, Slapi_Entry* e, Sl
 				/* Remember that we have some encryption enabled, so we can be intelligent about warning when SSL is not enabled */
 				inst->attrcrypt_configured = 1;
 			} else {
-				LDAPDebug(LDAP_DEBUG_ANY, "Warning: attempt to encryption on a non-existent attribute: %s\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: attempt to encryption on a non-existent attribute: %s\n",
 					  attribute_name, 0, 0);
 				returntext = "attribute does not exist";
 				*returncode = LDAP_UNWILLING_TO_PERFORM;
@@ -215,7 +215,7 @@ ldbm_instance_attrcrypt_config_delete_callback(Slapi_PBlock *pb, Slapi_Entry* e,
 
         ainfo_get(inst->inst_be, attribute_name, &ai);
         if (ai == NULL || (0 == strcmp(LDBM_PSEUDO_ATTR_DEFAULT, ai->ai_type)) ) {
-			LDAPDebug(LDAP_DEBUG_ANY, "Warning: attempt to delete encryption for non-existant attribute: %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: attempt to delete encryption for non-existant attribute: %s\n",
 				attribute_name, 0, 0);
 		} else {
 			ldbm_instance_attrcrypt_disable(ai);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index ef849d8..181c2f5 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -77,7 +77,7 @@ int ldbm_config_add_dse_entries(struct ldbminfo *li, char **entries, char *strin
         } else if (result == LDAP_ALREADY_EXISTS) {
             LDAPDebug1Arg(LDAP_DEBUG_TRACE, "Database config entry [%s] already exists - skipping\n", ebuf);
         } else {
-            LDAPDebug(LDAP_DEBUG_ANY, "Unable to add config entry [%s] to the DSE: %d %d\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Unable to add config entry [%s] to the DSE: %d %d\n",
                       ebuf, result, rc);
         }
         slapi_pblock_destroy(util_pb);
@@ -305,12 +305,12 @@ static int ldbm_config_directory_set(void *arg, void *value, char *errorbuf, int
         slapi_ch_free((void **) &(li->li_new_directory));
         li->li_new_directory = rel2abspath(val); /* normalize the path;
                                                     strdup'ed in rel2abspath */
-        LDAPDebug(LDAP_DEBUG_ANY, "New db directory location will not take affect until the server is restarted\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "New db directory location will not take affect until the server is restarted\n", 0, 0, 0);
     } else {
         slapi_ch_free((void **) &(li->li_new_directory));
         slapi_ch_free((void **) &(li->li_directory));
         if (NULL == val || '\0' == *val) {
-            LDAPDebug(LDAP_DEBUG_ANY, 
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                 "ERROR: db directory is not set; check %s in the db config: %s\n",
                 CONFIG_DIRECTORY, CONFIG_LDBM_DN, 0);
             retval = LDAP_PARAM_ERROR;
@@ -335,7 +335,7 @@ static int ldbm_config_directory_set(void *arg, void *value, char *errorbuf, int
                 slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_RESULT, &res);
     
                 if (res != LDAP_SUCCESS) {
-                    LDAPDebug(LDAP_DEBUG_ANY, 
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                               "ERROR: ldbm plugin unable to read %s\n",
                               CONFIG_LDBM_DN, 0, 0);
                     retval = res;
@@ -344,7 +344,7 @@ static int ldbm_config_directory_set(void *arg, void *value, char *errorbuf, int
     
                 slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
                 if (NULL == entries) {
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                               "ERROR: ldbm plugin unable to read %s\n",
                               CONFIG_LDBM_DN, 0, 0);
                     retval = LDAP_OPERATIONS_ERROR;
@@ -353,7 +353,7 @@ static int ldbm_config_directory_set(void *arg, void *value, char *errorbuf, int
                 
                 res = slapi_entry_attr_find(entries[0], "nsslapd-directory", &attr);
                 if (res != 0 || attr == NULL) {
-                    LDAPDebug(LDAP_DEBUG_ANY, 
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                               "ERROR: ldbm plugin unable to read attribute nsslapd-directory from %s\n",
                               CONFIG_LDBM_DN, 0, 0);
                     retval = LDAP_OPERATIONS_ERROR;
@@ -363,7 +363,7 @@ static int ldbm_config_directory_set(void *arg, void *value, char *errorbuf, int
                 if ( slapi_attr_first_value(attr,&v) != 0
                         || ( NULL == v )
                         || ( NULL == ( s = slapi_value_get_string( v )))) {
-                    LDAPDebug(LDAP_DEBUG_ANY, 
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                               "ERROR: ldbm plugin unable to read attribute nsslapd-directory from %s\n",
                               CONFIG_LDBM_DN, 0, 0);
                     retval = LDAP_OPERATIONS_ERROR;
@@ -371,7 +371,7 @@ static int ldbm_config_directory_set(void *arg, void *value, char *errorbuf, int
                 }
                 slapi_pblock_destroy(search_pb);
                 if (NULL == s || '\0' == s || 0 == PL_strcmp(s, "(null)")) {
-                    LDAPDebug(LDAP_DEBUG_ANY, 
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                         "ERROR: db directory is not set; check %s in the db config: %s\n",
                         CONFIG_DIRECTORY, CONFIG_LDBM_DN, 0);
                     retval = LDAP_PARAM_ERROR;
@@ -419,7 +419,7 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
         /* min: 8KB (page size) * def thrd cnts (threadnumber==20). */
 #define DBDEFMINSIZ     500000
         if (val < DBDEFMINSIZ) {
-            LDAPDebug( LDAP_DEBUG_ANY,"WARNING: cache too small, increasing to %dK bytes\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"WARNING: cache too small, increasing to %dK bytes\n",
                     DBDEFMINSIZ/1000, 0, 0);
             val = DBDEFMINSIZ;
         } else if (val > li->li_dbcachesize) {
@@ -432,7 +432,7 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
         }
         if (CONFIG_PHASE_RUNNING == phase) {
             li->li_new_dbcachesize = val;
-            LDAPDebug(LDAP_DEBUG_ANY, "New db cache size will not take affect until the server is restarted\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "New db cache size will not take affect until the server is restarted\n",
                     0, 0, 0);
         } else {
             li->li_new_dbcachesize = val;
@@ -458,7 +458,7 @@ static int ldbm_config_maxpassbeforemerge_set(void *arg, void *value, char *erro
     
     if (apply) {
         if (val < 0) {
-            LDAPDebug( LDAP_DEBUG_ANY,"WARNING: maxpassbeforemerge will not take negative value\n", 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"WARNING: maxpassbeforemerge will not take negative value\n", 0, 0, 0);
             val = 100;
         } 
         
@@ -486,7 +486,7 @@ static int ldbm_config_dbncache_set(void *arg, void *value, char *errorbuf, int
 
         if (CONFIG_PHASE_RUNNING == phase) {
             li->li_new_dbncache = val;
-            LDAPDebug(LDAP_DEBUG_ANY, "New nsslapd-dbncache will not take affect until the server is restarted\n", 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "New nsslapd-dbncache will not take affect until the server is restarted\n", 0, 0, 0);
         } else {
             li->li_new_dbncache = val;
             li->li_dbncache = val;
@@ -1022,7 +1022,7 @@ static int ldbm_config_db_lock_set(void *arg, void *value, char *errorbuf, int p
     if (apply) {
         if (CONFIG_PHASE_RUNNING == phase) {
             li->li_dblayer_private->dblayer_lock_config = val;
-            LDAPDebug(LDAP_DEBUG_ANY, "New db max lock count will not take affect until the server is restarted\n", 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "New db max lock count will not take affect until the server is restarted\n", 0, 0, 0);
         } else {
             li->li_dblayer_private->dblayer_lock_config = val;
         }
@@ -1455,7 +1455,7 @@ static int ldbm_config_db_deadlock_policy_set(void *arg, void *value, char *erro
 	    slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
 	                "Error: Invalid value for %s (%d). Must be between %d and %d inclusive",
 	                CONFIG_DB_DEADLOCK_POLICY, val, DB_LOCK_DEFAULT, DB_LOCK_YOUNGEST);
-	    LDAPDebug(LDAP_DEBUG_ANY, "Error: Invalid value for deadlock policy (%d). Must be between %d and %d inclusive",
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: Invalid value for deadlock policy (%d). Must be between %d and %d inclusive",
 	                val, DB_LOCK_DEFAULT, DB_LOCK_YOUNGEST);
 	    return LDAP_UNWILLING_TO_PERFORM;
     }
@@ -1627,7 +1627,7 @@ int ldbm_config_load_dse_info(struct ldbminfo *li)
 
     search_pb = slapi_pblock_new();
     if (!search_pb) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "ldbm_config_load_dse_info: Out of memory\n",
                       0, 0, 0);
         rval = 1;
@@ -1644,7 +1644,7 @@ int ldbm_config_load_dse_info(struct ldbminfo *li)
         ldbm_config_add_dse_entries(li, ldbm_skeleton_entries,
                                     li->li_plugin->plg_name, NULL, NULL, 0);
     } else if (rval != LDAP_SUCCESS) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Error accessing the ldbm config DSE\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error accessing the ldbm config DSE\n",
                   0, 0, 0);
         rval = 1;
         goto bail;
@@ -1654,13 +1654,13 @@ int ldbm_config_load_dse_info(struct ldbminfo *li)
         slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES,
                          &entries);
         if (NULL == entries || entries[0] == NULL) {
-            LDAPDebug(LDAP_DEBUG_ANY, "Error accessing the ldbm config DSE\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error accessing the ldbm config DSE\n",
                       0, 0, 0);
             rval = 1;
             goto bail;
         }
         if (0 != parse_ldbm_config_entry(li, entries[0], ldbm_config)) {
-            LDAPDebug(LDAP_DEBUG_ANY, "Error parsing the ldbm config DSE\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error parsing the ldbm config DSE\n",
                       0, 0, 0);
             rval = 1;
             goto bail;
@@ -1882,7 +1882,7 @@ int ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struc
 
     config = get_config_info(config_array, attr_name);
     if (NULL == config) {
-        LDAPDebug(LDAP_DEBUG_CONFIG, "Unknown config attribute %s\n", attr_name, 0, 0);
+        LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "Unknown config attribute %s\n", attr_name, 0, 0);
         slapi_create_errormsg(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Unknown config attribute %s\n", attr_name);
         return LDAP_SUCCESS; /* Ignore unknown attributes */
     }
@@ -1944,14 +1944,14 @@ int ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struc
         } else if (LL_CMP(llval, >, llmaxint)) {
             slapi_create_errormsg(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is greater than the maximum %d\n",
                     str_val, attr_name, maxint);
-            LDAPDebug(LDAP_DEBUG_ANY, "Error: value %s for attr %s is greater than the maximum %d\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: value %s for attr %s is greater than the maximum %d\n",
                     str_val, attr_name, maxint);
             return LDAP_UNWILLING_TO_PERFORM;
         /* check for underflow */
         } else if (LL_CMP(llval, <, llminint)) {
             slapi_create_errormsg(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is less than the minimum %d\n",
                     str_val, attr_name, minint);
-            LDAPDebug(LDAP_DEBUG_ANY, "Error: value %s for attr %s is less than the minimum %d\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: value %s for attr %s is less than the minimum %d\n",
                     str_val, attr_name, minint);
             return LDAP_UNWILLING_TO_PERFORM;
         }
@@ -1986,14 +1986,14 @@ int ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struc
         } else if (LL_CMP(llval, >, llmaxint)) {
             slapi_create_errormsg(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is greater than the maximum %d\n",
                     str_val, attr_name, maxint);
-            LDAPDebug(LDAP_DEBUG_ANY, "Error: value %s for attr %s is greater than the maximum %d\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: value %s for attr %s is greater than the maximum %d\n",
                     str_val, attr_name, maxint);
             return LDAP_UNWILLING_TO_PERFORM;
         /* check for underflow */
         } else if (LL_CMP(llval, <, llminint)) {
             slapi_create_errormsg(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is less than the minimum %d\n",
                     str_val, attr_name, minint);
-            LDAPDebug(LDAP_DEBUG_ANY, "Error: value %s for attr %s is less than the minimum %d\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: value %s for attr %s is less than the minimum %d\n",
                     str_val, attr_name, minint);
             return LDAP_UNWILLING_TO_PERFORM;
         }
@@ -2083,7 +2083,7 @@ static int parse_ldbm_config_entry(struct ldbminfo *li, Slapi_Entry *e, config_i
         bval = (struct berval *) slapi_value_get_berval(sval);
         
         if (ldbm_config_set(li, attr_name, config_array, bval, err_buf, CONFIG_PHASE_STARTUP, 1 /* apply */, LDAP_MOD_REPLACE) != LDAP_SUCCESS) {
-            LDAPDebug(LDAP_DEBUG_ANY, "Error with config attribute %s : %s\n", attr_name, err_buf, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error with config attribute %s : %s\n", attr_name, err_buf, 0);
             return 1;
         }
     }
@@ -2203,7 +2203,7 @@ void ldbm_config_internal_set(struct ldbminfo *li, char *attrname, char *value)
     if (ldbm_config_set((void *) li, attrname, ldbm_config, &bval, 
                         err_buf, CONFIG_PHASE_INTERNAL, 1 /* apply */,
                         LDAP_MOD_REPLACE) != LDAP_SUCCESS) {
-        LDAPDebug(LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                   "Internal Error: Error setting instance config attr %s to %s: %s\n", 
                   attrname, value, err_buf);
         exit(1);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index f801e01..4350ae6 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -729,12 +729,12 @@ ldbm_back_delete( Slapi_PBlock *pb )
 			}
 			retval = id2entry_add( be, tombstone, &txn );
 			if (DB_LOCK_DEADLOCK == retval) {
-				LDAPDebug( LDAP_DEBUG_BACKLDBM, "delete 1 DB_LOCK_DEADLOCK\n", 0, 0, 0 );
+				LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "delete 1 DB_LOCK_DEADLOCK\n", 0, 0, 0 );
 				/* Abort and re-try */
 				continue;
 			}
 			if (retval) {
-				LDAPDebug( LDAP_DEBUG_ANY, "id2entry_add failed, err=%d %s\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "id2entry_add failed, err=%d %s\n",
 				           retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
 				if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
 				DEL_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
@@ -774,7 +774,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 			continue;
 		}
 		if (retval) {
-			LDAPDebug(LDAP_DEBUG_ANY, "index_del_entry(%s, 0x%x) failed (%d)\n", 
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "index_del_entry(%s, 0x%x) failed (%d)\n", 
 			          slapi_entry_get_dn(e->ep_entry), addordel_flags, retval);
 			DEL_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
 			goto error_return;
@@ -792,14 +792,14 @@ ldbm_back_delete( Slapi_PBlock *pb )
 							SLAPI_ATTR_VALUE_TOMBSTONE,
 							tombstone->ep_id,BE_INDEX_ADD, &txn);
 			if (DB_LOCK_DEADLOCK == retval) {
-				LDAPDebug( LDAP_DEBUG_BACKLDBM,
+				LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
 							"delete (adding %s) DB_LOCK_DEADLOCK\n",
 							SLAPI_ATTR_VALUE_TOMBSTONE, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
 			if (retval) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				           "delete (adding %s) failed, err=%d %s\n",
 				           SLAPI_ATTR_VALUE_TOMBSTONE, retval,
 				           (msg = dblayer_strerror( retval )) ? msg : "" );
@@ -816,14 +816,14 @@ ldbm_back_delete( Slapi_PBlock *pb )
 				                               deletion_csn_str, tombstone->ep_id,
 				                               BE_INDEX_ADD, &txn);
 				if (DB_LOCK_DEADLOCK == retval) {
-					LDAPDebug( LDAP_DEBUG_BACKLDBM,
+					LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
 					           "delete tombstone csn(adding %s) DB_LOCK_DEADLOCK\n",
 					           deletion_csn_str, 0, 0 );
 					/* Retry txn */
 					continue;
 				}
 				if (0 != retval) {
-					LDAPDebug( LDAP_DEBUG_ANY,
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 							   "delete tombsone csn(adding %s) failed, err=%d %s\n",
 							   deletion_csn_str,
 							   retval,
@@ -840,14 +840,14 @@ ldbm_back_delete( Slapi_PBlock *pb )
 							slapi_entry_get_uniqueid(tombstone->ep_entry),
 							tombstone->ep_id,BE_INDEX_ADD,&txn);
 			if (DB_LOCK_DEADLOCK == retval) {
-				LDAPDebug( LDAP_DEBUG_BACKLDBM,
+				LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
 							"delete (adding %s) DB_LOCK_DEADLOCK\n",
 							SLAPI_ATTR_UNIQUEID, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
 			if (retval) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 							"delete (adding %s) failed, err=%d %s\n",
 							SLAPI_ATTR_UNIQUEID, retval,
 							(msg = dblayer_strerror( retval )) ? msg : "" );
@@ -860,14 +860,14 @@ ldbm_back_delete( Slapi_PBlock *pb )
 							slapi_sdn_get_ndn(&nscpEntrySDN),
 							tombstone->ep_id, BE_INDEX_ADD, &txn);
 			if (DB_LOCK_DEADLOCK == retval) {
-				LDAPDebug( LDAP_DEBUG_BACKLDBM,
+				LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
 							"delete (adding %s) DB_LOCK_DEADLOCK\n",
 							SLAPI_ATTR_NSCP_ENTRYDN, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
 			if (retval) {
-				LDAPDebug( LDAP_DEBUG_ANY, 
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 							"delete (adding %s) failed, err=%d %s\n",
 							SLAPI_ATTR_NSCP_ENTRYDN, retval,
 							(msg = dblayer_strerror( retval )) ? msg : "" );
@@ -884,14 +884,14 @@ ldbm_back_delete( Slapi_PBlock *pb )
 							entryusn_str, tombstone->ep_id, BE_INDEX_ADD, &txn);
 				slapi_ch_free_string(&entryusn_str);
 				if (DB_LOCK_DEADLOCK == retval) {
-					LDAPDebug( LDAP_DEBUG_BACKLDBM,
+					LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
 								"delete (adding %s) DB_LOCK_DEADLOCK\n",
 								SLAPI_ATTR_ENTRYUSN, 0, 0 );
 					/* Retry txn */
 					continue;
 				}
 				if (0 != retval) {
-					LDAPDebug( LDAP_DEBUG_ANY, 
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 								"delete (adding %s) failed, err=%d %s\n",
 								SLAPI_ATTR_ENTRYUSN, retval,
 								(msg = dblayer_strerror( retval )) ? msg : "" );
@@ -921,7 +921,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 						continue;
 					}
 					if ( retval ) {
-						LDAPDebug( LDAP_DEBUG_ANY, 
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 								"delete (deleting %s) failed, err=%d %s\n",
 								LDBM_PARENTID_STR, retval,
 								(msg = dblayer_strerror( retval )) ? msg : "" );
@@ -958,7 +958,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 					continue;
 				}
 				if (retval) {
-					LDAPDebug(LDAP_DEBUG_ANY, 
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 					          "adding (adding tombstone entryrdn %s) failed, err=%d %s\n",
 					          slapi_entry_get_dn(tombstone->ep_entry),
 					          retval, (msg = dblayer_strerror( retval )) ? msg : "" );
@@ -980,14 +980,14 @@ ldbm_back_delete( Slapi_PBlock *pb )
 							SLAPI_ATTR_VALUE_TOMBSTONE, e->ep_id,
 							BE_INDEX_DEL|BE_INDEX_EQUALITY, &txn);
 			if (DB_LOCK_DEADLOCK == retval) {
-				LDAPDebug( LDAP_DEBUG_BACKLDBM,
+				LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
 							"delete (deleting %s) DB_LOCK_DEADLOCK\n",
 							SLAPI_ATTR_VALUE_TOMBSTONE, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
 			if (0 != retval) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 							"delete (deleting %s) failed, err=%d %s\n",
 							SLAPI_ATTR_VALUE_TOMBSTONE, retval,
 							(msg = dblayer_strerror( retval )) ? msg : "" );
@@ -1004,14 +1004,14 @@ ldbm_back_delete( Slapi_PBlock *pb )
 				                               deletion_csn_str, e->ep_id,
 				                               BE_INDEX_DEL|BE_INDEX_EQUALITY, &txn);
 				if (DB_LOCK_DEADLOCK == retval) {
-					LDAPDebug( LDAP_DEBUG_BACKLDBM,
+					LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
 					           "delete tombstone csn(deleting %s) DB_LOCK_DEADLOCK\n",
 					           deletion_csn_str, 0, 0 );
 					/* Retry txn */
 					continue;
 				}
 				if (0 != retval) {
-					LDAPDebug( LDAP_DEBUG_ANY,
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					           "delete tombsone csn(deleting %s) failed, err=%d %s\n",
 					           deletion_csn_str,
 					           retval,
@@ -1028,14 +1028,14 @@ ldbm_back_delete( Slapi_PBlock *pb )
 							slapi_entry_get_uniqueid(e->ep_entry),
 							e->ep_id, BE_INDEX_DEL|BE_INDEX_EQUALITY, &txn);
 			if (DB_LOCK_DEADLOCK == retval) {
-				LDAPDebug( LDAP_DEBUG_BACKLDBM,
+				LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
 							"delete (deleting %s) DB_LOCK_DEADLOCK\n",
 							SLAPI_ATTR_UNIQUEID, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
 			if (0 != retval) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 							"delete (deleting %s) failed, err=%d %s\n",
 							SLAPI_ATTR_UNIQUEID, retval,
 							(msg = dblayer_strerror( retval )) ? msg : "" );
@@ -1052,14 +1052,14 @@ ldbm_back_delete( Slapi_PBlock *pb )
 								nscpedn, e->ep_id, BE_INDEX_DEL|BE_INDEX_EQUALITY, &txn);
 				slapi_ch_free((void **)&nscpedn);
 				if (DB_LOCK_DEADLOCK == retval) {
-					LDAPDebug( LDAP_DEBUG_BACKLDBM,
+					LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
 								"delete (deleting %s) DB_LOCK_DEADLOCK\n",
 								SLAPI_ATTR_NSCP_ENTRYDN, 0, 0 );
 					/* Retry txn */
 					continue;
 				}
 				if (0 != retval) {
-					LDAPDebug( LDAP_DEBUG_ANY,
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 								"delete (deleting %s) failed, err=%d %s\n",
 								SLAPI_ATTR_NSCP_ENTRYDN, retval,
 								(msg = dblayer_strerror( retval )) ? msg : "" );
@@ -1078,14 +1078,14 @@ ldbm_back_delete( Slapi_PBlock *pb )
 							BE_INDEX_DEL|BE_INDEX_EQUALITY, &txn);
 				slapi_ch_free_string(&entryusn_str);
 				if (DB_LOCK_DEADLOCK == retval) {
-					LDAPDebug( LDAP_DEBUG_BACKLDBM,
+					LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
 								"delete (deleting %s) DB_LOCK_DEADLOCK\n",
 								SLAPI_ATTR_ENTRYUSN, 0, 0 );
 					/* Retry txn */
 					continue;
 				}
 				if (0 != retval) {
-					LDAPDebug( LDAP_DEBUG_ANY, 
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 								"delete (deleting %s) failed, err=%d %s\n",
 								SLAPI_ATTR_ENTRYUSN, retval,
 								(msg = dblayer_strerror( retval )) ? msg : "" );
@@ -1125,12 +1125,12 @@ ldbm_back_delete( Slapi_PBlock *pb )
 			                conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, retval);
 			if (DB_LOCK_DEADLOCK == retval)
 			{
-				LDAPDebug( LDAP_DEBUG_BACKLDBM, "del 4 DEADLOCK\n", 0, 0, 0 );
+				LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "del 4 DEADLOCK\n", 0, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
 			if (0 != retval) {
-				LDAPDebug( LDAP_DEBUG_ANY, "delete 3 BAD, err=%d %s\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "delete 3 BAD, err=%d %s\n",
 					   retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
 				if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
 				DEL_SET_ERROR(ldap_result_code, 
@@ -1148,7 +1148,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 
 			if (DB_LOCK_DEADLOCK == retval)
 			{
-				LDAPDebug( LDAP_DEBUG_BACKLDBM, "delete DEADLOCK vlv_update_index\n", 0, 0, 0 );
+				LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG, "delete DEADLOCK vlv_update_index\n", 0, 0, 0 );
 				/* Retry txn */
 				continue;
 			}
@@ -1163,7 +1163,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 		if (!is_ruv && !is_fixup_operation && !delete_tombstone_entry && !NO_RUV_UPDATE(li)) {
 			ruv_c_init = ldbm_txn_ruv_modify_context( pb, &ruv_c );
 			if (-1 == ruv_c_init) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"ldbm_back_delete: ldbm_txn_ruv_modify_context "
 					"failed to construct RUV modify context\n",
 					0, 0, 0);
@@ -1180,7 +1180,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 				continue;
 			}
 			if (0 != retval) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"modify_update_all failed, err=%d %s\n", retval,
 					(msg = dblayer_strerror( retval )) ? msg : "", 0 );
 				if (LDBM_OS_ERR_IS_DISKFULL(retval))
@@ -1196,7 +1196,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 	}
 	if (retry_count == RETRY_TIMES) {
 		/* Failed */
-		LDAPDebug( LDAP_DEBUG_ANY, "Retry count exceeded in delete\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Retry count exceeded in delete\n", 0, 0, 0 );
 		ldap_result_code= LDAP_BUSY;
 		retval = -1;
 		goto error_return;
@@ -1204,7 +1204,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
     if (create_tombstone_entry) {
 			retval = cache_replace(&inst->inst_cache, e, tombstone);
 			if (retval) {
-				LDAPDebug(LDAP_DEBUG_CACHE, "ldbm_back_delete: cache_replace failed (%d): %s --> %s\n",
+				LDAPDebug(LDAP_DEBUG_CACHE, LOG_DEBUG, "ldbm_back_delete: cache_replace failed (%d): %s --> %s\n",
 				          retval, slapi_entry_get_dn(e->ep_entry), slapi_entry_get_dn(tombstone->ep_entry));
 				retval= -1;
 				goto error_return;
@@ -1293,7 +1293,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 	if (ruv_c_init) {
 		if (modify_switch_entries(&ruv_c, be) != 0 ) {
 			ldap_result_code= LDAP_OPERATIONS_ERROR;
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"ldbm_back_delete: modify_switch_entries failed\n", 0, 0, 0);
 			retval = -1;
 			goto error_return;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
index f66ae68..ea49556 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_entryrdn.c
@@ -25,7 +25,7 @@ static int entryrdn_noancestorid = 0;
 #ifdef ENTRYRDN_DEBUG
 #define ASSERT(_x) do { \
     if (!(_x)) { \
-        LDAPDebug(LDAP_DEBUG_ANY, "BAD ASSERTION at %s/%d: %s\n", \
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "BAD ASSERTION at %s/%d: %s\n", \
         __FILE__, __LINE__, #_x); \
         *(char *)0L = 23; \
     } \
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
index c5ceacf..5d7aa2a 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
@@ -34,7 +34,7 @@ static int ldbm_index_parse_entry(ldbm_instance *inst, Slapi_Entry *e,
     /* Get the name of the attribute to index which will be the value
      * of the cn attribute. */
     if (slapi_entry_attr_find(e, "cn", &attr) != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Warning: malformed index entry %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: malformed index entry %s\n",
                   slapi_entry_get_dn(e), 0, 0);
         return LDAP_OPERATIONS_ERROR;
     }
@@ -42,7 +42,7 @@ static int ldbm_index_parse_entry(ldbm_instance *inst, Slapi_Entry *e,
     slapi_attr_first_value(attr, &sval);
     attrValue = slapi_value_get_berval(sval);
     if (NULL == attrValue->bv_val || 0 == attrValue->bv_len) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Warning: malformed index entry %s -- empty index name\n",
                    slapi_entry_get_dn(e), 0, 0);
         return LDAP_OPERATIONS_ERROR;
@@ -58,7 +58,7 @@ static int ldbm_index_parse_entry(ldbm_instance *inst, Slapi_Entry *e,
     	attrValue = slapi_value_get_berval(sval);
     	if (NULL == attrValue->bv_val || attrValue->bv_len == 0) {
     		/* missing the index type, error out */
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                      "Warning: malformed index entry %s -- empty nsIndexType\n",
                      slapi_entry_get_dn(e), 0, 0);
             slapi_ch_free_string(index_name);
@@ -198,7 +198,7 @@ ldbm_instance_index_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry *e,
     *returncode = LDAP_SUCCESS;
 
     if(slapi_entry_attr_find(entryAfter, "cn", &attr) != 0){
-    	 LDAPDebug(LDAP_DEBUG_ANY,
+    	 LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
     			 "Warning: malformed index entry %s - missing cn attribute\n",
     			 slapi_entry_get_dn(entryAfter), 0, 0);
     	 *returncode = LDAP_OBJECT_CLASS_VIOLATION;
@@ -208,7 +208,7 @@ ldbm_instance_index_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry *e,
     attrValue = slapi_value_get_berval(sval);
 
     if (NULL == attrValue->bv_val || 0 == attrValue->bv_len) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
         		"Warning: malformed index entry %s, missing index name\n",
         		slapi_entry_get_dn(e), 0, 0);
         *returncode =  LDAP_UNWILLING_TO_PERFORM;
@@ -217,7 +217,7 @@ ldbm_instance_index_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry *e,
 
     ainfo_get(inst->inst_be, attrValue->bv_val, &ainfo);
     if (NULL == ainfo) {
-    	LDAPDebug(LDAP_DEBUG_ANY,
+    	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
     			"Warning: malformed index entry %s - missing cn attribute info\n",
     			slapi_entry_get_dn(e), 0, 0);
     	*returncode = LDAP_UNWILLING_TO_PERFORM;
@@ -225,7 +225,7 @@ ldbm_instance_index_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry *e,
     }
 
     if(slapi_entry_attr_find(entryAfter, "nsIndexType", &attr) != 0){
-    	 LDAPDebug(LDAP_DEBUG_ANY,
+    	 LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
     			 "Warning: malformed index entry %s - missing nsIndexType attribute\n",
     			 slapi_entry_get_dn(entryAfter), 0, 0);
     	 *returncode = LDAP_OBJECT_CLASS_VIOLATION;
@@ -259,7 +259,7 @@ int ldbm_instance_config_add_index_entry(
 
     /* get the cn value */
     if (slapi_entry_attr_find(e, "cn", &attr) != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Warning: malformed index entry %s, missing cn attrbiute\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: malformed index entry %s, missing cn attrbiute\n",
                   slapi_entry_get_dn(e), 0, 0);
         return -1;
     }
@@ -267,7 +267,7 @@ int ldbm_instance_config_add_index_entry(
     slapi_attr_first_value(attr, &sval);
     attrValue = slapi_value_get_berval(sval);
     if (NULL == attrValue->bv_val || 0 == attrValue->bv_len) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Warning: malformed index entry %s, missing index name\n",
                   slapi_entry_get_dn(e), 0, 0);
         return -1;
@@ -277,7 +277,7 @@ int ldbm_instance_config_add_index_entry(
 	dn = slapi_create_dn_string("cn=%s,cn=index,cn=%s,cn=%s,cn=plugins,cn=config",
                             basetype, inst->inst_name, li->li_plugin->plg_name);
 	if (NULL == dn) {
-		LDAPDebug(LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"ldbm_instance_config_add_index_entry: "
 				"failed create index dn with type %s for plugin %s, "
 				"instance %s\n",
@@ -304,7 +304,7 @@ int ldbm_instance_config_add_index_entry(
 			eBuf = PR_sprintf_append(eBuf, "nsIndexType: %s\n", attrValue->bv_val);
 		}
 	} else {
-		LDAPDebug(LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"ldbm_instance_config_add_index_entry: "
 				"failed create index dn with type %s for plugin %s, "
 				"instance %s.  Missing nsIndexType\n",
@@ -377,7 +377,7 @@ int ldbm_instance_create_default_user_indexes(ldbm_instance *inst)
     int flags = LDBM_INSTANCE_CONFIG_DONT_WRITE;
 
     if (NULL == inst) {
-        LDAPDebug(LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 		"Warning: can't initialize default user indexes (invalid instance).\n", 0,0,0);
         return -1;
     }
@@ -409,7 +409,7 @@ int ldbm_instance_create_default_user_indexes(ldbm_instance *inst)
                  * of the cn attribute.
                  */
                 if (slapi_entry_attr_find(entries[i], "cn", &attr) != 0) {
-                        LDAPDebug(LDAP_DEBUG_ANY,"Warning: malformed index entry %s. Index ignored.\n",
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Warning: malformed index entry %s. Index ignored.\n",
                                 slapi_entry_get_dn(entries[i]), 0, 0);
                         continue;
                 }
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
index 698be66..cd7e820 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
@@ -469,7 +469,7 @@ parse_ldbm_instance_config_entry(ldbm_instance *inst, Slapi_Entry *e, config_inf
 
         if (ldbm_config_set((void *) inst, attr_name, config_array, bval,
             err_buf, CONFIG_PHASE_STARTUP, 1 /* apply */, LDAP_MOD_REPLACE) != LDAP_SUCCESS) {
-            LDAPDebug(LDAP_DEBUG_ANY, "Error with config attribute %s : %s\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error with config attribute %s : %s\n",
                       attr_name, err_buf, 0);
             return 1;
         }
@@ -521,7 +521,7 @@ ldbm_instance_config_load_dse_info(ldbm_instance *inst)
 
     search_pb = slapi_pblock_new();
     if (!search_pb) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                        "ldbm_instance_config_load_dse_info: Out of memory\n",
                        0, 0, 0);
         rval = 1;
@@ -535,7 +535,7 @@ ldbm_instance_config_load_dse_info(ldbm_instance *inst)
     slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_RESULT, &rval);
 
     if (rval != LDAP_SUCCESS) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Error accessing the config DSE\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error accessing the config DSE\n", 0, 0, 0);
         rval = 1;
         goto bail;
     } else {
@@ -544,14 +544,14 @@ ldbm_instance_config_load_dse_info(ldbm_instance *inst)
         slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES,
                          &entries);
         if ((!entries) || (!entries[0])) {
-            LDAPDebug(LDAP_DEBUG_ANY, "Error accessing the config DSE\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error accessing the config DSE\n",
                       0, 0, 0);
             rval = 1;
             goto bail;
         }
         if (0 != parse_ldbm_instance_config_entry(inst, entries[0],
                                          ldbm_instance_config)) {
-            LDAPDebug(LDAP_DEBUG_ANY, "Error parsing the config DSE\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error parsing the config DSE\n",
                       0, 0, 0);
             rval = 1;
             goto bail;
@@ -759,7 +759,7 @@ ldbm_instance_modify_config_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entryB
 
     if (!returntext) {
         rc = LDAP_OPERATIONS_ERROR;
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "ldbm_instance_modify_config_entry_callback: "
                   "NULL return text\n",
                   0, 0, 0);
@@ -781,7 +781,7 @@ ldbm_instance_modify_config_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entryB
                 rc = LDAP_UNWILLING_TO_PERFORM;
                 PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
                             "Can't change the root suffix of a backend");
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "ldbm: modify attempted to change the root suffix "
                           "of a backend (which is not allowed)\n",
                           0, 0, 0);
@@ -836,7 +836,7 @@ ldbm_instance_config_internal_set(ldbm_instance *inst, char *attrname, char *val
 
     if (ldbm_config_set((void *) inst, attrname, ldbm_instance_config, &bval, 
         err_buf, CONFIG_PHASE_INTERNAL, 1 /* apply */, LDAP_MOD_REPLACE) != LDAP_SUCCESS) {
-        LDAPDebug(LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
             "Internal Error: Error setting instance config attr %s to %s: %s\n", 
             attrname, value, err_buf);
         exit(1);
@@ -902,7 +902,7 @@ ldbm_instance_postadd_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry* ent
     parse_ldbm_instance_entry(entryBefore, &instance_name);
     rval = ldbm_instance_generate(li, instance_name, &be);
     if (rval) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "ldbm_instance_postadd_instance_entry_callback: "
             "ldbm_instance_generate (%s) failed (%d)\n",
             instance_name, rval, 0);
@@ -922,7 +922,7 @@ ldbm_instance_postadd_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry* ent
     rval = ldbm_instance_start(be);
     if (0 != rval)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "ldbm_instance_postadd_instance_entry_callback: "
             "ldbm_instnace_start (%s) failed (%d)\n",
             instance_name, rval, 0);
@@ -949,7 +949,7 @@ ldbm_instance_add_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entryBe
     /* Make sure we don't create two instances with the same name. */
     inst = ldbm_instance_find_by_name(li, instance_name);
     if (inst != NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING: ldbm instance %s already exists\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: ldbm instance %s already exists\n",
                   instance_name, 0, 0);
         if (returntext != NULL)
             PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "An ldbm instance with the name %s already exists\n",
@@ -1092,7 +1092,7 @@ ldbm_instance_post_delete_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry*
     inst = ldbm_instance_find_by_name(li, instance_name);
 
     if (inst == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm: instance '%s' does not exist! (2)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm: instance '%s' does not exist! (2)\n",
                   instance_name, 0, 0);
         if (returntext) {
             PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "No ldbm instance exists with the name '%s' (2)\n",
@@ -1105,7 +1105,7 @@ ldbm_instance_post_delete_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry*
         return SLAPI_DSE_CALLBACK_ERROR;
     }
 
-    LDAPDebug(LDAP_DEBUG_ANY, "ldbm: removing '%s'.\n", instance_name, 0, 0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm: removing '%s'.\n", instance_name, 0, 0);
 
     cache_destroy_please(&inst->inst_cache, CACHE_TYPE_ENTRY);
     if (entryrdn_get_switch()) { /* subtree-rename: on */
@@ -1140,7 +1140,7 @@ ldbm_instance_post_delete_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry*
 
                         dbp = PR_smprintf("%s/%s", inst_dirp, direntry->name);
                         if (NULL == dbp) {
-                            LDAPDebug (LDAP_DEBUG_ANY,
+                            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                             "ldbm_instance_post_delete_instance_entry_callback:"
                             " failed to generate db path: %s/%s\n",
                             inst_dirp, direntry->name, 0);
@@ -1201,7 +1201,7 @@ ldbm_instance_delete_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entr
     parse_ldbm_instance_entry(entryBefore, &instance_name);
     inst = ldbm_instance_find_by_name(li, instance_name);
     if (inst == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm: instance '%s' does not exist!\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm: instance '%s' does not exist!\n",
                   instance_name, 0, 0);
         if (returntext) {
             PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "No ldbm instance exists with the name '%s'\n",
@@ -1217,7 +1217,7 @@ ldbm_instance_delete_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entr
     /* check if some online task is happening */
     if ((instance_set_busy(inst) != 0) ||
         (slapi_counter_get_value(inst->inst_ref_count) > 0)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm: '%s' is in the middle of a task. "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm: '%s' is in the middle of a task. "
                   "Cancel the task or wait for it to finish, "
                   "then try again.\n", instance_name, 0, 0);
         if (returntext) {
@@ -1233,7 +1233,7 @@ ldbm_instance_delete_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entr
     }
 
     /* okay, we're gonna delete this database instance.  take it offline. */
-    LDAPDebug(LDAP_DEBUG_ANY, "ldbm: Bringing %s offline...\n",
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm: Bringing %s offline...\n",
               instance_name, 0, 0);
     slapi_mtn_be_stopping(inst->inst_be);
     dblayer_instance_close(inst->inst_be);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modify.c b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
index 34d9861..1398797 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modify.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modify.c
@@ -88,7 +88,7 @@ int modify_switch_entries(modify_context *mc,backend *be)
 	if (mc->old_entry && mc->new_entry) {
 		ret = cache_replace(&(inst->inst_cache), mc->old_entry, mc->new_entry);
 		if (ret) {
-			LDAPDebug(LDAP_DEBUG_CACHE, "modify_switch_entries: replacing %s with %s failed (%d)\n",
+			LDAPDebug(LDAP_DEBUG_CACHE, LOG_DEBUG, "modify_switch_entries: replacing %s with %s failed (%d)\n",
 			          slapi_entry_get_dn(mc->old_entry->ep_entry), 
 			          slapi_entry_get_dn(mc->new_entry->ep_entry), ret);
 		}
@@ -133,7 +133,7 @@ modify_unswitch_entries(modify_context *mc,backend *be)
 			cache_unlock_entry(&inst->inst_cache, mc->new_entry);
 			cache_lock_entry(&inst->inst_cache, mc->old_entry);
 		} else {
-			LDAPDebug(LDAP_DEBUG_CACHE, "modify_unswitch_entries: replacing %s with %s failed (%d)\n",
+			LDAPDebug(LDAP_DEBUG_CACHE, LOG_DEBUG, "modify_unswitch_entries: replacing %s with %s failed (%d)\n",
 			          slapi_entry_get_dn(mc->old_entry->ep_entry), 
 			          slapi_entry_get_dn(mc->new_entry->ep_entry), ret);
 		}
@@ -708,7 +708,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
 			continue;
 		}
 		if (0 != retval) {
-			LDAPDebug( LDAP_DEBUG_ANY, "id2entry_add failed, err=%d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "id2entry_add failed, err=%d %s\n",
 				   retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
 			if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
 			MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
@@ -721,7 +721,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
 			continue;
 		}
 		if (0 != retval) {
-			LDAPDebug( LDAP_DEBUG_ANY, "index_add_mods failed, err=%d %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "index_add_mods failed, err=%d %s\n",
 				  retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
 			if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
 			MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
@@ -740,7 +740,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
 				continue;
 			}
 			if (0 != retval) {
-				LDAPDebug( LDAP_DEBUG_ANY, 
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 					"vlv_update_index failed, err=%d %s\n",
 					retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
 				if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
@@ -754,7 +754,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
 		if (!is_ruv && !is_fixup_operation && !NO_RUV_UPDATE(li)) {
 			ruv_c_init = ldbm_txn_ruv_modify_context( pb, &ruv_c );
 			if (-1 == ruv_c_init) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"ldbm_back_modify: ldbm_txn_ruv_modify_context "
 					"failed to construct RUV modify context\n",
 					0, 0, 0);
@@ -771,7 +771,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
 				continue;
 			}
 			if (0 != retval) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"modify_update_all failed, err=%d %s\n", retval,
 					(msg = dblayer_strerror( retval )) ? msg : "", 0 );
 				if (LDBM_OS_ERR_IS_DISKFULL(retval))
@@ -786,7 +786,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
 		}
 	}
 	if (retry_count == RETRY_TIMES) {
-		LDAPDebug( LDAP_DEBUG_ANY, "Retry count exceeded in modify\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Retry count exceeded in modify\n", 0, 0, 0 );
 	   	ldap_result_code= LDAP_BUSY;
 		goto error_return;
 	}
@@ -794,7 +794,7 @@ ldbm_back_modify( Slapi_PBlock *pb )
 	if (ruv_c_init) {
 		if (modify_switch_entries(&ruv_c, be) != 0 ) {
 			ldap_result_code= LDAP_OPERATIONS_ERROR;
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"ldbm_back_modify: modify_switch_entries failed\n", 0, 0, 0);
 			goto error_return;
 		}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
index 2af1f3a..413de52 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
@@ -586,7 +586,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                         CACHE_RETURN( &inst->inst_cache, &ancestorentry );
                         ldap_result_matcheddn= slapi_ch_strdup((char *) slapi_sdn_get_dn(&ancestorsdn));
                         ldap_result_code= LDAP_NO_SUCH_OBJECT;
-                        LDAPDebug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: New superior "
+                        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm_back_modrdn: New superior "
                                     "does not exist matched %s, newsuperior = %s\n", 
                                     ldap_result_matcheddn == NULL ? "NULL" :
                                     ldap_result_matcheddn,
@@ -603,7 +603,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                     ldap_result_code = plugin_call_acl_plugin(pb, newparententry->ep_entry, NULL, NULL, SLAPI_ACL_MODDN, ACLPLUGIN_ACCESS_DEFAULT, &errbuf);
                     if (ldap_result_code != LDAP_SUCCESS) {
                             ldap_result_message = errbuf;
-                            LDAPDebug(LDAP_DEBUG_TRACE, "No 'moddn' access to new superior.\n", 0, 0, 0);
+                            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "No 'moddn' access to new superior.\n", 0, 0, 0);
                             goto error_return;
                     }
                 } else {
@@ -611,7 +611,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                     ldap_result_code = plugin_call_acl_plugin (pb, newparententry->ep_entry, NULL, NULL, SLAPI_ACL_ADD, ACLPLUGIN_ACCESS_DEFAULT, &errbuf );
                     if (ldap_result_code != LDAP_SUCCESS) {
                                 ldap_result_message = errbuf;
-                                LDAPDebug(LDAP_DEBUG_TRACE, "No 'add' access to new superior.\n", 0, 0, 0);
+                                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "No 'add' access to new superior.\n", 0, 0, 0);
                                 goto error_return;
                         }
                 }
@@ -626,7 +626,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                     /* Here means that we didn't find the parent */
                     ldap_result_matcheddn = "NULL";
                     ldap_result_code= LDAP_NO_SUCH_OBJECT;
-                    LDAPDebug( LDAP_DEBUG_TRACE, "Parent does not exist matched %s, parentdn = %s\n", 
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Parent does not exist matched %s, parentdn = %s\n", 
                         ldap_result_matcheddn, slapi_sdn_get_ndn(&dn_parentdn), 0 );
                     goto error_return;
                 }
@@ -687,7 +687,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                 slapi_entry_delete_string(ec->ep_entry, SLAPI_ATTR_OBJECTCLASS, SLAPI_ATTR_VALUE_TOMBSTONE);
                 /* Now also remove the nscpEntryDN */
                 if (slapi_entry_attr_delete(ec->ep_entry, SLAPI_ATTR_NSCP_ENTRYDN) != 0){
-                    LDAPDebug(LDAP_DEBUG_REPL, "Resurrection of %s - Couldn't remove %s\n", 
+                    LDAPDebug(LDAP_DEBUG_REPL, LOG_DEBUG, "Resurrection of %s - Couldn't remove %s\n", 
                               slapi_entry_get_dn(ec->ep_entry), SLAPI_ATTR_NSCP_ENTRYDN, 0);
                 }
                 
@@ -808,7 +808,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
             if ( entry_apply_mods( ec->ep_entry, slapi_mods_get_ldapmods_byref(&smods_generated) ) != 0 )
             {
                 ldap_result_code= LDAP_OPERATIONS_ERROR;
-                LDAPDebug( LDAP_DEBUG_TRACE, "ldbm_modrdn: entry_apply_mods failed for entry %s\n",
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm_modrdn: entry_apply_mods failed for entry %s\n",
                            slapi_entry_get_dn_const(ec->ep_entry), 0, 0);
                 goto error_return;
             }
@@ -821,7 +821,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                 if (entry_apply_mods_wsi(ec->ep_entry, &smods_generated_wsi, operation_get_csn(operation), is_replicated_operation)!=0)
                 {
                     ldap_result_code= LDAP_OPERATIONS_ERROR;
-                    LDAPDebug( LDAP_DEBUG_TRACE, "ldbm_modrdn: entry_apply_mods_wsi failed for entry %s\n",
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm_modrdn: entry_apply_mods_wsi failed for entry %s\n",
                                slapi_entry_get_dn_const(ec->ep_entry), 0, 0);
                     goto error_return;
                 }
@@ -839,7 +839,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                 if (entry_apply_mods_wsi(ec->ep_entry, &smods_operation_wsi, operation_get_csn(operation), is_replicated_operation)!=0)
                 {
                     ldap_result_code= LDAP_OPERATIONS_ERROR;
-                    LDAPDebug( LDAP_DEBUG_TRACE, "ldbm_modrdn: entry_apply_mods_wsi (operational attributes) failed for entry %s\n",
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm_modrdn: entry_apply_mods_wsi (operational attributes) failed for entry %s\n",
                                slapi_entry_get_dn_const(ec->ep_entry), 0, 0);
                     goto error_return;
                 }
@@ -939,7 +939,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                                 }
                             }
                         }
-                        LDAPDebug(LDAP_DEBUG_ANY, "parent_update_on_childchange parent %s of %s numsub=%d\n",
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "parent_update_on_childchange parent %s of %s numsub=%d\n",
                                   slapi_entry_get_dn_const(parent_modify_context.old_entry->ep_entry),
                                   slapi_entry_get_dn_const(e->ep_entry), sub_count);
 #endif
@@ -1016,7 +1016,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
         }
         if (retval)
         {
-            LDAPDebug(LDAP_DEBUG_ANY, "modrdn_rename_entry_update_indexes %s --> %s failed, err=%d\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "modrdn_rename_entry_update_indexes %s --> %s failed, err=%d\n",
                       slapi_entry_get_dn(e->ep_entry), slapi_entry_get_dn(ec->ep_entry), retval);
             if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
             MOD_SET_ERROR(ldap_result_code, LDAP_OPERATIONS_ERROR, retry_count);
@@ -1039,7 +1039,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                     memset(&sv,0,sizeof(Slapi_Value));
                     if ( slapi_rdn2typeval( rdns[i], &type, &sv.bv ) != 0 ) 
                     {
-                        LDAPDebug( LDAP_DEBUG_ANY, "modrdn: rdn2typeval (%s) failed\n",
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "modrdn: rdn2typeval (%s) failed\n",
                                     rdns[i], 0, 0 );
                         if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
                         MOD_SET_ERROR(ldap_result_code, 
@@ -1056,7 +1056,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                     }
                     else if (retval != 0 )
                     {
-                        LDAPDebug( LDAP_DEBUG_ANY, "modrdn: could not add new value to index, err=%d %s\n",
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "modrdn: could not add new value to index, err=%d %s\n",
                                    retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
                         if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
                         MOD_SET_ERROR(ldap_result_code, 
@@ -1083,7 +1083,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
             }
             else if (0 != retval)
             {
-                LDAPDebug( LDAP_DEBUG_ANY, "modrdn: "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "modrdn: "
                            "could not update parent, err=%d %s\n", retval,
                            (msg = dblayer_strerror( retval )) ? msg : "", 0 );
                 if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;
@@ -1105,7 +1105,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                 }
                 if (0 != retval)
                 {
-                    LDAPDebug( LDAP_DEBUG_ANY, "modrdn: "
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "modrdn: "
                                "could not update parent, err=%d %s\n", retval,
                                (msg = dblayer_strerror( retval )) ? msg : "",
                                0 );
@@ -1179,7 +1179,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
         if (!is_ruv && !is_fixup_operation && !NO_RUV_UPDATE(li)) {
             ruv_c_init = ldbm_txn_ruv_modify_context( pb, &ruv_c );
             if (-1 == ruv_c_init) {
-                LDAPDebug( LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "ldbm_back_modrdn: ldbm_txn_ruv_modify_context "
                     "failed to construct RUV modify context\n",
                     0, 0, 0);
@@ -1196,7 +1196,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
                 continue;
             }
             if (0 != retval) {
-                LDAPDebug( LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "modify_update_all failed, err=%d %s\n", retval,
                     (msg = dblayer_strerror( retval )) ? msg : "", 0 );
                 if (LDBM_OS_ERR_IS_DISKFULL(retval)) {
@@ -1212,7 +1212,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
     if (retry_count == RETRY_TIMES)
     {
         /* Failed */
-        LDAPDebug( LDAP_DEBUG_ANY, "Retry count exceeded in modrdn\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Retry count exceeded in modrdn\n", 0, 0, 0 );
         ldap_result_code= LDAP_BUSY;
         goto error_return;
     }
@@ -1310,7 +1310,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
     if (ruv_c_init) {
         if (modify_switch_entries(&ruv_c, be) != 0 ) {
             ldap_result_code= LDAP_OPERATIONS_ERROR;
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "ldbm_back_modrdn: modify_switch_entries failed\n", 0, 0, 0);
             goto error_return;
         }
@@ -1736,7 +1736,7 @@ moddn_newrdn_mods(Slapi_PBlock *pb, const char *olddn, struct backentry *ec, Sla
     
     if ( baddn || badrdn )
     {
-        LDAPDebug( LDAP_DEBUG_TRACE, "moddn_newrdn_mods failed: olddn=%s baddn=%d badrdn=%d\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "moddn_newrdn_mods failed: olddn=%s baddn=%d badrdn=%d\n",
                    olddn, baddn, badrdn);
         return LDAP_OPERATIONS_ERROR;
     }
@@ -1766,7 +1766,7 @@ moddn_newrdn_mods(Slapi_PBlock *pb, const char *olddn, struct backentry *ec, Sla
     }
     else
     {
-        LDAPDebug( LDAP_DEBUG_TRACE, "moddn_newrdn_mods failed: could not parse new rdn %s\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "moddn_newrdn_mods failed: could not parse new rdn %s\n",
                    newrdn, 0, 0);
         return LDAP_OPERATIONS_ERROR;
     }
@@ -1817,7 +1817,7 @@ modrdn_rename_entry_update_indexes(back_txn *ptxn, Slapi_PBlock *pb, struct ldbm
      */
     retval = id2entry_add_ext(be, *ec, ptxn, 1, &cache_rc);
     if (cache_rc) {
-        LDAPDebug(LDAP_DEBUG_CACHE,
+        LDAPDebug(LDAP_DEBUG_CACHE, LOG_DEBUG,
                   "modrdn_rename_entry_update_indexes: adding %s failed to add to the cache (rc: %d, cache_rc: %d)\n",
                   slapi_entry_get_dn(e->ep_entry), retval, cache_rc);
     }
@@ -1829,7 +1829,7 @@ modrdn_rename_entry_update_indexes(back_txn *ptxn, Slapi_PBlock *pb, struct ldbm
     }
     if (retval != 0)
     {
-        LDAPDebug( LDAP_DEBUG_ANY, "modrdn_rename_entry_update_indexes: id2entry_add failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "modrdn_rename_entry_update_indexes: id2entry_add failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
         goto error_return;
     }
     if(smods1!=NULL && slapi_mods_get_num_mods(smods1)>0)
@@ -1846,7 +1846,7 @@ modrdn_rename_entry_update_indexes(back_txn *ptxn, Slapi_PBlock *pb, struct ldbm
         }
         if (retval != 0)
         {
-            LDAPDebug( LDAP_DEBUG_TRACE, "index_add_mods 1 failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "index_add_mods 1 failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
             goto error_return;
         }
     }
@@ -1870,7 +1870,7 @@ modrdn_rename_entry_update_indexes(back_txn *ptxn, Slapi_PBlock *pb, struct ldbm
         }
         if (retval != 0)
         {
-            LDAPDebug( LDAP_DEBUG_TRACE, "index_add_mods 2 failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "index_add_mods 2 failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
             goto error_return;
         }
     }
@@ -1888,7 +1888,7 @@ modrdn_rename_entry_update_indexes(back_txn *ptxn, Slapi_PBlock *pb, struct ldbm
         }
         if (retval != 0)
         {
-            LDAPDebug( LDAP_DEBUG_TRACE, "index_add_mods 3 failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "index_add_mods 3 failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
             goto error_return;
         }
     }
@@ -1908,7 +1908,7 @@ modrdn_rename_entry_update_indexes(back_txn *ptxn, Slapi_PBlock *pb, struct ldbm
         }
         if (retval != 0)
         {
-            LDAPDebug( LDAP_DEBUG_TRACE, "vlv_update_all_indexes failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "vlv_update_all_indexes failed, err=%d %s\n", retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
             goto error_return;
         }
     }
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
index cda1714..3a1eecc 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
@@ -257,12 +257,12 @@ ldbm_search_compile_filter(Slapi_Filter *f, void *arg)
         p = bigpat ? bigpat : pat;
         re = slapi_re_comp(p, &re_result);
         if (NULL == re) {
-            LDAPDebug(LDAP_DEBUG_ANY, "ldbm_search_compile_filter: re_comp (%s) failed (%s): %s\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_search_compile_filter: re_comp (%s) failed (%s): %s\n",
                       pat, p, re_result?re_result:"unknown" );
             rc = SLAPI_FILTER_SCAN_ERROR;
         } else {
             char ebuf[BUFSIZ];
-            LDAPDebug(LDAP_DEBUG_TRACE, "ldbm_search_compile_filter: re_comp (%s)\n",
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm_search_compile_filter: re_comp (%s)\n",
                       escape_string(p, ebuf), 0, 0);
             f->f_un.f_un_sub.sf_private = (void *)re;
         }
@@ -406,7 +406,7 @@ ldbm_back_search( Slapi_PBlock *pb )
                     slapi_pblock_get(pb, SLAPI_CONN_ID, &conn_id);
                     slapi_pblock_get(pb, SLAPI_OPERATION_ID, &op_id);
 
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                             "Warning: Sort control ignored for conn=%d op=%d\n",
                             conn_id, op_id, 0);                    
                 }
@@ -441,7 +441,7 @@ ldbm_back_search( Slapi_PBlock *pb )
                         slapi_pblock_get(pb, SLAPI_CONN_ID, &conn_id);
                         slapi_pblock_get(pb, SLAPI_OPERATION_ID, &op_id);
 
-                        LDAPDebug(LDAP_DEBUG_ANY,
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                 "Warning: VLV control ignored for conn=%d op=%d\n",
                                 conn_id, op_id, 0);             
                     }
@@ -511,7 +511,7 @@ ldbm_back_search( Slapi_PBlock *pb )
 
         if (print_once)
         {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "ERROR: %s "
                     "when more than one backend is involved. "
                     "VLV indexes that will never be used should be removed.\n",
@@ -1021,7 +1021,7 @@ build_candidate_list( Slapi_PBlock *pb, backend *be, struct backentry *e,
         r = SLAPI_FAIL_GENERAL;
     }
     if ( 0 != err && DB_NOTFOUND != err ) {
-        LDAPDebug( LDAP_DEBUG_ANY, "database error %d\n", err, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "database error %d\n", err, 0, 0 );
         slapi_send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL, NULL,
                     0, NULL );
         if (LDBM_OS_ERR_IS_DISKFULL(err)) r = return_on_disk_full(li);
@@ -1044,7 +1044,7 @@ bail:
         }
     }
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "candidate list has %lu ids\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "candidate list has %lu ids\n",
                   *candidates ? (*candidates)->b_nids : 0L, 0, 0);
 
     return r;
@@ -1632,7 +1632,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
         {
             if ( err != 0 && err != DB_NOTFOUND )
             {
-                LDAPDebug( LDAP_DEBUG_ANY, "next_search_entry db err %d\n", err, 0, 0 );
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "next_search_entry db err %d\n", err, 0, 0 );
                 if (LDBM_OS_ERR_IS_DISKFULL(err))
                 {
                     /* disk full in the middle of returning search results
@@ -1643,7 +1643,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
                     goto bail;
                 }
             }
-            LDAPDebug( LDAP_DEBUG_ARGS, "candidate %lu not found\n", (u_long)id, 0, 0 );
+            LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "candidate %lu not found\n", (u_long)id, 0, 0 );
             if ( err == DB_NOTFOUND )
             {
                 /* Since we didn't really look at this entry, we should
@@ -1670,7 +1670,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
             Slapi_Value **refs= attr_get_present_values(attr);
             if ( refs == NULL || refs[0] == NULL )
             {
-                LDAPDebug( LDAP_DEBUG_ANY, "null ref in (%s)\n", backentry_get_ndn(e), 0, 0 );
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "null ref in (%s)\n", backentry_get_ndn(e), 0, 0 );
             }
             else if ( slapi_sdn_scope_test( backentry_get_sdn(e), basesdn, scope ))
             {
@@ -1721,7 +1721,7 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
             /* it's a regular entry, check if it matches the filter, and passes the ACL check */
              if ( 0 != ( sr->sr_flags & SR_FLAG_CAN_SKIP_FILTER_TEST )) {
                   /* Since we do access control checking in the filter test (?Why?) we need to check access now */
-                  LDAPDebug( LDAP_DEBUG_FILTER, "Bypassing filter test\n", 0, 0, 0 );
+                  LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "Bypassing filter test\n", 0, 0, 0 );
                   if ( ACL_CHECK_FLAG ) {
                       filter_test = slapi_vattr_filter_test_ext( pb, e->ep_entry, filter, ACL_CHECK_FLAG, 1 /* Only perform access checking, thank you */);
                   } else {
@@ -1730,12 +1730,12 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
                   if (li->li_filter_bypass_check) {
                       int    ft_rc;
   
-                      LDAPDebug( LDAP_DEBUG_FILTER, "Checking bypass\n", 0, 0, 0 );
+                      LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "Checking bypass\n", 0, 0, 0 );
                       ft_rc = slapi_vattr_filter_test( pb, e->ep_entry, filter,
                               ACL_CHECK_FLAG );
                       if (filter_test != ft_rc) {
                           /* Oops ! This means that we thought we could bypass the filter test, but noooo... */
-                          LDAPDebug( LDAP_DEBUG_ANY, "Filter bypass ERROR on entry %s\n", backentry_get_ndn(e), 0, 0 );
+                          LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Filter bypass ERROR on entry %s\n", backentry_get_ndn(e), 0, 0 );
                           filter_test = ft_rc; /* Fix the error */
                       }
                   }
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index 7aae93d..855277e 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -663,7 +663,7 @@ int ldbm_back_ldif2ldbm( Slapi_PBlock *pb )
                                   0 /* use single thread mode */);
         slapi_sdn_free (&sdn);
         if (rc != UID_SUCCESS) {
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                        "Fatal Error---Failed to initialize uniqueid generator; error = %d. "
                        "Exiting now.\n", rc, 0, 0 );
             return -1;
@@ -676,7 +676,7 @@ int ldbm_back_ldif2ldbm( Slapi_PBlock *pb )
     /* Find the instance that the ldif2db will be done on. */
     inst = ldbm_instance_find_by_name(li, instance_name);
     if (NULL == inst) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Unknown ldbm instance %s\n", instance_name,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Unknown ldbm instance %s\n", instance_name,
                   0, 0);
         return -1;
     }
@@ -684,7 +684,7 @@ int ldbm_back_ldif2ldbm( Slapi_PBlock *pb )
     /* check if an import/restore is already ongoing... */
     if ((instance_set_busy(inst) != 0) ||
         (slapi_counter_get_value(inst->inst_ref_count) > 0)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm: '%s' is already in the middle of "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm: '%s' is already in the middle of "
                   "another task and cannot be disturbed.\n",
                   inst->inst_name, 0, 0);
         return -1;
@@ -702,7 +702,7 @@ int ldbm_back_ldif2ldbm( Slapi_PBlock *pb )
 
     if (! (task_flags & SLAPI_TASK_RUNNING_FROM_COMMANDLINE)) {
         /* shutdown this instance of the db */
-        LDAPDebug(LDAP_DEBUG_ANY, "Bringing %s offline...\n", 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Bringing %s offline...\n", 
                   instance_name, 0, 0);
         slapi_mtn_be_disable(inst->inst_be);
 
@@ -740,17 +740,17 @@ int ldbm_back_ldif2ldbm( Slapi_PBlock *pb )
 
         if (0 != (ret = dblayer_start(li, DBLAYER_IMPORT_MODE)) ) {
             if (LDBM_OS_ERR_IS_DISKFULL(ret)) {
-                LDAPDebug(LDAP_DEBUG_ANY, "ERROR: Failed to init database.  "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: Failed to init database.  "
                           "There is either insufficient disk space or "
                           "insufficient memory available to initialize the "
                           "database.\n", 0, 0, 0);
-                LDAPDebug(LDAP_DEBUG_ANY,"Please check that\n"
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Please check that\n"
                           "1) disks are not full,\n"
                           "2) no file exceeds the file size limit,\n"
                           "3) the configured dbcachesize is not too large for the available memory on this machine.\n",
                                                   0, 0, 0);
             } else {
-                LDAPDebug(LDAP_DEBUG_ANY, "ERROR: Failed to init database "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: Failed to init database "
                           "(error %d: %s)\n", ret, dblayer_strerror(ret), 0);
             }
             goto fail;
@@ -925,7 +925,7 @@ static IDList *ldbm_fetch_subtrees(backend *be, char **include, int *err)
                     id, entryrdn_get_noancestorid()?"entryrdn":"ancestorid");
                 *err = 0; /* not a problem */
             } else {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "warning: %s not indexed on %lu\n",
                     entryrdn_get_noancestorid()?"entryrdn":"ancestorid",
                     id, 0);
@@ -994,7 +994,7 @@ export_one_entry(struct ldbminfo *li,
         /* Decrypt in place */
         rc = attrcrypt_decrypt_entry(be, expargs->ep);
         if (rc) {
-            LDAPDebug(LDAP_DEBUG_ANY,"Failed to decrypt entry [%s] : %d\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Failed to decrypt entry [%s] : %d\n",
                       slapi_sdn_get_dn(&expargs->ep->ep_entry->e_sdn), rc, 0);
         }
     }
@@ -1056,7 +1056,7 @@ export_one_entry(struct ldbminfo *li,
                             "%s: Processed %d entries (%d%%).",
                             inst->inst_name, *expargs->cnt, percent);
         }
-        LDAPDebug(LDAP_DEBUG_ANY, "export %s: Processed %d entries (%d%%).\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "export %s: Processed %d entries (%d%%).\n",
                                   inst->inst_name, *expargs->cnt, percent);
         *expargs->lastcnt = *expargs->cnt;
     }
@@ -1115,7 +1115,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
     int              server_running;
     export_args      eargs = {0};
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> ldbm_back_ldbm2ldif\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldbm_back_ldbm2ldif\n", 0, 0, 0 );
 
     slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li );
     slapi_pblock_get( pb, SLAPI_TASK_FLAGS, &task_flags );
@@ -1147,7 +1147,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
     if (run_from_cmdline && li->li_dblayer_private->dblayer_private_mem
         && server_running)
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
              "Cannot export the database while the server is running and "
              "nsslapd-db-private-mem option is used, "
              "please use ldif2db.pl\n", 0, 0, 0);
@@ -1162,7 +1162,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
         slapi_pblock_get(pb, SLAPI_BACKEND_INSTANCE_NAME, &instance_name);
         inst = ldbm_instance_find_by_name(li, instance_name);
         if (NULL == inst) {
-            LDAPDebug(LDAP_DEBUG_ANY, "Unknown ldbm instance %s\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Unknown ldbm instance %s\n",
                           instance_name, 0, 0);
             return_value = -1;
             goto bye;
@@ -1170,7 +1170,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
         /* [605974] command db2ldif should not be able to run when on-line 
          * import is running */
         if (dblayer_in_import(inst)) {
-            LDAPDebug(LDAP_DEBUG_ANY, "instance %s is busy\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "instance %s is busy\n",
                           instance_name, 0, 0);
             return_value = -1;
             goto bye;
@@ -1195,7 +1195,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
 
         /* check if an import/restore is already ongoing... */
         if (instance_set_busy(inst) != 0) {
-            LDAPDebug(LDAP_DEBUG_ANY, "ldbm: '%s' is already in the middle"
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm: '%s' is already in the middle"
                     " of another task and cannot be disturbed.\n",
                     inst->inst_name, 0, 0);
             return_value = LDBM2LDIF_BUSY;
@@ -1239,7 +1239,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
         options |= SLAPI_DUMP_STATEINFO;
 
     if (fname == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "db2ldif: no LDIF filename supplied\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db2ldif: no LDIF filename supplied\n",
                       0, 0, 0);
         return_value = -1;
         goto bye;
@@ -1260,7 +1260,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
                     SLAPD_DEFAULT_FILE_MODE);
         }
         if (fd < 0) {
-            LDAPDebug(LDAP_DEBUG_ANY, "db2ldif: can't open %s: %d (%s)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db2ldif: can't open %s: %d (%s)\n",
                   fname, errno, dblayer_strerror(errno));
             return_value = -1;
             goto bye;
@@ -1271,14 +1271,14 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
 
     if ( we_start_the_backends )  {
         if (0 != dblayer_start(li,DBLAYER_EXPORT_MODE)) {
-            LDAPDebug( LDAP_DEBUG_ANY, "db2ldif: Failed to init database\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db2ldif: Failed to init database\n",
                 0, 0, 0 );
             return_value = -1;
             goto bye;
         }
         /* dblayer_instance_start will init the id2entry index. */
         if (0 != dblayer_instance_start(be, DBLAYER_EXPORT_MODE)) {
-            LDAPDebug(LDAP_DEBUG_ANY, "db2ldif: Failed to init instance\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db2ldif: Failed to init instance\n",
                 0, 0, 0);
             return_value = -1;
             goto bye;
@@ -1290,7 +1290,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
         get_ids_from_disk(be);
 
     if ((( dblayer_get_id2entry( be, &db )) != 0) || (db == NULL)) {
-        LDAPDebug( LDAP_DEBUG_ANY, "Could not open/create id2entry\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Could not open/create id2entry\n",
             0, 0, 0 );
         return_value = -1;
         goto bye;
@@ -1407,7 +1407,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
                 if (return_value != DB_LOCK_DEADLOCK) break;
             }
             if (return_value) {
-                LDAPDebug(LDAP_DEBUG_ANY, "db2ldif: failed to read "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db2ldif: failed to read "
                       "entry %lu, err %d\n", (u_long)idl->b_ids[idindex],
                       return_value, 0);
                     return_value = -1;
@@ -1603,7 +1603,7 @@ ldbm_back_ldbm2ldif( Slapi_PBlock *pb )
                     "%s: Processed %d entries (100%%).",
                     inst->inst_name, cnt);
         }
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "export %s: Processed %d entries (100%%).\n",
                       inst->inst_name, cnt, 0);
     }
@@ -1621,7 +1621,7 @@ bye:
         close(fd);
     }
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= ldbm_back_ldbm2ldif\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldbm_back_ldbm2ldif\n", 0, 0, 0 );
 
     if (we_start_the_backends && NULL != li) {
         if (0 != dblayer_flush(li)) {
@@ -1659,9 +1659,9 @@ static void ldbm2index_bad_vlv(Slapi_Task *task, ldbm_instance *inst,
         slapi_task_log_notice(task, "%s: Known VLV indexes are: %s",
                               inst->inst_name, text);
     }
-    LDAPDebug(LDAP_DEBUG_ANY,
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "ldbm2index: Unknown VLV Index named '%s'\n", index, 0, 0);
-    LDAPDebug(LDAP_DEBUG_ANY,
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "ldbm2index: Known VLV Indexes are: %s\n", text, 0, 0);
     slapi_ch_free_string(&text);
 }
@@ -1705,7 +1705,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
     Slapi_Value      **nstombstone_vals = NULL;
     int              istombstone = 0;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> ldbm_back_ldbm2index\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldbm_back_ldbm2index\n", 0, 0, 0 );
     if ( g_get_shutdown() || c_get_shutdown() ) {
         return return_value;
     }
@@ -1728,7 +1728,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
             slapi_task_log_notice(task, "Unknown ldbm instance %s",
                                   instance_name);
         }
-        LDAPDebug(LDAP_DEBUG_ANY, "Unknown ldbm instance %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Unknown ldbm instance %s\n",
                   instance_name, 0, 0);
         return return_value;
     }
@@ -1743,14 +1743,14 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
         ldbm_config_internal_set(li, CONFIG_DB_TRANSACTION_LOGGING, "off");
 
         if (0 != dblayer_start(li,DBLAYER_INDEX_MODE)) {
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                        "ldbm2index: Failed to init database\n", 0, 0, 0 );
             return return_value;
         }
 
         /* dblayer_instance_start will init the id2entry index. */
         if (0 != dblayer_instance_start(be, DBLAYER_INDEX_MODE)) {
-            LDAPDebug(LDAP_DEBUG_ANY, "db2ldif: Failed to init instance\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "db2ldif: Failed to init instance\n",
                       0, 0, 0);
             return return_value;
         }
@@ -1761,14 +1761,14 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
 
     /* make sure no other tasks are going, and set the backend readonly */
     if (instance_set_busy_and_readonly(inst) != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ldbm: '%s' is already in the middle of "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm: '%s' is already in the middle of "
                   "another task and cannot be disturbed.\n",
                   inst->inst_name, 0, 0);
         return return_value;
     }
 
     if ((( dblayer_get_id2entry( be, &db )) != 0 ) || (db == NULL)) {
-        LDAPDebug( LDAP_DEBUG_ANY, "Could not open/create id2entry\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Could not open/create id2entry\n",
                    0, 0, 0 );
         goto err_min;
     }
@@ -1776,7 +1776,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
     /* get a cursor to we can walk over the table */
     rc = db->cursor(db, NULL, &dbc, 0);
     if (0 != rc) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "Failed to get cursor for ldbm2index\n", 0, 0, 0 );
         goto err_min;
     }
@@ -1794,7 +1794,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
         slapi_ch_free(&(data.data));
         isfirst = 1;
     } else {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Failed to seek within id2entry (BAD %d)\n", 
                   return_value, 0 ,0);
         goto err_out;
@@ -1845,7 +1845,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                                 inst->inst_name, LDBM_ENTRYRDN_STR,
                                 CONFIG_ENTRYRDN_SWITCH);
                         }
-                        LDAPDebug(LDAP_DEBUG_ANY, 
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                                 "%s: Requested to index %s, but %s is off\n",
                                 inst->inst_name, LDBM_ENTRYRDN_STR,
                                 CONFIG_ENTRYRDN_SWITCH);
@@ -1859,7 +1859,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                                 inst->inst_name, LDBM_ENTRYDN_STR,
                                 CONFIG_ENTRYRDN_SWITCH);
                         }
-                        LDAPDebug(LDAP_DEBUG_ANY,
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                 "%s: Requested to index %s, but %s is on\n",
                                 inst->inst_name, LDBM_ENTRYDN_STR,
                                 CONFIG_ENTRYRDN_SWITCH);
@@ -1941,7 +1941,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
         if (! idl) {
             /* most likely, indexes are bad if err is set. */
             if (0 != err) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "%s: WARNING: Failed to fetch subtree lists: (%d) %s\n",
                       inst->inst_name, err, dblayer_strerror(err));
                 LDAPDebug1Arg(LDAP_DEBUG_ANY,
@@ -1984,7 +1984,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
 
             rc = db->get(db, NULL, &key, &data, 0);
             if (rc) {
-                LDAPDebug(LDAP_DEBUG_ANY, "%s: Failed "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: Failed "
                           "to read database, errno=%d (%s)\n",
                           inst->inst_name, rc, dblayer_strerror(rc));
                 if (task) {
@@ -2009,7 +2009,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
             if (DB_NOTFOUND == rc) {
                 break;
             } else if (0 != rc) {
-                LDAPDebug(LDAP_DEBUG_ANY, "%s: Failed to read database, "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: Failed to read database, "
                               "errno=%d (%s)\n", inst->inst_name, rc,
                               dblayer_strerror(rc));
                 if (task) {
@@ -2107,7 +2107,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                                 if (rc) {
                                     LDAPDebug1Arg(LDAP_DEBUG_ANY,
                                         "ldbm2index: Skip ID %d\n", pid);
-                                    LDAPDebug(LDAP_DEBUG_ANY,
+                                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                         "Parent entry (ID %d) of entry. "
                                         "(ID %d, rdn: %s) does not exist.\n",
                                         pid, temp_id, rdn);
@@ -2174,7 +2174,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                     "%s: WARNING: skipping badly formatted entry (id %lu)",
                     inst->inst_name, (u_long)temp_id);
             }
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "%s: WARNING: skipping badly formatted entry (id %lu)\n",
                       inst->inst_name, (u_long)temp_id, 0);
             backentry_free( &ep );
@@ -2285,11 +2285,11 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                         if (!run_from_cmdline) {
                             rc = dblayer_txn_begin(be, NULL, &txn);
                             if (0 != rc) {
-                                LDAPDebug(LDAP_DEBUG_ANY,
+                                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                     "%s: ERROR: failed to begin txn for update "
                                     "index '%s'\n",
                                     inst->inst_name, indexAttrs[j], 0);
-                                LDAPDebug(LDAP_DEBUG_ANY,
+                                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                     "%s: Error %d: %s\n", inst->inst_name, rc,
                                     dblayer_strerror(rc));
                                 if (task) {
@@ -2309,10 +2309,10 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                             rc = index_addordel_values_sv(be, indexAttrs[j], svals, NULL, ep->ep_id, BE_INDEX_ADD, &txn);
                         }
                         if (rc) {
-                            LDAPDebug(LDAP_DEBUG_ANY,
+                            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                 "%s: ERROR: failed to update index '%s'\n",
                                 inst->inst_name, indexAttrs[j], 0);
-                            LDAPDebug(LDAP_DEBUG_ANY,
+                            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                 "%s: Error %d: %s\n", inst->inst_name, rc,
                                 dblayer_strerror(rc));
                             if (task) {
@@ -2330,11 +2330,11 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                         if (!run_from_cmdline) {
                             rc = dblayer_txn_commit(be, &txn);
                             if (0 != rc) {
-                                LDAPDebug(LDAP_DEBUG_ANY,
+                                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                     "%s: ERROR: failed to commit txn for "
                                     "update index '%s'\n",
                                     inst->inst_name, indexAttrs[j], 0);
-                                LDAPDebug(LDAP_DEBUG_ANY,
+                                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                     "%s: Error %d: %s\n", inst->inst_name, rc,
                                     dblayer_strerror(rc));
                                 if (task) {
@@ -2369,10 +2369,10 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                 rc = dblayer_txn_begin(be, NULL, &txn);
                 if (0 != rc) {
 
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "%s: ERROR: failed to begin txn for update index '%s'\n",
                       inst->inst_name, ai, 0);
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                         "%s: Error %d: %s\n", inst->inst_name, rc,
                         dblayer_strerror(rc));
                     if (task) {
@@ -2396,10 +2396,10 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
             {
                 rc = dblayer_txn_commit(be, &txn);
                 if (0 != rc) {
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "%s: ERROR: failed to commit txn for update index '%s'\n",
                       inst->inst_name, ai, 0);
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                         "%s: Error %d: %s\n", inst->inst_name, rc,
                         dblayer_strerror(rc));
                     if (task) {
@@ -2420,10 +2420,10 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
         if (!entryrdn_get_noancestorid() && (index_ext & DB2INDEX_ANCESTORID)) {
             rc = ldbm_ancestorid_index_entry(be, ep, BE_INDEX_ADD, NULL);
             if (rc != 0) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "%s: ERROR: failed to update index 'ancestorid'\n",
                           inst->inst_name, 0, 0);
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "%s: Error %d: %s\n", inst->inst_name, rc,
                           dblayer_strerror(rc));
                 if (task) {
@@ -2445,7 +2445,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                                     "%s: ERROR: failed to begin txn for update "
                                     "index 'entryrdn'\n",
                                     inst->inst_name);
-                        LDAPDebug(LDAP_DEBUG_ANY, "%s: Error %d: %s\n", 
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: Error %d: %s\n", 
                                     inst->inst_name, rc, dblayer_strerror(rc));
                         if (task) {
                             slapi_task_log_notice(task,
@@ -2459,10 +2459,10 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                 }
                 rc = entryrdn_index_entry(be, ep, BE_INDEX_ADD, &txn);
                 if (rc) {
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                               "%s: ERROR: failed to update index 'entryrdn'\n",
                               inst->inst_name, 0, 0);
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                               "%s: Error %d: %s\n", inst->inst_name, rc,
                               dblayer_strerror(rc));
                     if (task) {
@@ -2484,7 +2484,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                                     "%s: ERROR: failed to commit txn for "
                                     "update index 'entryrdn'\n",
                                     inst->inst_name);
-                        LDAPDebug(LDAP_DEBUG_ANY, "%s: Error %d: %s\n",
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: Error %d: %s\n",
                                     inst->inst_name, rc, dblayer_strerror(rc));
                         if (task) {
                             slapi_task_log_notice(task,
@@ -2519,7 +2519,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
                 slapi_task_log_notice(task, "%s: Indexed %d entries (%d%%).",
                                       inst->inst_name, count, percent);
             }
-            LDAPDebug(LDAP_DEBUG_ANY, "%s: Indexed %d entries (%d%%).\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: Indexed %d entries (%d%%).\n",
                       inst->inst_name, count, percent);
         }
 
@@ -2546,7 +2546,7 @@ ldbm_back_ldbm2index(Slapi_PBlock *pb)
         slapi_task_log_notice(task, "%s: Finished indexing.",
                               inst->inst_name);
     }
-    LDAPDebug(LDAP_DEBUG_ANY, "%s: Finished indexing.\n",
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: Finished indexing.\n",
               inst->inst_name, 0, 0);
     return_value = 0; /* success */
 err_out:
@@ -2571,12 +2571,12 @@ err_min:
 
     if (run_from_cmdline) {
         if (0 != dblayer_flush(li)) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "%s: Failed to flush database\n", inst->inst_name, 0, 0);
         }
         dblayer_instance_close(be);
         if (0 != dblayer_close(li,DBLAYER_INDEX_MODE)) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "%s: Failed to close database\n", inst->inst_name, 0, 0);
         }
     }
@@ -2589,7 +2589,7 @@ err_min:
         slapi_ch_free((void **)&pvlv);
     }
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= ldbm_back_ldbm2index\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldbm_back_ldbm2index\n", 0, 0, 0 );
 
     return return_value;
 }
diff --git a/ldap/servers/slapd/back-ldbm/misc.c b/ldap/servers/slapd/back-ldbm/misc.c
index 516b32d..d43f411 100644
--- a/ldap/servers/slapd/back-ldbm/misc.c
+++ b/ldap/servers/slapd/back-ldbm/misc.c
@@ -24,7 +24,7 @@ void ldbm_nasty(const char* str, int c, int err)
     char buffer[200];
     if (err == DB_LOCK_DEADLOCK) {
         PR_snprintf(buffer,200,"%s WARNING %d",str,c);
-        LDAPDebug(LDAP_DEBUG_BACKLDBM,"%s, err=%d %s\n",
+        LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,"%s, err=%d %s\n",
                   buffer,err,(msg = dblayer_strerror( err )) ? msg : "");
    } else if (err == DB_RUNRECOVERY) {
         LDAPDebug2Args(LDAP_DEBUG_ANY, "FATAL ERROR at %s (%d); "
@@ -32,7 +32,7 @@ void ldbm_nasty(const char* str, int c, int err)
         exit(1);
     } else {
         PR_snprintf(buffer,200,"%s BAD %d",str,c);
-        LDAPDebug(LDAP_DEBUG_ANY, "%s, err=%d %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s, err=%d %s\n",
                   buffer, err, (msg = dblayer_strerror( err )) ? msg : "");
     }
 }
@@ -328,7 +328,7 @@ mkdir_p(char *dir, unsigned int mode)
             PR_Delete(dir);
             if (PR_SUCCESS != PR_MkDir(dir, mode))
             {
-                LDAPDebug(LDAP_DEBUG_ANY, "mkdir_p %s: error %d (%s)\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "mkdir_p %s: error %d (%s)\n",
                     dir, PR_GetError(),slapd_pr_strerror(PR_GetError()));
                 return -1;
             }
@@ -364,7 +364,7 @@ mkdir_p(char *dir, unsigned int mode)
             return rval;
         if (PR_SUCCESS != PR_MkDir(dir, mode))
         {
-            LDAPDebug(LDAP_DEBUG_ANY, "mkdir_p %s: error %d (%s)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "mkdir_p %s: error %d (%s)\n",
                     dir, PR_GetError(),slapd_pr_strerror(PR_GetError()));
             return -1;
         }
@@ -416,7 +416,7 @@ ldbm_txn_ruv_modify_context( Slapi_PBlock *pb, modify_context *mc )
 
     if (NULL == bentry) {
         /* Uh oh, we couldn't find and lock the RUV entry! */
-        LDAPDebug( LDAP_DEBUG_ANY, "Error: ldbm_txn_ruv_modify_context failed to retrieve and lock RUV entry\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: ldbm_txn_ruv_modify_context failed to retrieve and lock RUV entry\n",
             0, 0, 0 );
         rc = -1;
         goto done;
@@ -425,7 +425,7 @@ ldbm_txn_ruv_modify_context( Slapi_PBlock *pb, modify_context *mc )
     modify_init( mc, bentry );
 
     if (modify_apply_mods_ignore_error( mc, smods, LDAP_TYPE_OR_VALUE_EXISTS )) {
-        LDAPDebug( LDAP_DEBUG_ANY, "Error: ldbm_txn_ruv_modify_context failed to apply updates to RUV entry\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: ldbm_txn_ruv_modify_context failed to apply updates to RUV entry\n",
             0, 0, 0 );
         rc = -1;
         modify_term( mc, be );
diff --git a/ldap/servers/slapd/back-ldbm/nextid.c b/ldap/servers/slapd/back-ldbm/nextid.c
index 69f41bb..c5d2573 100644
--- a/ldap/servers/slapd/back-ldbm/nextid.c
+++ b/ldap/servers/slapd/back-ldbm/nextid.c
@@ -26,7 +26,7 @@ next_id(backend *be)
 
 	/*Test if nextid hasn't been initialized. */
 	if (inst->inst_nextid < 1) {
-	  LDAPDebug( LDAP_DEBUG_ANY, 
+	  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 		    "ldbm backend instance: nextid not initialized... exiting.\n", 0,0,0);
 	  exit(1);
 	}
@@ -42,13 +42,13 @@ next_id(backend *be)
 	/* if ID is above the threshold, the database may need rebuilding soon */
 	if (id >= ID_WARNING_THRESHOLD) {
 	  if ( id >= MAXID ) {
-	    LDAPDebug( LDAP_DEBUG_ANY,
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		       "ldbm backend instance: FATAL ERROR: backend '%s' has no"
 		       "IDs left. DATABASE MUST BE REBUILT.\n", be->be_name, 0,
 		       0);
 	    id = MAXID;
 	  } else {
-	    LDAPDebug( LDAP_DEBUG_ANY,
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		       "ldbm backend instance: WARNING: backend '%s' may run out "
 		       "of IDs. Please, rebuild database.\n", be->be_name, 0, 0);
 	  }
@@ -66,7 +66,7 @@ next_id_return( backend *be, ID id )
 
 	/*Test if nextid hasn't been initialized. */
 	if (inst->inst_nextid < 1) {
-	  LDAPDebug( LDAP_DEBUG_ANY, 
+	  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 		    "ldbm backend instance: nextid not initialized... exiting\n", 0,0,0);
 	  exit(1);
 	}
@@ -94,7 +94,7 @@ next_id_get( backend *be )
 
   /*Test if nextid hasn't been initialized.*/
   if (inst->inst_nextid < 1) {
-    LDAPDebug( LDAP_DEBUG_ANY, 
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 	      "ldbm backend instance: nextid not initialized... exiting\n", 0,0,0);
     exit(1);
   }
diff --git a/ldap/servers/slapd/back-ldbm/parents.c b/ldap/servers/slapd/back-ldbm/parents.c
index 11ad17f..42f7b3e 100644
--- a/ldap/servers/slapd/back-ldbm/parents.c
+++ b/ldap/servers/slapd/back-ldbm/parents.c
@@ -99,7 +99,7 @@ parent_update_on_childchange(modify_context *mc,int op, size_t *new_sub_count )
 			if (!already_present) {
 				/* This means that there was a conflict.  Before coming to this point,
 				 * the entry to be deleted was deleted... */
-				LDAPDebug(LDAP_DEBUG_ANY, "Parent %s has no children. (op 0x%x, repl_op 0x%x)\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Parent %s has no children. (op 0x%x, repl_op 0x%x)\n",
 				          slapi_entry_get_dn(mc->old_entry->ep_entry), op, repl_op);
 				slapi_mods_free(&smods);
 				return -1;
diff --git a/ldap/servers/slapd/back-ldbm/rmdb.c b/ldap/servers/slapd/back-ldbm/rmdb.c
index 0f532c4..bd0930a 100644
--- a/ldap/servers/slapd/back-ldbm/rmdb.c
+++ b/ldap/servers/slapd/back-ldbm/rmdb.c
@@ -32,7 +32,7 @@ ldbm_back_rmdb( Slapi_PBlock *pb )
 
 	if (be->be_state != BE_STATE_STOPPED)
 	{
-		LDAPDebug( LDAP_DEBUG_TRACE, 
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 				  "ldbm_back_cleanup: warning - backend is in a wrong state - %d\n", 
 				  be->be_state, 0, 0 );
 		return 0;
@@ -42,7 +42,7 @@ ldbm_back_rmdb( Slapi_PBlock *pb )
 
 	if (be->be_state != BE_STATE_STOPPED)
 	{
-		LDAPDebug( LDAP_DEBUG_TRACE, 
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 				  "ldbm_back_cleanup: warning - backend is in a wrong state - %d\n", 
 				  be->be_state, 0, 0 );
 		PR_Unlock (be->be_state_lock);
diff --git a/ldap/servers/slapd/back-ldbm/seq.c b/ldap/servers/slapd/back-ldbm/seq.c
index 1cc7d19..faed008 100644
--- a/ldap/servers/slapd/back-ldbm/seq.c
+++ b/ldap/servers/slapd/back-ldbm/seq.c
@@ -87,11 +87,11 @@ ldbm_back_seq( Slapi_PBlock *pb )
 	/* get a database */
 
 	ainfo_get( be, attrname, &ai );
-	LDAPDebug( LDAP_DEBUG_ARGS,
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG,
 	    "   seq: indextype: %s indexmask: 0x%x seek type: %d\n",
 	    ai->ai_type, ai->ai_indexmask, type );
 	if ( ! (INDEX_EQUALITY & ai->ai_indexmask) ) {
-		LDAPDebug( LDAP_DEBUG_TRACE,
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		    "seq: caller specified un-indexed attribute %s\n",
 			   attrname ? attrname : "", 0, 0 );
 		slapi_send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL,
@@ -100,7 +100,7 @@ ldbm_back_seq( Slapi_PBlock *pb )
 	}
 
 	if ( (return_value = dblayer_get_index_file( be, ai, &db, DBOPEN_CREATE )) != 0 ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "<= ldbm_back_seq NULL (could not open index file for attribute %s)\n",
 		    attrname, 0, 0 );
 		slapi_send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL );
@@ -275,9 +275,9 @@ retry:
 		    {
 				if ( err != LDAP_SUCCESS )
 				{
-				    LDAPDebug( LDAP_DEBUG_ANY, "seq id2entry err %d\n", err, 0, 0 );
+				    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "seq id2entry err %d\n", err, 0, 0 );
 				}
-				LDAPDebug( LDAP_DEBUG_ARGS,
+				LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG,
 					"ldbm_back_seq: candidate %lu not found\n",
 					(u_long)id, 0, 0 );
 				continue;
diff --git a/ldap/servers/slapd/back-ldbm/sort.c b/ldap/servers/slapd/back-ldbm/sort.c
index 3cd587b..e3ebe07 100644
--- a/ldap/servers/slapd/back-ldbm/sort.c
+++ b/ldap/servers/slapd/back-ldbm/sort.c
@@ -150,7 +150,7 @@ int sort_candidates(backend *be,int lookthrough_limit,time_t time_up, Slapi_PBlo
 	}
 	/* we refuse to sort a candidate list which is vast */
 	if (ALLIDS(candidates)) {
-		LDAPDebug( LDAP_DEBUG_TRACE, "Asked to sort ALLIDS candidate list, refusing\n",0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Asked to sort ALLIDS candidate list, refusing\n",0, 0, 0 );
 		return LDAP_UNWILLING_TO_PERFORM;
 	}
 
@@ -160,7 +160,7 @@ int sort_candidates(backend *be,int lookthrough_limit,time_t time_up, Slapi_PBlo
 			int return_value = 0;
 			return_value = attr_get_value_cmp_fn( &this_s->sattr, &(this_s->compare_fn) );
 			if (return_value  != 0 ) {
-				LDAPDebug( LDAP_DEBUG_TRACE, "Attempting to sort a non-ordered attribute (%s)\n",this_s->type, 0, 0 );
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Attempting to sort a non-ordered attribute (%s)\n",this_s->type, 0, 0 );
 				/* DBDB we should set the error type here */
 				return_value = LDAP_UNWILLING_TO_PERFORM;
 				*sort_error_type = this_s->type;
@@ -189,7 +189,7 @@ int sort_candidates(backend *be,int lookthrough_limit,time_t time_up, Slapi_PBlo
 	bc.check_counter = 1;
 
 	return_value = slapd_qsort(&bc,candidates,s);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= Sorting done\n",0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= Sorting done\n",0, 0, 0 );
 
 	return return_value;
 }
@@ -463,7 +463,7 @@ static int compare_entries_sv(ID *id_a, ID *id_b, sort_spec *s,baggage_carrier *
 	a = id2entry(be,*id_a,&txn,&err);
 	if (NULL == a) {
 		if (0 != err ) {
-			LDAPDebug(LDAP_DEBUG_TRACE,"compare_entries_sv db err %d\n",err,0,0);
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"compare_entries_sv db err %d\n",err,0,0);
 		}
 		/* Were up a creek without paddle here */
 		/* Best to log error and set some flag */
@@ -472,7 +472,7 @@ static int compare_entries_sv(ID *id_a, ID *id_b, sort_spec *s,baggage_carrier *
 	b = id2entry(be,*id_b,&txn,&err);
 	if (NULL == b) {
 		if (0 != err ) {
-			LDAPDebug(LDAP_DEBUG_TRACE,"compare_entries_sv db err %d\n",err,0,0);
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"compare_entries_sv db err %d\n",err,0,0);
 		}
 		CACHE_RETURN(&inst->inst_cache,&a);
 		return 0;
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c
index 299e5f0..99a1b53 100644
--- a/ldap/servers/slapd/back-ldbm/start.c
+++ b/ldap/servers/slapd/back-ldbm/start.c
@@ -61,13 +61,13 @@ ldbm_back_start( Slapi_PBlock *pb )
   PRUint64 memsize = pages * pagesize;
 #endif
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "ldbm backend starting\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm backend starting\n", 0, 0, 0 );
 
   slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li );
 
   /* parse the config file here */
   if (0 != ldbm_config_load_dse_info(li)) {
-      LDAPDebug( LDAP_DEBUG_ANY, "start: Loading database configuration failed\n",
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "start: Loading database configuration failed\n",
             0, 0, 0 );
       return SLAPI_FAIL_GENERAL;
   }
@@ -77,7 +77,7 @@ ldbm_back_start( Slapi_PBlock *pb )
   if ( slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT,
             LDBM_LOOKTHROUGHLIMIT_AT, &li->li_reslimit_lookthrough_handle )
             != SLAPI_RESLIMIT_STATUS_SUCCESS ) {
-      LDAPDebug( LDAP_DEBUG_ANY, "start: Resource limit registration failed for lookthroughlimit\n",
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "start: Resource limit registration failed for lookthroughlimit\n",
             0, 0, 0 );
       return SLAPI_FAIL_GENERAL;
   }
@@ -87,7 +87,7 @@ ldbm_back_start( Slapi_PBlock *pb )
   if ( slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT,
             LDBM_ALLIDSLIMIT_AT, &li->li_reslimit_allids_handle )
             != SLAPI_RESLIMIT_STATUS_SUCCESS ) {
-      LDAPDebug( LDAP_DEBUG_ANY, "start: Resource limit registration failed for allidslimit\n",
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "start: Resource limit registration failed for allidslimit\n",
             0, 0, 0 );
       return SLAPI_FAIL_GENERAL;
   }
@@ -97,7 +97,7 @@ ldbm_back_start( Slapi_PBlock *pb )
   if ( slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT,
             LDBM_PAGEDLOOKTHROUGHLIMIT_AT, &li->li_reslimit_pagedlookthrough_handle )
             != SLAPI_RESLIMIT_STATUS_SUCCESS ) {
-      LDAPDebug( LDAP_DEBUG_ANY, "start: Resource limit registration failed for pagedlookthroughlimit\n",
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "start: Resource limit registration failed for pagedlookthroughlimit\n",
             0, 0, 0 );
       return SLAPI_FAIL_GENERAL;
   }
@@ -107,7 +107,7 @@ ldbm_back_start( Slapi_PBlock *pb )
   if ( slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT,
             LDBM_PAGEDALLIDSLIMIT_AT, &li->li_reslimit_pagedallids_handle )
             != SLAPI_RESLIMIT_STATUS_SUCCESS ) {
-      LDAPDebug( LDAP_DEBUG_ANY, "start: Resource limit registration failed for pagedallidslimit\n",
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "start: Resource limit registration failed for pagedallidslimit\n",
             0, 0, 0 );
       return SLAPI_FAIL_GENERAL;
   }
@@ -116,7 +116,7 @@ ldbm_back_start( Slapi_PBlock *pb )
   if ( slapi_reslimit_register( SLAPI_RESLIMIT_TYPE_INT,
             LDBM_RANGELOOKTHROUGHLIMIT_AT, &li->li_reslimit_rangelookthrough_handle )
             != SLAPI_RESLIMIT_STATUS_SUCCESS ) {
-      LDAPDebug( LDAP_DEBUG_ANY, "start: Resource limit registration failed for rangelookthroughlimit\n",
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "start: Resource limit registration failed for rangelookthroughlimit\n",
             0, 0, 0 );
       return SLAPI_FAIL_GENERAL;
   }
@@ -138,11 +138,11 @@ ldbm_back_start( Slapi_PBlock *pb )
       (li->li_import_cache_autosize > 100) ||
       ((li->li_cache_autosize > 0) && (li->li_import_cache_autosize > 0) &&
       (li->li_cache_autosize + li->li_import_cache_autosize > 100))) {
-      LDAPDebug( LDAP_DEBUG_ANY, "cache autosizing: bad settings, "
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cache autosizing: bad settings, "
         "value or sum of values can not larger than 100.\n", 0, 0, 0 );
   } else {
       if (util_info_sys_pages(&pagesize, &pages, &procpages, &availpages) != 0) {
-          LDAPDebug( LDAP_DEBUG_ANY, "start: Unable to determine system page limits\n",
+          LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "start: Unable to determine system page limits\n",
                 0, 0, 0 );
           return SLAPI_FAIL_GENERAL;
       }
@@ -157,25 +157,25 @@ ldbm_back_start( Slapi_PBlock *pb )
                   cache_size = (PRUint64)cache_get_max_size(&(inst->inst_cache));
                   db_size = dblayer_get_id2entry_size(inst);
                   if (cache_size < db_size) {
-                      LDAPDebug(LDAP_DEBUG_ANY,
+                      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                 "WARNING: %s: entry cache size %llu B is "
                                 "less than db size %llu B; "
                                 "We recommend to increase the entry cache size "
                                 "nsslapd-cachememsize.\n",
                                 inst->inst_name, cache_size, db_size);
                   } else {
-                      LDAPDebug(LDAP_DEBUG_BACKLDBM,
+                      LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
                                 "%s: entry cache size: %llu B; db size: %llu B\n",
                                 inst->inst_name, cache_size, db_size);
                   }
                   /* Get the dn_cachesize */
                   dncache_size = (PRUint64)cache_get_max_size(&(inst->inst_dncache));
                   total_cache_size += cache_size + dncache_size;
-                  LDAPDebug(LDAP_DEBUG_BACKLDBM,
+                  LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
                             "total cache size: %llu B; \n",
                             total_cache_size, 0 ,0 );
               }
-              LDAPDebug(LDAP_DEBUG_BACKLDBM,
+              LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
                         "Total entry cache size: %llu B; "
                         "dbcache size: %llu B; "
                         "available memory size: %llu B; \n",
@@ -195,8 +195,8 @@ ldbm_back_start( Slapi_PBlock *pb )
               /* In the case it is not, this will *reduce* the allocation */
               issane = util_is_cachesize_sane(&zone_size);
               if (!issane) {
-                  LDAPDebug(LDAP_DEBUG_ANY, "Your autosized cache values have been reduced. Likely your nsslapd-cache-autosize percentage is too high.\n", 0,0,0);
-                  LDAPDebug(LDAP_DEBUG_ANY, msg, 0,0,0);
+                  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Your autosized cache values have been reduced. Likely your nsslapd-cache-autosize percentage is too high.\n", 0,0,0);
+                  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, msg, 0,0,0);
               }
               /* It's valid, lets divide it up and set according to user prefs */
               zone_pages = zone_size / pagesize;
@@ -205,11 +205,11 @@ ldbm_back_start( Slapi_PBlock *pb )
               /* We update this for the is-sane check below. */
               total_cache_size = (zone_pages - db_pages) * pagesize;
 
-              LDAPDebug(LDAP_DEBUG_ANY, "cache autosizing. found %dk physical memory\n",
+              LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cache autosizing. found %dk physical memory\n",
                 pages*(pagesize/1024), 0, 0);
-              LDAPDebug(LDAP_DEBUG_ANY, "cache autosizing. found %dk avaliable\n",
+              LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cache autosizing. found %dk avaliable\n",
                 zone_pages*(pagesize/1024), 0, 0);
-              LDAPDebug(LDAP_DEBUG_ANY, "cache autosizing: db cache: %dk, "
+              LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cache autosizing: db cache: %dk, "
                 "each entry cache (%d total): %dk\n",
                 db_pages*(pagesize/1024), objset_size(li->li_instance_set),
                 entry_pages*(pagesize/1024));
@@ -247,11 +247,11 @@ ldbm_back_start( Slapi_PBlock *pb )
               import_size = import_pages * pagesize;
               issane = util_is_cachesize_sane(&import_size);
               if (!issane) {
-                  LDAPDebug(LDAP_DEBUG_ANY, "Your autosized import cache values have been reduced. Likely your nsslapd-import-cache-autosize percentage is too high.\n", 0,0,0);
+                  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Your autosized import cache values have been reduced. Likely your nsslapd-import-cache-autosize percentage is too high.\n", 0,0,0);
               }
               /* We just accept the reduced allocation here. */
               import_pages = import_size / pagesize;
-              LDAPDebug(LDAP_DEBUG_ANY, "cache autosizing: import cache: %dk \n",
+              LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "cache autosizing: import cache: %dk \n",
                 import_pages*(pagesize/1024), NULL, NULL);
     
               sprintf(s, "%lu", (unsigned long)(import_pages * pagesize));
@@ -266,9 +266,9 @@ ldbm_back_start( Slapi_PBlock *pb )
   issane = util_is_cachesize_sane(&total_size);
   if (!issane) {
     /* Right, it's time to panic */
-    LDAPDebug( LDAP_DEBUG_ANY, "CRITICAL: It is highly likely your memory configuration of all backends will EXCEED your systems memory.\n", 0, 0, 0 );
-    LDAPDebug( LDAP_DEBUG_ANY, "CRITICAL: In a future release this WILL prevent server start up. You MUST alter your configuration.\n", 0, 0, 0 );
-    LDAPDebug(LDAP_DEBUG_ANY,
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "CRITICAL: It is highly likely your memory configuration of all backends will EXCEED your systems memory.\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "CRITICAL: In a future release this WILL prevent server start up. You MUST alter your configuration.\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "Total entry cache size: %llu B; "
               "dbcache size: %llu B; "
               "available memory size: %llu B; \n",
@@ -278,7 +278,7 @@ ldbm_back_start( Slapi_PBlock *pb )
               (PRUint64)total_cache_size, (PRUint64)li->li_dbcachesize, memsize
 #endif
     );
-    LDAPDebug(LDAP_DEBUG_ANY, msg, 0,0,0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, msg, 0,0,0);
     /* WB 2016 - This should be UNCOMMENTED in a future release */
     /* return SLAPI_FAIL_GENERAL; */
   }
@@ -288,7 +288,7 @@ ldbm_back_start( Slapi_PBlock *pb )
   retval = check_db_version(li, &action);
   if (0 != retval)
   {
-      LDAPDebug( LDAP_DEBUG_ANY, "start: db version is not supported\n",
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "start: db version is not supported\n",
                  0, 0, 0);
       return SLAPI_FAIL_GENERAL;
   }
@@ -304,7 +304,7 @@ ldbm_back_start( Slapi_PBlock *pb )
   }
   if (0 != retval) {
       char *msg;
-      LDAPDebug( LDAP_DEBUG_ANY, "start: Failed to init database, err=%d %s\n",
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "start: Failed to init database, err=%d %s\n",
          retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
       if (LDBM_OS_ERR_IS_DISKFULL(retval)) return return_on_disk_full(li);
       else return SLAPI_FAIL_GENERAL;
@@ -314,12 +314,12 @@ ldbm_back_start( Slapi_PBlock *pb )
   retval = ldbm_instance_startall(li);
   if (0 != retval) {
       char *msg;
-      LDAPDebug( LDAP_DEBUG_ANY, "start: Failed to start databases, err=%d %s\n",
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "start: Failed to start databases, err=%d %s\n",
          retval, (msg = dblayer_strerror( retval )) ? msg : "", 0 );
       if (LDBM_OS_ERR_IS_DISKFULL(retval)) return return_on_disk_full(li);
       else {
         if ((li->li_cache_autosize > 0) && (li->li_cache_autosize <= 100)) {
-          LDAPDebug( LDAP_DEBUG_ANY, "Failed to allocate %d byte dbcache.  "
+          LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to allocate %d byte dbcache.  "
                    "Please reduce the value of %s and restart the server.\n",
                    li->li_dbcachesize, CONFIG_CACHE_AUTOSIZE, 0);
         }
@@ -348,7 +348,7 @@ ldbm_back_start( Slapi_PBlock *pb )
   /* initialize the USN counter */
   ldbm_usn_init(li);
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "ldbm backend done starting\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldbm backend done starting\n", 0, 0, 0 );
 
   return( 0 );
 
diff --git a/ldap/servers/slapd/back-ldbm/uniqueid2entry.c b/ldap/servers/slapd/back-ldbm/uniqueid2entry.c
index 84d8c4e..00972ca 100644
--- a/ldap/servers/slapd/back-ldbm/uniqueid2entry.c
+++ b/ldap/servers/slapd/back-ldbm/uniqueid2entry.c
@@ -35,7 +35,7 @@ uniqueid2entry(
 	IDList			*idl = NULL;
 	struct backentry	*e = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> uniqueid2entry \"%s\"\n", uniqueid,
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> uniqueid2entry \"%s\"\n", uniqueid,
 		   0, 0 );
 #ifdef UUIDCACHE_ON 
 	e = cache_find_uuid(&inst->inst_cache, uniqueid);
@@ -78,6 +78,6 @@ ext:
 		slapi_ch_free( (void**)&idl);
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= uniqueid2entry %p\n", e, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= uniqueid2entry %p\n", e, 0, 0 );
 	return( e );
 }
diff --git a/ldap/servers/slapd/back-ldbm/upgrade.c b/ldap/servers/slapd/back-ldbm/upgrade.c
index 6953117..762065b 100644
--- a/ldap/servers/slapd/back-ldbm/upgrade.c
+++ b/ldap/servers/slapd/back-ldbm/upgrade.c
@@ -147,7 +147,7 @@ check_db_version( struct ldbminfo *li, int *action )
     value = lookup_dbversion( ldbmversion, DBVERSION_TYPE | DBVERSION_ACTION );
     if ( !value )
     {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
            "ERROR: Database version mismatch (expecting "
            "'%s' but found '%s' in directory %s)\n",
             LDBM_VERSION, ldbmversion, li->li_directory );
@@ -231,7 +231,7 @@ check_db_inst_version( ldbm_instance *inst )
     value = lookup_dbversion( ldbmversion, DBVERSION_TYPE | DBVERSION_ACTION );
     if ( !value )
     {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
            "ERROR: Database version mismatch (expecting "
            "'%s' but found '%s' in directory %s)\n",
             LDBM_VERSION, ldbmversion, inst->inst_dir_name );
@@ -307,7 +307,7 @@ adjust_idl_switch(char *ldbmversion, struct ldbminfo *li)
         if (!idl_get_idl_new())   /* config: old idl */
         {
             replace_ldbm_config_value(CONFIG_IDL_SWITCH, "new", li);
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "Warning: Dbversion %s does not meet nsslapd-idl-switch: \"old\"; "
                 "nsslapd-idl-switch is updated to \"new\"\n", ldbmversion, 0, 0);
         }
@@ -320,7 +320,7 @@ adjust_idl_switch(char *ldbmversion, struct ldbminfo *li)
         if (idl_get_idl_new())   /* config: new */
         {
             replace_ldbm_config_value(CONFIG_IDL_SWITCH, "old", li);
-            LDAPDebug(LDAP_DEBUG_ANY, 
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                 "Warning: Dbversion %s does not meet nsslapd-idl-switch: \"new\"; "
                 "nsslapd-idl-switch is updated to \"old\"\n",
                 ldbmversion, 0, 0);
@@ -328,7 +328,7 @@ adjust_idl_switch(char *ldbmversion, struct ldbminfo *li)
     }
     else
     {
-         LDAPDebug(LDAP_DEBUG_ANY, 
+         LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                    "Warning: Dbversion %s is not supported\n", 
                    ldbmversion, 0, 0);
          rval = -1;
@@ -357,7 +357,7 @@ int ldbm_upgrade(ldbm_instance *inst, int action)
         rval = dblayer_update_db_ext(inst, LDBM_SUFFIX_OLD, LDBM_SUFFIX);
         if (0 == rval)
         {
-            LDAPDebug(LDAP_DEBUG_ANY, "ldbm_upgrade: "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm_upgrade: "
                       "Upgrading instance %s supporting bdb %d.%d "
                       "was successfully done.\n",
                       inst->inst_name, DB_VERSION_MAJOR, DB_VERSION_MINOR);
@@ -390,7 +390,7 @@ static int upgrade_db_3x_40(backend *be)
 
     static char* indexes_modified[] = {"parentid", "numsubordinates", NULL};
 
-    LDAPDebug( LDAP_DEBUG_ANY, "WARNING: Detected a database older than this server, upgrading data...\n",0,0,0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: Detected a database older than this server, upgrading data...\n",0,0,0);
 
     dblayer_txn_init(li,&txn);
     ret = dblayer_txn_begin(li,NULL,&txn);
@@ -430,9 +430,9 @@ error:
         }
     }
     if (0 == ret) {
-        LDAPDebug( LDAP_DEBUG_ANY, "...upgrade complete.\n",0,0,0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "...upgrade complete.\n",0,0,0);
     } else {
-        LDAPDebug( LDAP_DEBUG_ANY, "ERROR: Attempt to upgrade the older database FAILED.\n",0,0,0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: Attempt to upgrade the older database FAILED.\n",0,0,0);
     }
     return ret;
 }
diff --git a/ldap/servers/slapd/back-ldbm/vlv.c b/ldap/servers/slapd/back-ldbm/vlv.c
index 7f210e3..2f5ace4 100644
--- a/ldap/servers/slapd/back-ldbm/vlv.c
+++ b/ldap/servers/slapd/back-ldbm/vlv.c
@@ -107,7 +107,7 @@ int vlv_DeleteSearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
     
     if (instance_set_busy(inst) != 0)
     {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "Backend instance: '%s' is already in the middle of "
             "another task and cannot be disturbed.\n",
             inst->inst_name, 0, 0);
@@ -118,7 +118,7 @@ int vlv_DeleteSearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
     p = vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, slapi_entry_get_sdn(entryBefore));
     if(p!=NULL)
     {
-        LDAPDebug( LDAP_DEBUG_ANY, "Deleted Virtual List View Search (%s).\n", p->vlv_name, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Deleted Virtual List View Search (%s).\n", p->vlv_name, 0, 0);
         vlvSearch_removefromlist((struct vlvSearch **)&be->vlvSearchList,p->vlv_dn);
         vlvSearch_delete(&p);
     }
@@ -134,13 +134,13 @@ int vlv_DeleteIndexEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry
 {
     ldbm_instance *inst = (ldbm_instance*)arg;
     if (inst && is_instance_busy(inst)) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                        "Backend instance: '%s' is already in the middle of "
                        "another task and cannot be disturbed.\n",
                        inst->inst_name, 0, 0);
         return SLAPI_DSE_CALLBACK_ERROR;
     } else {
-        LDAPDebug( LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                        "Deleted Virtual List View Index.\n", 0, 0, 0);
         return SLAPI_DSE_CALLBACK_OK;
     }
@@ -158,7 +158,7 @@ int vlv_ModifySearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
     p= vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, slapi_entry_get_sdn(entryBefore));
     if(p!=NULL)
     {
-       	LDAPDebug( LDAP_DEBUG_ANY, "Modified Virtual List View Search (%s), which will be enabled when the database is rebuilt.\n", p->vlv_name, 0, 0);
+       	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Modified Virtual List View Search (%s), which will be enabled when the database is rebuilt.\n", p->vlv_name, 0, 0);
     }
 	slapi_rwlock_unlock(be->vlvSearchList_lock);
     return SLAPI_DSE_CALLBACK_DO_NOT_APPLY;
@@ -169,7 +169,7 @@ int vlv_ModifySearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entr
 
 int vlv_ModifyIndexEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg)
 {
-   	LDAPDebug( LDAP_DEBUG_ANY, "Modified Virtual List View Index.\n", 0, 0, 0);
+   	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Modified Virtual List View Index.\n", 0, 0, 0);
     return SLAPI_DSE_CALLBACK_DO_NOT_APPLY;
 }
 
@@ -185,7 +185,7 @@ int vlv_ModifyRDNSearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_E
     p= vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, slapi_entry_get_sdn(entryBefore));
     if(p!=NULL)
     {
-       	LDAPDebug( LDAP_DEBUG_ANY, "Modified Virtual List View Search (%s), which will be enabled when the database is rebuilt.\n", p->vlv_name, 0, 0);
+       	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Modified Virtual List View Search (%s), which will be enabled when the database is rebuilt.\n", p->vlv_name, 0, 0);
     }
 	slapi_rwlock_unlock(be->vlvSearchList_lock);
     return SLAPI_DSE_CALLBACK_DO_NOT_APPLY;
@@ -196,7 +196,7 @@ int vlv_ModifyRDNSearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_E
 
 int vlv_ModifyRDNIndexEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg)
 {   
-   	LDAPDebug( LDAP_DEBUG_ANY, "Modified Virtual List View Index.\n", 0, 0, 0);
+   	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Modified Virtual List View Index.\n", 0, 0, 0);
     return SLAPI_DSE_CALLBACK_DO_NOT_APPLY;
 }
 
@@ -244,7 +244,7 @@ vlv_init_index_entry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* en
         slapi_sdn_get_parent(slapi_entry_get_sdn(entryBefore),&parentdn);
         pSearch= vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, &parentdn);
 		if (pSearch == NULL) { 
-			LDAPDebug( LDAP_DEBUG_ANY, "Parent doesn't exist for entry %s.\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Parent doesn't exist for entry %s.\n",
 				slapi_entry_get_dn(entryBefore), 0, 0); 
 			vlvIndex_delete(&newVlvIndex);
 		} 
@@ -339,7 +339,7 @@ vlv_init(ldbm_instance *inst)
     backend *be = NULL;
 
     if (!inst) {
-        LDAPDebug(LDAP_DEBUG_ANY, "vlv_init: invalid instance.\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vlv_init: invalid instance.\n", 0, 0, 0);
         return_value = LDAP_OPERATIONS_ERROR;
         goto out;
     }
@@ -738,7 +738,7 @@ do_vlv_update_index(back_txn *txn, struct ldbminfo *li, Slapi_PBlock *pb, struct
     rc = dblayer_get_index_file(be, pIndex->vlv_attrinfo, &db, DBOPEN_CREATE);
     if (rc != 0) {
       if(rc != DB_LOCK_DEADLOCK)
-        LDAPDebug(LDAP_DEBUG_ANY, "VLV: can't get index file '%s' (err %d)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "VLV: can't get index file '%s' (err %d)\n",
                   pIndex->vlv_attrinfo->ai_type, rc, 0);
         return rc;
     }
@@ -756,7 +756,7 @@ do_vlv_update_index(back_txn *txn, struct ldbminfo *li, Slapi_PBlock *pb, struct
         data.data = &entry->ep_id;
         rc = db->put(db, db_txn, &key->key, &data, 0);
         if (rc == 0) {
-            LDAPDebug(LDAP_DEBUG_TRACE,
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                       "vlv_update_index: %s Insert %s ID=%lu\n",
                       pIndex->vlv_name, key->key.data, (u_long)entry->ep_id);
             vlvIndex_increment_indexlength(pIndex, db, txn);
@@ -765,12 +765,12 @@ do_vlv_update_index(back_txn *txn, struct ldbminfo *li, Slapi_PBlock *pb, struct
 	} else if(rc != DB_LOCK_DEADLOCK)  {
             /* jcm: This error is valid if the key already exists.
              * Identical multi valued attr values could do this. */
-            LDAPDebug(LDAP_DEBUG_TRACE,
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                       "vlv_update_index: %s Insert %s ID=%lu FAILED\n",
                       pIndex->vlv_name, key->key.data, (u_long)entry->ep_id);
         }
     } else {
-        LDAPDebug(LDAP_DEBUG_TRACE,
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                   "vlv_update_index: %s Delete %s\n",
                   pIndex->vlv_name, key->key.data, 0);
         rc = db->del(db, db_txn, &key->key, 0);
@@ -779,7 +779,7 @@ do_vlv_update_index(back_txn *txn, struct ldbminfo *li, Slapi_PBlock *pb, struct
 	} else if (rc == DB_RUNRECOVERY) {
 	    ldbm_nasty(pIndex->vlv_name,78,rc);
 	} else if (rc != DB_LOCK_DEADLOCK) {
-            LDAPDebug(LDAP_DEBUG_TRACE,
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                       "vlv_update_index: %s Delete %s FAILED\n",
                       pIndex->vlv_name, key->key.data, 0);
         }
@@ -916,7 +916,7 @@ determine_result_range(const struct vlv_request *vlv_request_control, PRUint32 i
             *pstop= length - 1;
         }
     }
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= vlv_determine_result_range: Result Range %lu-%lu\n", *pstart, *pstop, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= vlv_determine_result_range: Result Range %lu-%lu\n", *pstart, *pstop, 0 );
 }
 
 /*
@@ -1016,7 +1016,7 @@ vlv_build_candidate_list_byvalue( struct vlvIndex* p, DBC *dbc, PRUint32 length,
             /* Records are numbered from one. */
             si--;
             slapi_ch_free(&(data.data));
-        	LDAPDebug( LDAP_DEBUG_TRACE, "<= vlv_build_candidate_list_byvalue: Found. Index=%lu\n",si,0,0);
+        	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= vlv_build_candidate_list_byvalue: Found. Index=%lu\n",si,0,0);
         }
         else
         {
@@ -1037,7 +1037,7 @@ vlv_build_candidate_list_byvalue( struct vlvIndex* p, DBC *dbc, PRUint32 length,
         {
             si = length - 1;
         }
-        LDAPDebug( LDAP_DEBUG_TRACE, "<= vlv_build_candidate_list_byvalue: Not Found. Index=%lu\n",si,0,0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= vlv_build_candidate_list_byvalue: Not Found. Index=%lu\n",si,0,0);
     }
     if (key.data != typedown_value[0]->bv_val) { /* in case new key is set 
                                                   in dbc->c_get(DB_SET_RANGE) */
@@ -1086,10 +1086,10 @@ int vlv_build_idl(PRUint32 start, PRUint32 stop, DB *db, DBC *dbc,
     }
     if (err != 0) {
         /* some db error...? */
-        LDAPDebug(LDAP_DEBUG_ANY, "vlv_build_idl: can't follow db cursor "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vlv_build_idl: can't follow db cursor "
                   "(err %d)\n", err, 0, 0);
         if (err == ENOMEM)
-            LDAPDebug(LDAP_DEBUG_ANY, "   nomem: wants %d key, %d data\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "   nomem: wants %d key, %d data\n",
                       key.size, data.size, 0);
         rc = LDAP_OPERATIONS_ERROR;
         goto error;
@@ -1195,7 +1195,7 @@ vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_requ
     int do_trim= 1;
     DB_TXN *db_txn = NULL;
 
-    LDAPDebug(LDAP_DEBUG_TRACE,
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
               "=> vlv_build_candidate_list: %s %s Using VLV Index %s\n",
               slapi_sdn_get_dn(vlvIndex_getBase(p)), p->vlv_search->vlv_filter,
               vlvIndex_getName(p));
@@ -1208,7 +1208,7 @@ vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_requ
     rc = dblayer_get_index_file(be, p->vlv_attrinfo, &db, 0);
     if (rc != 0) {
         /* shouldn't happen */
-        LDAPDebug(LDAP_DEBUG_ANY, "VLV: can't get index file '%s' (err %d)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "VLV: can't get index file '%s' (err %d)\n",
                   p->vlv_attrinfo->ai_type, rc, 0);
         if (is_srchlist_locked) {
             slapi_rwlock_unlock(be->vlvSearchList_lock);
@@ -1230,7 +1230,7 @@ vlv_build_candidate_list( backend *be, struct vlvIndex* p, const struct vlv_requ
     err = db->cursor(db, db_txn, &dbc, 0);
     if (err != 0) {
         /* shouldn't happen */
-        LDAPDebug(LDAP_DEBUG_ANY, "VLV: couldn't get cursor (err %d)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "VLV: couldn't get cursor (err %d)\n",
                   rc, 0, 0);
         return -1;
     }
@@ -1304,7 +1304,7 @@ vlv_filter_candidates(backend *be, Slapi_PBlock *pb, const IDList *candidates, c
 		return LDAP_UNWILLING_TO_PERFORM;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> vlv_filter_candidates: Filtering %lu Candidates\n",(u_long)candidates->b_nids, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> vlv_filter_candidates: Filtering %lu Candidates\n",(u_long)candidates->b_nids, 0, 0 );
 
 	if (0 == return_value && candidates->b_nids>0)
 	{
@@ -1335,7 +1335,7 @@ vlv_filter_candidates(backend *be, Slapi_PBlock *pb, const IDList *candidates, c
                      */
                     if(!(ALLIDS(candidates) && err==DB_NOTFOUND))
                     {
-                	    LDAPDebug( LDAP_DEBUG_ANY, "vlv_filter_candidates: Candidate %lu not found err=%d\n", (u_long)id, err, 0 );
+                	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vlv_filter_candidates: Candidate %lu not found err=%d\n", (u_long)id, err, 0 );
                     }
             	}
             	else
@@ -1346,7 +1346,7 @@ vlv_filter_candidates(backend *be, Slapi_PBlock *pb, const IDList *candidates, c
                 	    if ( slapi_filter_test( pb, e->ep_entry, filter, 0 /* No ACL Check */) == 0 )
                 	    {
                             /* The entry passed the filter test, add the id to the list */
-                    	    LDAPDebug( LDAP_DEBUG_TRACE, "vlv_filter_candidates: Candidate %lu Passed Filter\n", (u_long)id, 0, 0 );
+                    	    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "vlv_filter_candidates: Candidate %lu Passed Filter\n", (u_long)id, 0, 0 );
                             idl_append(resultIdl,id);
                 		}
                     }
@@ -1377,7 +1377,7 @@ vlv_filter_candidates(backend *be, Slapi_PBlock *pb, const IDList *candidates, c
 	}
 
         *filteredCandidates= resultIdl;
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= vlv_filter_candidates: Filtering done\n",0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= vlv_filter_candidates: Filtering done\n",0, 0, 0 );
 
 	return return_value;
 }
@@ -1449,12 +1449,12 @@ vlv_trim_candidates_txn(backend *be, const IDList *candidates, const sort_spec*
             PRUint32 cursor= 0;
             for(cursor=start;cursor<=stop;cursor++)
             {
-            	LDAPDebug( LDAP_DEBUG_TRACE, "vlv_trim_candidates: Include ID %lu\n",(u_long)candidates->b_ids[cursor], 0, 0 );
+            	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "vlv_trim_candidates: Include ID %lu\n",(u_long)candidates->b_ids[cursor], 0, 0 );
                 idl_append(resultIdl,candidates->b_ids[cursor]);
             }
         }
     }
-   	LDAPDebug( LDAP_DEBUG_TRACE, "<= vlv_trim_candidates: Trimmed list contains %lu entries.\n", (u_long)(resultIdl ? resultIdl->b_nids : 0), 0, 0 );
+   	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= vlv_trim_candidates: Trimmed list contains %lu entries.\n", (u_long)(resultIdl ? resultIdl->b_nids : 0), 0, 0 );
     *trimmedCandidates= resultIdl;
     return return_value;
 }
@@ -1476,7 +1476,7 @@ static PRUint32
 vlv_trim_candidates_byindex(PRUint32 length, const struct vlv_request *vlv_request_control)
 {
     PRUint32 si= 0; /* The Selected Index */
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> vlv_trim_candidates_byindex: length=%u index=%d size=%d\n",length, vlv_request_control->index, vlv_request_control->contentCount );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> vlv_trim_candidates_byindex: length=%u index=%d size=%d\n",length, vlv_request_control->index, vlv_request_control->contentCount );
     if(vlv_request_control->index==0)
     {
         /* Always select the first entry in the list */
@@ -1523,7 +1523,7 @@ vlv_trim_candidates_byindex(PRUint32 length, const struct vlv_request *vlv_reque
             }
         }
     }
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= vlv_trim_candidates_byindex: Selected Index %lu\n",si, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= vlv_trim_candidates_byindex: Selected Index %lu\n",si, 0, 0 );
     return si;
 }
 
@@ -1565,7 +1565,7 @@ vlv_trim_candidates_byvalue(backend *be, const IDList *candidates, const sort_sp
             invalue[1]= NULL;
             slapi_attr_values2keys(&sort_control->sattr,invalue,&typedown_value,LDAP_FILTER_EQUALITY); /* JCM SLOW FUNCTION */
             if (compare_fn == NULL) {
-                LDAPDebug(LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vlv_trim_candidates_byvalue: "
                           "attempt to compare an unordered attribute",
                           0, 0, 0);
                 compare_fn = slapi_berval_cmp;
@@ -1582,7 +1582,7 @@ retry:
      * Perform a binary search over the candidate list
      */
     if (0 == candidates->b_nids) { /* idlist is empty */
-        LDAPDebug( LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: Candidate ID List is empty.\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vlv_trim_candidates_byvalue: Candidate ID List is empty.\n", 0, 0, 0 );
         ber_bvecfree((struct berval**)typedown_value);
         return candidates->b_nids; /* not found */
     }
@@ -1604,7 +1604,7 @@ retry:
         if ( e == NULL )
         {
             int rval;
-            LDAPDebug( LDAP_DEBUG_ANY, "vlv_trim_candidates_byvalue: "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vlv_trim_candidates_byvalue: "
                     "Candidate ID %lu not found err=%d\n", (u_long)id, err, 0 );
             rval = idl_delete((IDList **)&candidates, id);
             if (0 == rval || 1 == rval || 2 == rval) {
@@ -1698,12 +1698,12 @@ retry:
                 if(si==candidates->b_nids && !match)
                 {
                     /* Couldn't find an entry which matches the value, so return contentCount */
-                    LDAPDebug( LDAP_DEBUG_TRACE, "<= vlv_trim_candidates_byvalue: Not Found. Index %lu\n",si, 0, 0 );
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= vlv_trim_candidates_byvalue: Not Found. Index %lu\n",si, 0, 0 );
                     si= candidates->b_nids;
                 }
                 else
                 {
-                    LDAPDebug( LDAP_DEBUG_TRACE, "<= vlv_trim_candidates_byvalue: Found. Index %lu\n",si, 0, 0 );
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= vlv_trim_candidates_byvalue: Found. Index %lu\n",si, 0, 0 );
                 }
             }
             CACHE_RETURN(&(((ldbm_instance *)be->be_instance_info)->inst_cache),
@@ -1771,7 +1771,7 @@ vlv_make_response_control (Slapi_PBlock *pb, const struct vlv_response* vlvp)
         ber_bvfree(bvp);
     }
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= vlv_make_response_control: Index=%d Size=%d Result=%d\n", vlvp->targetPosition, vlvp->contentCount, vlvp->result );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= vlv_make_response_control: Index=%d Size=%d Result=%d\n", vlvp->targetPosition, vlvp->contentCount, vlvp->result );
 
 	return (rc==-1?LDAP_OPERATIONS_ERROR:LDAP_SUCCESS);
 }
@@ -1877,7 +1877,7 @@ vlv_parse_request_control( backend *be, struct berval *vlv_spec_ber,struct vlv_r
     }
     else
     {
-        LDAPDebug( LDAP_DEBUG_TRACE, "vlv_parse_request_control: Before=%d After=%d\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "vlv_parse_request_control: Before=%d After=%d\n",
                    vlvp->beforeCount, vlvp->afterCount, 0 );
         if (ber_scanf(ber,"t",&vlvp->tag) == LBER_ERROR)
         {
@@ -1905,7 +1905,7 @@ vlv_parse_request_control( backend *be, struct berval *vlv_spec_ber,struct vlv_r
                     {
                         vlvp->index--;
                     }
-                    LDAPDebug( LDAP_DEBUG_TRACE, "vlv_parse_request_control: Index=%d Content=%d\n", vlvp->index, vlvp->contentCount, 0 );
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "vlv_parse_request_control: Index=%d Content=%d\n", vlvp->index, vlvp->contentCount, 0 );
                 }
                 break;
             case LDAP_TAG_VLV_BY_VALUE:
@@ -1924,7 +1924,7 @@ vlv_parse_request_control( backend *be, struct berval *vlv_spec_ber,struct vlv_r
                     char *p= slapi_ch_malloc(vlvp->value.bv_len+1);
                     strncpy(p,vlvp->value.bv_val,vlvp->value.bv_len);
                     p[vlvp->value.bv_len]= '\0';
-                    LDAPDebug( LDAP_DEBUG_TRACE, "vlv_parse_request_control: Value=%s\n", p, 0, 0 );
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "vlv_parse_request_control: Value=%s\n", p, 0, 0 );
                     slapi_ch_free( (void**)&p);
                 }
                 break;
@@ -1988,7 +1988,7 @@ IDList *vlv_find_index_by_filter_txn(struct backend *be, const char *base,
 			}
 			if (!vi) {
 				/* no match */
-				LDAPDebug(LDAP_DEBUG_TRACE, "vlv: no index online for %s\n",
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "vlv: no index online for %s\n",
 					t->vlv_filter, 0, 0);
 				slapi_rwlock_unlock(be->vlvSearchList_lock);
 				return NULL;
@@ -2001,7 +2001,7 @@ IDList *vlv_find_index_by_filter_txn(struct backend *be, const char *base,
 				if (err == 0) {
 					if (length == 0) /* 609377: index size could be 0 */
 					{
-						LDAPDebug(LDAP_DEBUG_TRACE, "vlv: index %s is empty\n",
+						LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "vlv: index %s is empty\n",
 								t->vlv_filter, 0, 0);
 						idl = NULL;
 					}
@@ -2015,7 +2015,7 @@ IDList *vlv_find_index_by_filter_txn(struct backend *be, const char *base,
 				if (err == 0) {
 					return idl;
 				} else {
-					LDAPDebug(LDAP_DEBUG_ANY, "vlv find index: err %d\n",
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vlv find index: err %d\n",
 						err, 0, 0);
 					return NULL;
 				}
@@ -2077,7 +2077,7 @@ int vlv_delete_search_entry(Slapi_PBlock *pb, Slapi_Entry* e, ldbm_instance *ins
 
 	if (instance_set_busy(inst) != 0)
 	{
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"Backend instance: '%s' is already in the middle of "
 			"another task and cannot be disturbed.\n",
 			inst->inst_name, 0, 0);
@@ -2087,7 +2087,7 @@ int vlv_delete_search_entry(Slapi_PBlock *pb, Slapi_Entry* e, ldbm_instance *ins
 	base1 = slapi_create_dn_string("cn=MCC %s,cn=%s,cn=%s,cn=plugins,cn=config",
 					tag1, inst->inst_name, inst->inst_li->li_plugin->plg_name);
 	if (NULL == base1) {
-		LDAPDebug(LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				  "vlv_delete_search_entry: "
 				  "failed to craete vlv search entry dn (rdn: cn=MCC %s) for "
 				  "plugin %s, instance %s\n",
@@ -2101,11 +2101,11 @@ int vlv_delete_search_entry(Slapi_PBlock *pb, Slapi_Entry* e, ldbm_instance *ins
 	p = vlvSearch_finddn((struct vlvSearch *)be->vlvSearchList, newdn);
 	if(p!=NULL)
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "Deleted Virtual List View Search (%s).\n", p->vlv_name, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Deleted Virtual List View Search (%s).\n", p->vlv_name, 0, 0);
 		tag2=create_vlv_search_tag(dn);
 		base2 = slapi_create_dn_string("cn=by MCC %s,%s", tag2, base1);
 		if (NULL == base2) {
-			LDAPDebug(LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					  "vlv_delete_search_entry: failed to create "
 					  "vlv search entry dn (rdn: cn=by MCC %s) for "
 					  "plugin %s, instance %s\n",
@@ -2125,7 +2125,7 @@ int vlv_delete_search_entry(Slapi_PBlock *pb, Slapi_Entry* e, ldbm_instance *ins
 		slapi_delete_internal_pb(tmppb);
 		slapi_pblock_get (tmppb, SLAPI_PLUGIN_INTOP_RESULT, &rc); 
 		if(rc != LDAP_SUCCESS) {
-			LDAPDebug(LDAP_DEBUG_ANY, "vlv_delete_search_entry:can't delete dse entry '%s'\n", base2, 0, 0);			
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vlv_delete_search_entry:can't delete dse entry '%s'\n", base2, 0, 0);			
 		}
 		pblock_done(tmppb);
 		pblock_init(tmppb);
@@ -2134,7 +2134,7 @@ int vlv_delete_search_entry(Slapi_PBlock *pb, Slapi_Entry* e, ldbm_instance *ins
 		slapi_delete_internal_pb(tmppb);
 		slapi_pblock_get (tmppb, SLAPI_PLUGIN_INTOP_RESULT, &rc); 
 		if(rc != LDAP_SUCCESS) {
-			  LDAPDebug(LDAP_DEBUG_ANY, "vlv_delete_search_entry:can't delete dse entry '%s'\n", base1, 0, 0);
+			  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vlv_delete_search_entry:can't delete dse entry '%s'\n", base1, 0, 0);
 		}
 		slapi_pblock_destroy(tmppb);
 		slapi_ch_free((void **)&tag2);
@@ -2153,13 +2153,13 @@ bail:
 void
 vlv_acquire_lock(backend *be)
 {
-	LDAPDebug(LDAP_DEBUG_TRACE, "vlv_acquire_lock => trying to acquire the lock\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "vlv_acquire_lock => trying to acquire the lock\n", 0, 0, 0);
 	slapi_rwlock_wrlock(be->vlvSearchList_lock);
 }
 
 void
 vlv_release_lock(backend *be)
 {
-	LDAPDebug(LDAP_DEBUG_TRACE, "vlv_release_lock => trying to release the lock\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "vlv_release_lock => trying to release the lock\n", 0, 0, 0);
 	slapi_rwlock_unlock(be->vlvSearchList_lock);
 }
diff --git a/ldap/servers/slapd/back-ldbm/vlv_srch.c b/ldap/servers/slapd/back-ldbm/vlv_srch.c
index df37821..b9ea148 100644
--- a/ldap/servers/slapd/back-ldbm/vlv_srch.c
+++ b/ldap/servers/slapd/back-ldbm/vlv_srch.c
@@ -896,7 +896,7 @@ vlvIndex_createfilename(struct vlvIndex* pIndex, char **ppc)
     *p= '\0';
     if(strlen(filename)==0)
     {
-        LDAPDebug( LDAP_DEBUG_ANY, "Couldn't generate valid filename from Virtual List View Index Name (%s).  Need some alphabetical characters.\n", pIndex->vlv_name, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Couldn't generate valid filename from Virtual List View Index Name (%s).  Need some alphabetical characters.\n", pIndex->vlv_name, 0, 0);
         filenameValid= 0;
     }
     /* JCM: Check if this file clashes with another VLV Index filename */
diff --git a/ldap/servers/slapd/back-ldif/add.c b/ldap/servers/slapd/back-ldif/add.c
index c95041f..7ffa29e 100644
--- a/ldap/servers/slapd/back-ldif/add.c
+++ b/ldap/servers/slapd/back-ldif/add.c
@@ -46,7 +46,7 @@ ldif_back_add( Slapi_PBlock *pb )
   tprev = NULL;
 
   /*Turn on tracing to see this printed out*/
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> ldif_back_add\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldif_back_add\n", 0, 0, 0 );
 
   /*Get the database, the dn and the entry to add*/
   if (slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &db ) < 0 ||
@@ -58,14 +58,14 @@ ldif_back_add( Slapi_PBlock *pb )
 
   /*Check to make sure the entry passes the schema check*/
   if ( slapi_entry_schema_check( pb, e ) != 0 ) {
-    LDAPDebug( LDAP_DEBUG_TRACE, "entry failed schema check\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "entry failed schema check\n", 0, 0, 0 );
     slapi_send_ldap_result( pb, LDAP_OBJECT_CLASS_VIOLATION, NULL, NULL, 0, NULL );
     return( -1 );
   }
 
   /* Check if the attribute values in the entry obey the syntaxes */
   if ( slapi_entry_syntax_check( pb, e, 0 ) != 0 ) {
-    LDAPDebug( LDAP_DEBUG_TRACE, "entry failed syntax_check\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "entry failed syntax_check\n", 0, 0, 0 );
     slapi_send_ldap_result( pb, LDAP_INVALID_SYNTAX, NULL, NULL, 0, NULL );
     return( -1 );
   }
@@ -102,12 +102,12 @@ ldif_back_add( Slapi_PBlock *pb )
     int rc;
     if ((old = (ldif_Entry *)ldif_find_entry( pb, db, parentdn, &tprev)) == NULL ) {
       slapi_send_ldap_result( pb, LDAP_NO_SUCH_OBJECT, NULL, NULL, 0, NULL );
-      LDAPDebug( LDAP_DEBUG_TRACE, "parent does not exist\n", 0, 0, 0 );
+      LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "parent does not exist\n", 0, 0, 0 );
       goto error_return;
     }
     rc= slapi_access_allowed( pb, e, NULL, NULL, SLAPI_ACL_ADD );
     if ( rc!=LDAP_SUCCESS ) {
-      LDAPDebug( LDAP_DEBUG_TRACE, "no access to parent\n", 0,0, 0 );
+      LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "no access to parent\n", 0,0, 0 );
       slapi_send_ldap_result( pb, rc, NULL, NULL, 0, NULL );
       goto error_return;
     }
@@ -115,7 +115,7 @@ ldif_back_add( Slapi_PBlock *pb )
     int isroot;
 	slapi_pblock_get( pb, SLAPI_REQUESTOR_ISROOT, &isroot );
     if ( !isroot ) {
-      LDAPDebug( LDAP_DEBUG_TRACE, "no parent & not root\n", 0, 0, 0 );
+      LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "no parent & not root\n", 0, 0, 0 );
       slapi_send_ldap_result( pb, LDAP_INSUFFICIENT_ACCESS, NULL, NULL, 0, NULL );
       goto error_return;
     }
@@ -159,7 +159,7 @@ ldif_back_add( Slapi_PBlock *pb )
   if ( parentdn != NULL ){
     free( (void *)parentdn );
   }
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= ldif_back_add\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldif_back_add\n", 0, 0, 0 );
   return( 0 );
   
  error_return:;
diff --git a/ldap/servers/slapd/back-ldif/bind.c b/ldap/servers/slapd/back-ldif/bind.c
index 3e5feab..26ad44f 100644
--- a/ldap/servers/slapd/back-ldif/bind.c
+++ b/ldap/servers/slapd/back-ldif/bind.c
@@ -41,7 +41,7 @@ ldif_back_bind( Slapi_PBlock *pb )
   int			rc, syntax; /*Storage for error return values*/
   Slapi_Attr		*attr;
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> ldif_back_bind\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldif_back_bind\n", 0, 0, 0 );
 
   prev = NULL;
   
@@ -109,7 +109,7 @@ ldif_back_bind( Slapi_PBlock *pb )
   
   PR_Unlock( db->ldif_lock );  
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= ldif_back_bind\n", 0, 0, 0 );  
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldif_back_bind\n", 0, 0, 0 );  
 
   /* success:  front end will send result */
   return( SLAPI_BIND_SUCCESS );
diff --git a/ldap/servers/slapd/back-ldif/close.c b/ldap/servers/slapd/back-ldif/close.c
index 15ee884..617c9ec 100644
--- a/ldap/servers/slapd/back-ldif/close.c
+++ b/ldap/servers/slapd/back-ldif/close.c
@@ -63,10 +63,10 @@ ldif_back_close( Slapi_PBlock *pb )
 {
   LDIF   *db;
   
-  LDAPDebug( LDAP_DEBUG_TRACE, "ldif backend syncing\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldif backend syncing\n", 0, 0, 0 );
   slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &db );
   ldif_free_db(db);
-  LDAPDebug( LDAP_DEBUG_TRACE, "ldif backend done syncing\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldif backend done syncing\n", 0, 0, 0 );
 }
 
 /*
@@ -79,8 +79,8 @@ ldif_back_close( Slapi_PBlock *pb )
 void
 ldif_back_flush( Slapi_PBlock *pb )
 {
-  LDAPDebug( LDAP_DEBUG_TRACE, "ldif backend flushing\n", 0, 0, 0 );
-  LDAPDebug( LDAP_DEBUG_TRACE, "ldif backend done flushing\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldif backend flushing\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ldif backend done flushing\n", 0, 0, 0 );
   return;
 }
 
diff --git a/ldap/servers/slapd/back-ldif/compare.c b/ldap/servers/slapd/back-ldif/compare.c
index 272adc0..3d22371 100644
--- a/ldap/servers/slapd/back-ldif/compare.c
+++ b/ldap/servers/slapd/back-ldif/compare.c
@@ -39,7 +39,7 @@ ldif_back_compare( Slapi_PBlock *pb )
   Slapi_Attr	*attr;
   int rc;
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> ldif_back_compare\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldif_back_compare\n", 0, 0, 0 );
   prev = NULL;
 
   if (slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &db ) < 0 ||
@@ -84,7 +84,7 @@ ldif_back_compare( Slapi_PBlock *pb )
   
   slapi_send_ldap_result( pb, LDAP_COMPARE_FALSE, NULL, NULL, 0, NULL );
   PR_Unlock( db->ldif_lock );
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= ldif_back_compare\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldif_back_compare\n", 0, 0, 0 );
   return( 0 );
 }
 
diff --git a/ldap/servers/slapd/back-ldif/config.c b/ldap/servers/slapd/back-ldif/config.c
index f5678af..adccb05 100644
--- a/ldap/servers/slapd/back-ldif/config.c
+++ b/ldap/servers/slapd/back-ldif/config.c
@@ -51,7 +51,7 @@ ldif_back_config( Slapi_PBlock *pb )
   Slapi_Entry *tmp;                 /*Used for initialization purposes*/
 
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> ldif_back_config\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldif_back_config\n", 0, 0, 0 );
   
   /* 
    * Get the private_info structure you created in ldif_back_init(). 
@@ -63,7 +63,7 @@ ldif_back_config( Slapi_PBlock *pb )
       slapi_pblock_get( pb, SLAPI_CONFIG_LINENO, &lineno ) < 0 ||
       slapi_pblock_get( pb, SLAPI_CONFIG_ARGC, &argc ) < 0 ||
       slapi_pblock_get( pb, SLAPI_CONFIG_ARGV, &argv ) < 0 ){
-    LDAPDebug(LDAP_DEBUG_ANY, "Ldif Backend: unable to get data from front end\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ldif Backend: unable to get data from front end\n", 0, 0, 0);
     return(-1);
   }
 
@@ -80,14 +80,14 @@ ldif_back_config( Slapi_PBlock *pb )
   
   /*Check for the correct number of arguments*/
   if (argc != 2){
-    LDAPDebug(LDAP_DEBUG_ANY, "Ldif Backend: Unable to configure; invalid ldif input file specification line format (file: %s, line: %d)\n", 
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ldif Backend: Unable to configure; invalid ldif input file specification line format (file: %s, line: %d)\n", 
 	    fname, lineno, 0); 
     return(-1);
   }
   
   /*Check for the right format*/
   if (strcmp(argv[0], "file") != 0){
-    LDAPDebug(LDAP_DEBUG_ANY, "Ldif Backend: unable to configure; invalid parameter \"%s\" in config file (file: %s, line: %d)\n", 
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ldif Backend: unable to configure; invalid parameter \"%s\" in config file (file: %s, line: %d)\n", 
 	    argv[0], fname, lineno ); 
     return(-1);
   }
@@ -95,10 +95,10 @@ ldif_back_config( Slapi_PBlock *pb )
   /*Now we fopen the file and grab up the contents*/
   fp = fopen (argv[1], "r");
   if (fp == NULL){
-    LDAPDebug(LDAP_DEBUG_ANY, "Ldif Backend: unable to read ldif file %s\n", argv[1], 0, 0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ldif Backend: unable to read ldif file %s\n", argv[1], 0, 0);
     fp = fopen (argv[1], "w");
     if(fp == NULL){
-      LDAPDebug(LDAP_DEBUG_ANY, "Ldif Backend: unable to create ldif file %s\n", argv[1], 0, 0);
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ldif Backend: unable to create ldif file %s\n", argv[1], 0, 0);
       return -1;
     }
   }
@@ -110,7 +110,7 @@ ldif_back_config( Slapi_PBlock *pb )
 
   /*Save the filename, for modifications to the file later*/
   if ((db->ldif_file = strdup(argv[1])) == NULL){
-    LDAPDebug(LDAP_DEBUG_ANY, "Ldif Backend: out of memory\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ldif Backend: out of memory\n", 0, 0, 0);
     PR_Unlock( db->ldif_lock );
     fclose(fp);
     return(-1);
@@ -127,7 +127,7 @@ ldif_back_config( Slapi_PBlock *pb )
 				SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF);
     new = (ldif_Entry *) ldifentry_init(tmp);
     if (new == NULL){
-      LDAPDebug(LDAP_DEBUG_ANY, "Ldif Backend: unable to read in ldif file; out of memory\n",0 ,0 ,0 );
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ldif Backend: unable to read in ldif file; out of memory\n",0 ,0 ,0 );
       PR_Unlock( db->ldif_lock );
       fclose(fp);
       return(-1);
@@ -159,7 +159,7 @@ ldif_back_config( Slapi_PBlock *pb )
   PR_Unlock( db->ldif_lock );
   fclose(fp);
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= ldif_back_config\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldif_back_config\n", 0, 0, 0 );
   return( 0 );
 }
 
diff --git a/ldap/servers/slapd/back-ldif/delete.c b/ldap/servers/slapd/back-ldif/delete.c
index 0060214..52da14c 100644
--- a/ldap/servers/slapd/back-ldif/delete.c
+++ b/ldap/servers/slapd/back-ldif/delete.c
@@ -38,7 +38,7 @@ ldif_back_delete( Slapi_PBlock *pb )
   char			*dn;         /*Storage for the dn*/
   int rc;
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> ldif_back_delete\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldif_back_delete\n", 0, 0, 0 );
 
   prev = NULL;
   
@@ -56,7 +56,7 @@ ldif_back_delete( Slapi_PBlock *pb )
   bye = (ldif_Entry *) ldif_find_entry(pb, db, dn, &prev);
   if (bye == NULL) {
     slapi_send_ldap_result( pb, LDAP_NO_SUCH_OBJECT, NULL, NULL, 0, NULL );
-    LDAPDebug( LDAP_DEBUG_TRACE, "entry for delete does not exist\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "entry for delete does not exist\n", 0, 0, 0 );
     PR_Unlock( db->ldif_lock );
     return(-1);
   }
@@ -87,7 +87,7 @@ ldif_back_delete( Slapi_PBlock *pb )
   /*Success*/
   slapi_send_ldap_result( pb, LDAP_SUCCESS, NULL, NULL, 0, NULL );
   PR_Unlock( db->ldif_lock );
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= ldif_back_delete\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldif_back_delete\n", 0, 0, 0 );
   return( 0 );
 }
 
@@ -106,7 +106,7 @@ has_children(LDIF *db, ldif_Entry *p)
   ldif_Entry *cur;  /*Used to walk down the list*/
   int  has_kid = 0; /*Flag to return*/
   
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> has_children\n", 0, 0, 0);
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> has_children\n", 0, 0, 0);
 
   /*If there is no p or db, then there can be no children*/
   if (p == NULL || db == NULL){
@@ -135,7 +135,7 @@ has_children(LDIF *db, ldif_Entry *p)
 
   free( (void *) parentdn );
     
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= has_children %d\n", has_kid, 0, 0);
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= has_children %d\n", has_kid, 0, 0);
   return( has_kid );
 }
 
diff --git a/ldap/servers/slapd/back-ldif/init.c b/ldap/servers/slapd/back-ldif/init.c
index 2564684..31eabee 100644
--- a/ldap/servers/slapd/back-ldif/init.c
+++ b/ldap/servers/slapd/back-ldif/init.c
@@ -39,7 +39,7 @@ ldif_back_init( Slapi_PBlock *pb )
   LDIF *db;    /*This will hold the ldif file in memory*/
   int rc;
   
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> ldif_back_init\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldif_back_init\n", 0, 0, 0 );
   
   /*
    * Allocate and initialize db with everything we
@@ -52,7 +52,7 @@ ldif_back_init( Slapi_PBlock *pb )
   /*Allocate memory for our database and check if success*/
   db = (LDIF *) malloc( sizeof(LDIF) );
   if (db == NULL) {
-    LDAPDebug(LDAP_DEBUG_ANY, "Ldif Backend: unable to initialize; out of memory\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ldif Backend: unable to initialize; out of memory\n", 0, 0, 0);
     return(-1);
   }
   
@@ -64,7 +64,7 @@ ldif_back_init( Slapi_PBlock *pb )
   db->ldif_file = NULL;
   db->ldif_lock = PR_NewLock();
   if (&db->ldif_lock == NULL) {
-    LDAPDebug(LDAP_DEBUG_ANY, "Ldif Backend: Lock creation failed\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ldif Backend: Lock creation failed\n", 0, 0, 0);
     return(-1);
   }
 
@@ -102,11 +102,11 @@ ldif_back_init( Slapi_PBlock *pb )
   rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_START_FN,
       (void *) ldif_back_start );
   if (rc != 0) {
-    LDAPDebug(LDAP_DEBUG_ANY, "Ldif Backend: unable to pass database information to front end\n",0 ,0 ,0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ldif Backend: unable to pass database information to front end\n",0 ,0 ,0);
     return(-1);
   }
   
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= ldif_back_init\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldif_back_init\n", 0, 0, 0 );
   
   return( 0 );
 }
diff --git a/ldap/servers/slapd/back-ldif/modify.c b/ldap/servers/slapd/back-ldif/modify.c
index 45d52fb..73c51e9 100644
--- a/ldap/servers/slapd/back-ldif/modify.c
+++ b/ldap/servers/slapd/back-ldif/modify.c
@@ -53,7 +53,7 @@ ldif_back_modify( Slapi_PBlock *pb )
   char	     *dn;                   /*Storage for the dn*/
   char	     *errbuf = NULL;	    /* To get error back */
   
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> ldif_back_modify\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldif_back_modify\n", 0, 0, 0 );
   prev = NULL;
 
   /*Get the database, the dn and the mods*/
@@ -134,7 +134,7 @@ ldif_back_modify( Slapi_PBlock *pb )
 
   slapi_send_ldap_result( pb, LDAP_SUCCESS, NULL, NULL, 0, NULL );
   PR_Unlock( db->ldif_lock );
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= ldif_back_modify\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldif_back_modify\n", 0, 0, 0 );
   return( 0 );
   
  error_return:;
@@ -528,27 +528,27 @@ apply_mods( Slapi_Entry *e, LDAPMod **mods )
 {
   int     err, i, j;
   
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> apply_mods\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> apply_mods\n", 0, 0, 0 );
   
   err = LDAP_SUCCESS;
   for ( j = 0; (mods != NULL) && (mods[j] != NULL); j++ ) {
     switch ( mods[j]->mod_op & ~LDAP_MOD_BVALUES ) {
     case LDAP_MOD_ADD:
-      LDAPDebug( LDAP_DEBUG_ARGS, "   add: %s\n",
+      LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   add: %s\n",
 		mods[j]->mod_type, 0, 0 );
       err = slapi_entry_add_values( e, mods[j]->mod_type,
 			     mods[j]->mod_bvalues );
       break;
       
     case LDAP_MOD_DELETE:
-      LDAPDebug( LDAP_DEBUG_ARGS, "   delete: %s\n",
+      LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   delete: %s\n",
 		mods[j]->mod_type, 0, 0 );
       err = slapi_entry_delete_values( e, mods[j]->mod_type,
 				mods[j]->mod_bvalues );
       break;
       
     case LDAP_MOD_REPLACE:
-      LDAPDebug( LDAP_DEBUG_ARGS, "   replace: %s\n",
+      LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   replace: %s\n",
 		mods[j]->mod_type, 0, 0 );
       err = entry_replace_values( e, mods[j]->mod_type,
 				 mods[j]->mod_bvalues );
@@ -556,17 +556,17 @@ apply_mods( Slapi_Entry *e, LDAPMod **mods )
     }
     for ( i = 0; mods[j]->mod_bvalues != NULL &&
 	 mods[j]->mod_bvalues[i] != NULL; i++ ) {
-      LDAPDebug( LDAP_DEBUG_ARGS, "   %s: %s\n",
+      LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   %s: %s\n",
 		mods[j]->mod_type, mods[j]->mod_bvalues[i]->bv_val,
 		0 );
     }
-    LDAPDebug( LDAP_DEBUG_ARGS, "   -\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   -\n", 0, 0, 0 );
     
     if ( err != LDAP_SUCCESS ) {
       break;
     }
   }
   
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= apply_mods %d\n", err, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= apply_mods %d\n", err, 0, 0 );
   return( err );
 }
diff --git a/ldap/servers/slapd/back-ldif/modrdn.c b/ldap/servers/slapd/back-ldif/modrdn.c
index ae79834..720e97e 100644
--- a/ldap/servers/slapd/back-ldif/modrdn.c
+++ b/ldap/servers/slapd/back-ldif/modrdn.c
@@ -48,7 +48,7 @@ ldif_back_modrdn( Slapi_PBlock *pb )
   LDAPMod       **mods;               /*Holds the list of modifications*/
   int rc;
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> ldif_back_modrdn\n", 0, 0, 0 );  
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldif_back_modrdn\n", 0, 0, 0 );  
 
   prev = NULL;
 
@@ -106,7 +106,7 @@ ldif_back_modrdn( Slapi_PBlock *pb )
     /* parent + rdn + separator(s) + null */
     newdn = (char *) malloc( strlen( pdn ) + strlen( newrdn ) + 3 );
     if (newdn == NULL){
-      LDAPDebug( LDAP_DEBUG_ANY,"malloc failed", 0, 0, 0 );
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"malloc failed", 0, 0, 0 );
       exit(1);
     }
 
@@ -197,7 +197,7 @@ ldif_back_modrdn( Slapi_PBlock *pb )
   /*Unlock the database, and tell the user the good news*/
   PR_Unlock( db->ldif_lock );
   slapi_send_ldap_result( pb, LDAP_SUCCESS, NULL, NULL, 0, NULL );
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= ldif_back_modrdn\n", 0, 0, 0 );  
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldif_back_modrdn\n", 0, 0, 0 );  
   return( 0 );
   
 error_return:;
@@ -254,19 +254,19 @@ ldif_add_mod( LDAPMod ***modlist, int modtype, char *type, struct berval **bvps
 				     (i + 2) * sizeof(LDAPMod *) );
 
   if (*modlist == NULL){
-    LDAPDebug( LDAP_DEBUG_ANY, "realloc failed", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "realloc failed", 0, 0, 0 );
     exit(1);
   }
   (*modlist)[i] = (LDAPMod *) malloc( sizeof(LDAPMod) );
 
   if ((*modlist)[i] == NULL){
-    LDAPDebug( LDAP_DEBUG_ANY,"malloc failed", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"malloc failed", 0, 0, 0 );
     exit(1);
   }
 
   (*modlist)[i]->mod_type = (char *) strdup( type );
   if ((*modlist)[i]->mod_type == NULL){
-    LDAPDebug( LDAP_DEBUG_ANY,"strdup failed", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"strdup failed", 0, 0, 0 );
     exit(1);
   }
 
@@ -274,7 +274,7 @@ ldif_add_mod( LDAPMod ***modlist, int modtype, char *type, struct berval **bvps
   (*modlist)[i]->mod_op = modtype;
   (*modlist)[i]->mod_bvalues = (struct berval **) malloc(2*sizeof(struct berval *));
   if ((*modlist)[i]->mod_bvalues == NULL){
-    LDAPDebug( LDAP_DEBUG_ANY,"malloc failed",0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"malloc failed",0, 0, 0 );
     exit(1);
   }
   (*modlist)[i]->mod_bvalues[0] = ber_bvdup( bvps[0] );
diff --git a/ldap/servers/slapd/back-ldif/search.c b/ldap/servers/slapd/back-ldif/search.c
index 70c4d44..07a0936 100644
--- a/ldap/servers/slapd/back-ldif/search.c
+++ b/ldap/servers/slapd/back-ldif/search.c
@@ -50,7 +50,7 @@ ldif_back_search( Slapi_PBlock *pb )
   char          *freeme;   /*Tmp storage for monitordn*/
   time_t        currtime;  /*The current time*/
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> ldif_back_search\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ldif_back_search\n", 0, 0, 0 );
   
   /* 
    * Get private information created in the init routine. 
@@ -199,7 +199,7 @@ ldif_back_search( Slapi_PBlock *pb )
   /* Search is done, send LDAP_SUCCESS */
   slapi_send_ldap_result( pb, LDAP_SUCCESS, NULL, NULL, nentries, NULL );
   PR_Unlock( db->ldif_lock );
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= ldif_back_search\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ldif_back_search\n", 0, 0, 0 );
   return( -1 );
   
 }
diff --git a/ldap/servers/slapd/backend_manager.c b/ldap/servers/slapd/backend_manager.c
index 9084d95..e8ea06f 100644
--- a/ldap/servers/slapd/backend_manager.c
+++ b/ldap/servers/slapd/backend_manager.c
@@ -155,7 +155,7 @@ slapi_get_next_backend (char *cookie)
 	int i, last_be;
 	if (cookie == NULL)
 	{
-		LDAPDebug( LDAP_DEBUG_ARGS, "slapi_get_next_backend: NULL argument\n", 
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "slapi_get_next_backend: NULL argument\n", 
 				  0, 0, 0 );
 		return NULL;
 	}
@@ -164,7 +164,7 @@ slapi_get_next_backend (char *cookie)
 
 	if ( last_be < 0 || last_be >= maxbackends)
 	{
-		LDAPDebug( LDAP_DEBUG_ARGS, "slapi_get_next_backend: argument out of range\n", 
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "slapi_get_next_backend: argument out of range\n", 
 				  0, 0, 0 );
 		return NULL;
 	}
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index 3054c1f..5c4a53c 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -109,7 +109,7 @@ do_bind( Slapi_PBlock *pb )
     int minssf_exclude_rootdse = 0;
     Slapi_DN *original_sdn = NULL;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "do_bind\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_bind\n", 0, 0, 0 );
 
     /*
      * Parse the bind request.  It looks like this:
@@ -133,7 +133,7 @@ do_bind( Slapi_PBlock *pb )
 
     ber_rc = ber_scanf( ber, "{iat", &version, &rawdn, &method );
     if ( ber_rc == LBER_ERROR ) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "ber_scanf failed (op=Bind; params=Version,DN,Method)\n",
                    0, 0, 0 );
         log_bind_access (pb, "???", method, version, saslmech, "decoding error");
@@ -165,7 +165,7 @@ do_bind( Slapi_PBlock *pb )
         slapi_sdn_free(&sdn);
         return;
     }
-    LDAPDebug( LDAP_DEBUG_TRACE, "BIND dn=\"%s\" method=%" BERTAG_T " version=%d\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "BIND dn=\"%s\" method=%" BERTAG_T " version=%d\n",
                dn?dn:"empty", method, version );
 
     /* target spec is used to decide which plugins are applicable for the operation */
@@ -174,7 +174,7 @@ do_bind( Slapi_PBlock *pb )
     switch ( method ) {
     case LDAP_AUTH_SASL:
         if ( version < LDAP_VERSION3 ) {
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                        "got SASL credentials from LDAPv2 client\n",
                        0, 0, 0 );
             log_bind_access (pb, dn?dn:"empty", method, version, saslmech, "SASL credentials only in LDAPv3");
@@ -205,7 +205,7 @@ do_bind( Slapi_PBlock *pb )
             static char *kmsg = 
                 "LDAPv2-style kerberos authentication received "
                 "on LDAPv3 connection.";
-            LDAPDebug( LDAP_DEBUG_ANY, kmsg, 0, 0, 0 );
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, kmsg, 0, 0, 0 );
             log_bind_access (pb, dn?dn:"empty", method, version, saslmech, kmsg);
             send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL,
                               kmsg, 0, NULL );
@@ -225,7 +225,7 @@ do_bind( Slapi_PBlock *pb )
         goto free_and_return;
     }
     if ( ber_rc == LBER_ERROR ) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "ber_scanf failed (op=Bind; params=Credentials)\n",
                    0, 0, 0 );
         log_bind_access (pb, dn?dn:"empty", method, version, saslmech, "decoding error");
@@ -324,14 +324,14 @@ do_bind( Slapi_PBlock *pb )
         }
         break;
     default:
-        LDAPDebug( LDAP_DEBUG_TRACE, "bind: unknown LDAP protocol version %d\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "bind: unknown LDAP protocol version %d\n",
                    version, 0, 0 );
         send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL,
                           "version not supported", 0, NULL );
         goto free_and_return;
     }
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "do_bind: version %d method 0x%x dn %s\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_bind: version %d method 0x%x dn %s\n",
                version, method, dn );
     pb->pb_conn->c_ldapversion = version;
 
diff --git a/ldap/servers/slapd/compare.c b/ldap/servers/slapd/compare.c
index 3977452..d206ba8 100644
--- a/ldap/servers/slapd/compare.c
+++ b/ldap/servers/slapd/compare.c
@@ -43,7 +43,7 @@ do_compare( Slapi_PBlock *pb )
 	Slapi_Entry *referral = NULL;
 	char errorbuf[SLAPI_DSE_RETURNTEXT_SIZE];
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_compare\n", 0, 0, 0 );
 
 	/* count the compare request */
 	slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsCompareOps);
@@ -65,7 +65,7 @@ do_compare( Slapi_PBlock *pb )
 
 	if ( ber_scanf( ber, "{a{ao}}", &rawdn, &ava.ava_type,
 	    &ava.ava_value ) == LBER_ERROR ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "ber_scanf failed (op=Compare; params=DN,Type,Value)\n",
 		    0, 0, 0 );
 		send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL, NULL, 0,
@@ -108,7 +108,7 @@ do_compare( Slapi_PBlock *pb )
 	/* target spec is used to decide which plugins are applicable for the operation */
 	operation_set_target_spec (pb->pb_op, &sdn);
 
-	LDAPDebug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s)\n",
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "do_compare: dn (%s) attr (%s)\n",
 	    rawdn, ava.ava_type, 0 );
 
 	slapi_log_access( LDAP_DEBUG_STATS,
diff --git a/ldap/servers/slapd/config.c b/ldap/servers/slapd/config.c
index fd31b7b..0da897a 100644
--- a/ldap/servers/slapd/config.c
+++ b/ldap/servers/slapd/config.c
@@ -210,7 +210,7 @@ slapd_bootstrap_config(const char *configdir)
 							SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF);
 				if (e == NULL)
 				{
-					  LDAPDebug(LDAP_DEBUG_ANY, "The entry [%s] in the configfile %s was empty or could not be parsed\n",
+					  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "The entry [%s] in the configfile %s was empty or could not be parsed\n",
 								entrystr, configfile, 0);
 					continue;
 				}
@@ -224,7 +224,7 @@ slapd_bootstrap_config(const char *configdir)
 									maxdescriptors, errorbuf, CONFIG_APPLY)
 						!= LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								  CONFIG_MAXDESCRIPTORS_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -240,7 +240,7 @@ slapd_bootstrap_config(const char *configdir)
 						logenabled, SLAPD_ERROR_LOG, errorbuf, CONFIG_APPLY)
 						!= LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								  CONFIG_ERRORLOG_LOGGING_ENABLED_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -253,7 +253,7 @@ slapd_bootstrap_config(const char *configdir)
 					if (config_set_localuser(CONFIG_LOCALUSER_ATTRIBUTE,
 						_localuser, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s. \n", configfile,
 								  CONFIG_LOCALUSER_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -267,7 +267,7 @@ slapd_bootstrap_config(const char *configdir)
 					if (config_set_errorlog(CONFIG_ERRORLOG_ATTRIBUTE,
 						workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s. \n", configfile,
 								  CONFIG_ERRORLOG_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -281,13 +281,13 @@ slapd_bootstrap_config(const char *configdir)
 						if (config_set_errorlog_level(CONFIG_LOGLEVEL_ATTRIBUTE,
 							loglevel, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 						{
-							LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
+							LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s. \n", configfile,
 									  CONFIG_LOGLEVEL_ATTRIBUTE, errorbuf);
 						}
 					}
 					else
 					{
-						LDAPDebug(LDAP_DEBUG_ANY,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 								  "%s: ignoring %s (since -d %d was given on "
 								  "the command line)\n",
 								  CONFIG_LOGLEVEL_ATTRIBUTE, loglevel,
@@ -303,7 +303,7 @@ slapd_bootstrap_config(const char *configdir)
 					if (config_set_certdir(CONFIG_CERTDIR_ATTRIBUTE,
 							workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s. \n", configfile,
 									  CONFIG_CERTDIR_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -316,7 +316,7 @@ slapd_bootstrap_config(const char *configdir)
 					if (config_set_saslpath(CONFIG_SASLPATH_ATTRIBUTE,
 							workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s. \n", configfile,
 									  CONFIG_SASLPATH_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -329,7 +329,7 @@ slapd_bootstrap_config(const char *configdir)
 					if (config_set_ldapi_filename(CONFIG_LDAPI_FILENAME_ATTRIBUTE,
 							workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s. \n", configfile,
 									  CONFIG_LDAPI_FILENAME_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -342,7 +342,7 @@ slapd_bootstrap_config(const char *configdir)
 					if (config_set_ldapi_switch(CONFIG_LDAPI_SWITCH_ATTRIBUTE,
 							workpath, errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s. \n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s. \n", configfile,
 									  CONFIG_LDAPI_SWITCH_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -361,7 +361,7 @@ slapd_bootstrap_config(const char *configdir)
 						/* add the syntax/matching scheme rule plugin */
 						if (plugin_setup(e, 0, 0, 1, returntext))
 						{
-							LDAPDebug(LDAP_DEBUG_ANY, "The plugin entry [%s] in the configfile %s was invalid. %s\n",
+							LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "The plugin entry [%s] in the configfile %s was invalid. %s\n",
 							          slapi_entry_get_dn(e), configfile, returntext);
 							rc = 0;
 							slapi_sdn_done(&plug_dn);
@@ -384,7 +384,7 @@ slapd_bootstrap_config(const char *configdir)
 						/* add the pwd storage scheme rule plugin */
 						if (plugin_setup(e, 0, 0, 1, returntext))
 						{
-							LDAPDebug(LDAP_DEBUG_ANY, "The plugin entry [%s] in the configfile %s was invalid. %s\n",
+							LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "The plugin entry [%s] in the configfile %s was invalid. %s\n",
 							          slapi_entry_get_dn(e), configfile, returntext);
 							rc = 0;
 							slapi_sdn_done(&plug_dn);
@@ -402,7 +402,7 @@ slapd_bootstrap_config(const char *configdir)
 								schemacheck, errorbuf, CONFIG_APPLY)
 								!= LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								  CONFIG_SCHEMACHECK_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -416,7 +416,7 @@ slapd_bootstrap_config(const char *configdir)
 							plugintracking, errorbuf, CONFIG_APPLY)
 								!= LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								CONFIG_PLUGIN_BINDDN_TRACKING_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -430,7 +430,7 @@ slapd_bootstrap_config(const char *configdir)
 								moddn_aci, errorbuf, CONFIG_APPLY)
 								!= LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								  CONFIG_MODDN_ACI_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -444,7 +444,7 @@ slapd_bootstrap_config(const char *configdir)
 					                           syntaxcheck, errorbuf, CONFIG_APPLY)
 						                   != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 						          CONFIG_SYNTAXCHECK_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -458,7 +458,7 @@ slapd_bootstrap_config(const char *configdir)
 					                          syntaxlogging, errorbuf, CONFIG_APPLY)
 					                          != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 						          CONFIG_SYNTAXLOGGING_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -472,7 +472,7 @@ slapd_bootstrap_config(const char *configdir)
 					                           dn_validate_strict, errorbuf, CONFIG_APPLY)
 					                           != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 						          CONFIG_DN_VALIDATE_STRICT_ATTRIBUTE, errorbuf);
 					}
 				}
@@ -485,7 +485,7 @@ slapd_bootstrap_config(const char *configdir)
 								CONFIG_ENQUOTE_SUP_OC_ATTRIBUTE, val, errorbuf, 
 								CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								  CONFIG_ENQUOTE_SUP_OC_ATTRIBUTE, errorbuf);
 					}
 					val[0] = 0;
@@ -499,7 +499,7 @@ slapd_bootstrap_config(const char *configdir)
 								CONFIG_RETURN_EXACT_CASE_ATTRIBUTE, val,
 								errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								  CONFIG_RETURN_EXACT_CASE_ATTRIBUTE, errorbuf);
 					}
 					val[0] = 0;
@@ -514,7 +514,7 @@ slapd_bootstrap_config(const char *configdir)
 								CONFIG_ATTRIBUTE_NAME_EXCEPTION_ATTRIBUTE, val,
 								errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								  CONFIG_ATTRIBUTE_NAME_EXCEPTION_ATTRIBUTE,
 								  errorbuf);
 					}
@@ -529,7 +529,7 @@ slapd_bootstrap_config(const char *configdir)
 								CONFIG_DS4_COMPATIBLE_SCHEMA_ATTRIBUTE, val,
 								errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								  CONFIG_DS4_COMPATIBLE_SCHEMA_ATTRIBUTE,
 								  errorbuf);
 					}
@@ -544,7 +544,7 @@ slapd_bootstrap_config(const char *configdir)
 								CONFIG_SCHEMA_IGNORE_TRAILING_SPACES, val,
 								errorbuf, CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								  CONFIG_SCHEMA_IGNORE_TRAILING_SPACES,
 								  errorbuf);
 					}
@@ -558,7 +558,7 @@ slapd_bootstrap_config(const char *configdir)
 				  if (config_set_rewrite_rfc1274(
 								 CONFIG_REWRITE_RFC1274_ATTRIBUTE, val, 
 								 errorbuf, CONFIG_APPLY) != LDAP_SUCCESS) {
-				    LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", 
+				    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", 
 					      configfile,
 					      CONFIG_REWRITE_RFC1274_ATTRIBUTE, 
 					      errorbuf);
@@ -574,7 +574,7 @@ slapd_bootstrap_config(const char *configdir)
 								CONFIG_LOCALHOST_ATTRIBUTE, val, errorbuf, 
 								CONFIG_APPLY) != LDAP_SUCCESS)
 					{
-						LDAPDebug(LDAP_DEBUG_ANY, "%s: %s: %s\n", configfile,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s: %s: %s\n", configfile,
 								  CONFIG_LOCALHOST_ATTRIBUTE, errorbuf);
 					}
 					val[0] = 0;
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index de27d81..14bafa3 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -250,7 +250,7 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
     char *str_unknown = "unknown";
     int in_referral_mode = config_check_referral_mode();
 
-    LDAPDebug( LDAP_DEBUG_CONNS, "new %sconnection on %d\n", pTmp, conn->c_sd, 0 );
+    LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG, "new %sconnection on %d\n", pTmp, conn->c_sd, 0 );
 
     /* bump our count of connections and update SNMP stats */
     conn->c_connid = slapi_counter_increment(num_conns);
@@ -431,7 +431,7 @@ init_op_threads()
 
 	if ((work_q_lock = PR_NewLock()) == NULL ) {
 		errorCode = PR_GetError();
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"init_op_threads: PR_NewLock failed for work_q_lock, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 			errorCode, slapd_pr_strerror(errorCode), 0 );
 		exit(-1);
@@ -439,7 +439,7 @@ init_op_threads()
 
 	if ((work_q_cv = PR_NewCondVar( work_q_lock )) == NULL) {
 		errorCode = PR_GetError();
-		LDAPDebug( LDAP_DEBUG_ANY, "init_op_threads: PR_NewCondVar failed for work_q_cv, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "init_op_threads: PR_NewCondVar failed for work_q_cv, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 			errorCode, slapd_pr_strerror(errorCode), 0 );
 		exit(-1);
 	}
@@ -458,7 +458,7 @@ init_op_threads()
 		                     SLAPD_DEFAULT_THREAD_STACKSIZE ) == NULL )
 		{
 			int prerr = PR_GetError();
-			LDAPDebug( LDAP_DEBUG_ANY, "PR_CreateThread failed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "PR_CreateThread failed, " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 				prerr, slapd_pr_strerror( prerr ), 0 );
 		} else {
 			g_incr_active_threadcnt();
@@ -643,7 +643,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
 			int i = 1;
 			int ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
 			if (ret < 0) {
-				LDAPDebug(LDAP_DEBUG_ANY, "Failed to set TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid, 0, 0);
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to set TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid, 0, 0);
 			}
 			pop_cork = 1;
 		}
@@ -656,7 +656,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
 			int i = 0;
 			int ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
 			if (ret < 0) {
-				LDAPDebug(LDAP_DEBUG_ANY, "Failed to clear TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid, 0, 0);
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to clear TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid, 0, 0);
 			}
 		}
 #endif
@@ -681,7 +681,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
 		break;
 
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "ignoring unknown LDAP request (conn=%" NSPRIu64 ", tag=0x%lx)\n",
 		    conn->c_connid, op->o_tag, 0 );
 		break;
@@ -1061,7 +1061,7 @@ get_next_from_buffer( void *buffer, size_t buffer_size, ber_len_t *lenp,
 		}
 		syserr = errno;
 		/* Bad stuff happened, like the client sent us some junk */
-		LDAPDebug( LDAP_DEBUG_CONNS,
+		LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
 			"ber_get_next failed for connection %" NSPRIu64 "\n", conn->c_connid, 0, 0 );
 		/* reset private buffer */
 		conn->c_private->c_buffer_bytes = conn->c_private->c_buffer_offset = 0;
@@ -1223,7 +1223,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 					} else {
 						/* Otherwise we loop, unless we exceeded the ioblock timeout */
 						if (waits_done > ioblocktimeout_waits) {
-							LDAPDebug( LDAP_DEBUG_CONNS,"ioblock timeout expired on connection %" NSPRIu64 "\n", conn->c_connid, 0, 0 );
+							LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,"ioblock timeout expired on connection %" NSPRIu64 "\n", conn->c_connid, 0, 0 );
 							disconnect_server_nomutex( conn, conn->c_connid, -1,
 									SLAPD_DISCONNECT_IO_TIMEOUT, 0 );
 							ret = CONN_DONE;
@@ -1243,19 +1243,19 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 					/* PR_Poll call failed */
 					err = PR_GetError();
 					syserr = PR_GetOSError();
-					LDAPDebug( LDAP_DEBUG_ANY,
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 						"PR_Poll for connection %" NSPRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
 					/* If this happens we should close the connection */
 					disconnect_server_nomutex( conn, conn->c_connid, -1, err, syserr );
 					ret = CONN_DONE;
 					goto done;
 				}
-				LDAPDebug( LDAP_DEBUG_CONNS,
+				LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
 					   "connection %" NSPRIu64 " waited %d times for read to be ready\n", conn->c_connid, waits_done, 0 );
 			} else {
 				/* Some other error, typically meaning bad stuff */
 					syserr = PR_GetOSError();
-					LDAPDebug( LDAP_DEBUG_CONNS,
+					LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
 						"PR_Recv for connection %" NSPRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
 					/* If this happens we should close the connection */
 					disconnect_server_nomutex( conn, conn->c_connid, -1, err, syserr );
@@ -1276,7 +1276,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 					goto done;
 				}
 			}
-			LDAPDebug( LDAP_DEBUG_CONNS,
+			LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
 				   "connection %" NSPRIu64 " read %d bytes\n", conn->c_connid, ret, 0 );
 
 			new_operation = 0;
@@ -1297,7 +1297,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 		/*
 		 * We received a non-LDAP message.  Log and close connection.
 		 */
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"conn=%" NSPRIu64 " received a non-LDAP message (tag 0x%lx, expected 0x%lx)\n",
 			conn->c_connid, *tag, LDAP_TAG_MESSAGE );
 		disconnect_server_nomutex( conn, conn->c_connid, -1,
@@ -1309,7 +1309,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 	if ( (*tag = ber_get_int( op->o_ber, &msgid ))
 		!= LDAP_TAG_MSGID ) {
 		/* log, close and send error */
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"conn=%" NSPRIu64 " unable to read tag for incoming request\n", conn->c_connid, 0, 0 );
 		disconnect_server_nomutex( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
 		ret = CONN_DONE;
@@ -1327,7 +1327,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
 	  case LBER_ERROR:
 	  case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
 		/* log, close and send error */
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"conn=%" NSPRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, *tag, 0 );
 		disconnect_server_nomutex( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BER_PEEK, EPROTO );
 		ret = CONN_DONE;
@@ -1379,7 +1379,7 @@ void connection_check_activity_level(Connection *conn)
 	/* update the last checked time */
 	conn->c_private->previous_count_check_time = current_time();
 	PR_ExitMonitor(conn->c_mutex);
-	LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " activity level = %d\n",conn->c_connid,delta_count,0); 
+	LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,"conn %" NSPRIu64 " activity level = %d\n",conn->c_connid,delta_count,0); 
 }
 
 typedef struct table_iterate_info_struct {
@@ -1440,7 +1440,7 @@ void connection_enter_leave_turbo(Connection *conn, int current_turbo_flag, int
 	} else {
 	  double activet = 0.0;
 	  connection_find_our_rank(conn,&connection_count, &our_rank);
-	  LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count); 
+	  LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,"conn %" NSPRIu64 " turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count); 
 	  activet = (double)g_get_active_threadcnt();
 	  threshold_rank = (int)(activet * ((double)CONN_TURBO_PERCENTILE / 100.0));
 
@@ -1481,9 +1481,9 @@ void connection_enter_leave_turbo(Connection *conn, int current_turbo_flag, int
 	PR_ExitMonitor(conn->c_mutex);
 	if (current_mode != new_mode) {
 		if (current_mode) {
-			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " leaving turbo mode\n",conn->c_connid,0,0); 
+			LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,"conn %" NSPRIu64 " leaving turbo mode\n",conn->c_connid,0,0); 
 		} else {
-			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " entering turbo mode\n",conn->c_connid,0,0); 
+			LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,"conn %" NSPRIu64 " entering turbo mode\n",conn->c_connid,0,0); 
 		}
 	}
 	*new_turbo_flag = new_mode;
@@ -1523,7 +1523,7 @@ connection_threadmain()
 		time_t curtime = 0;
 		
 		if( op_shutdown ) {
-			LDAPDebug( LDAP_DEBUG_TRACE, 
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 			"op_thread received shutdown signal\n",	0, 0, 0 );
 			g_decr_active_threadcnt();
 			return;
@@ -1540,7 +1540,7 @@ connection_threadmain()
 					PR_ASSERT(interval != PR_INTERVAL_NO_TIMEOUT); /* this should never happen with PR_INTERVAL_NO_TIMEOUT */
 					continue;
 				case CONN_SHUTDOWN:
-					LDAPDebug( LDAP_DEBUG_TRACE, 
+					LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 					"op_thread received shutdown signal\n", 0, 0, 0 );
 					g_decr_active_threadcnt();
 					return;
@@ -1661,11 +1661,11 @@ connection_threadmain()
 				 * should call connection_make_readable after the op is removed
 				 * connection_make_readable(conn);
 				 */
-				LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " leaving turbo mode due to %d\n",
+				LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,"conn %" NSPRIu64 " leaving turbo mode due to %d\n",
 				          conn->c_connid,ret,0);
 				goto done;
 			case CONN_SHUTDOWN:
-				LDAPDebug( LDAP_DEBUG_TRACE, 
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 				"op_thread received shutdown signal\n", 0, 0, 0 );
 				g_decr_active_threadcnt();
 				doshutdown = 1;
@@ -1718,7 +1718,7 @@ connection_threadmain()
 					 */
 					conn->c_idlesince = curtime;
 					connection_activity(conn, maxthreads);
-					LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " queued because more_data\n",
+					LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,"conn %" NSPRIu64 " queued because more_data\n",
 					          conn->c_connid,0,0);
 				} else {
 					/* keep count of how many times maxthreads has blocked an operation */
@@ -1744,7 +1744,7 @@ connection_threadmain()
 		if (conn->c_flags & CONN_FLAG_IMPORT) {
 			if ((tag != LDAP_REQ_ADD) && (tag != LDAP_REQ_EXTENDED)) {
 				/* no cookie for you. */
-				LDAPDebug(LDAP_DEBUG_ANY, "Attempted operation %d "
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Attempted operation %d "
 						  "from within bulk import\n",
 						  tag, 0, 0);
 				slapi_send_ldap_result(pb, LDAP_PROTOCOL_ERROR, NULL,
@@ -1801,7 +1801,7 @@ done:
 			/* If we're in turbo mode, we keep our reference to the connection alive */
 			/* can't use the more_data var because connection could have changed in another thread */
 			more_data = conn_buffered_data_avail_nolock(conn, &conn_closed) ? 1 : 0;
-			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " check more_data %d thread_turbo_flag %d\n",
+			LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,"conn %" NSPRIu64 " check more_data %d thread_turbo_flag %d\n",
 			          conn->c_connid,more_data,thread_turbo_flag);
 			if (!more_data) {
 				if (!thread_turbo_flag) {
@@ -1849,7 +1849,7 @@ connection_activity(Connection *conn, int maxthreads)
 	struct Slapi_op_stack *op_stack_obj;
 
 	if (connection_acquire_nolock (conn) == -1) {
-		LDAPDebug(LDAP_DEBUG_CONNS,
+		LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
 		          "could not acquire lock in connection_activity as conn %" NSPRIu64 " closing fd=%d\n",
 		          conn->c_connid,conn->c_sd,0);
 		/* XXX how to handle this error? */
@@ -1889,7 +1889,7 @@ add_work_q( work_q_item *wqitem, struct Slapi_op_stack *op_stack_obj )
 {
 	struct Slapi_work_q	*new_work_q=NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "add_work_q \n", 0,  0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "add_work_q \n", 0,  0, 0 );
 
 	new_work_q = create_work_q();
 	new_work_q->work_item = wqitem;
@@ -1953,7 +1953,7 @@ get_work_q(struct Slapi_op_stack **op_stack_obj)
 void
 op_thread_cleanup()
 {
-	LDAPDebug( LDAP_DEBUG_ANY,
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		   "slapd shutting down - signaling operation threads - op stack size %d max work q size %d max work q stack size %d\n",
 		   op_stack_size, work_q_size_max, work_q_stack_size_max);
 
@@ -2033,7 +2033,7 @@ connection_remove_operation( Connection *conn, Operation *op )
 
 	if ( *tmp == NULL )
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: can't find op %d for conn %" NSPRIu64 "\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "connection_remove_operation: can't find op %d for conn %" NSPRIu64 "\n",
 		    (int)op->o_msgid, conn->c_connid, 0 );
 	}
 	else
@@ -2211,7 +2211,7 @@ disconnect_server_nomutex_ext( Connection *conn, PRUint64 opconnid, int opid, PR
     if ( ( conn->c_sd != SLAPD_INVALID_SOCKET &&
 	    conn->c_connid == opconnid ) && !(conn->c_flags & CONN_FLAG_CLOSING) )
 	{
-		LDAPDebug(LDAP_DEBUG_CONNS, "setting conn %" NSPRIu64 " fd=%d "
+		LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG, "setting conn %" NSPRIu64 " fd=%d "
 			  "to be disconnected: reason %d\n", conn->c_connid, conn->c_sd, reason);
 		/*
 		 * PR_Close must be called before anything else is done because
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
index b5cd47a..15ca71c 100644
--- a/ldap/servers/slapd/conntable.c
+++ b/ldap/servers/slapd/conntable.c
@@ -146,7 +146,7 @@ connection_table_get_connection(Connection_Table *ct, int sd)
 			{
 				c->c_mutex = NULL;
 				c->c_pdumutex = NULL;
-				LDAPDebug( LDAP_DEBUG_ANY,"PR_NewLock failed\n",0, 0, 0 );
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"PR_NewLock failed\n",0, 0, 0 );
 				exit(1);
 			}
 		}
@@ -164,7 +164,7 @@ connection_table_get_connection(Connection_Table *ct, int sd)
     else
     {
         /* couldn't find a Connection */
-        LDAPDebug( LDAP_DEBUG_CONNS, "max open connections reached\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG, "max open connections reached\n", 0, 0, 0);
     }
 	return c;
 }
@@ -473,7 +473,7 @@ connection_table_dump_activity_to_errors_log(Connection_Table *ct)
 				int r = ct->fd[j].out_flags & SLAPD_POLL_FLAGS;
 				if ( r )
 				{
-					LDAPDebug( LDAP_DEBUG_CONNS,"activity on %d%s\n", i, r ? "r" : "",0 );
+					LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,"activity on %d%s\n", i, r ? "r" : "",0 );
 				}
 			}
 			PR_ExitMonitor(c->c_mutex);
diff --git a/ldap/servers/slapd/control.c b/ldap/servers/slapd/control.c
index 79a639d..dd435ba 100644
--- a/ldap/servers/slapd/control.c
+++ b/ldap/servers/slapd/control.c
@@ -197,10 +197,10 @@ get_ldapmessage_controls_ext(
 	 *	}
 	 */
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> get_ldapmessage_controls\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> get_ldapmessage_controls\n", 0, 0, 0 );
 
 	if (!pb) {
-		LDAPDebug( LDAP_DEBUG_ANY, "<= get_ldapmessage_controls NULL PBlock\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "<= get_ldapmessage_controls NULL PBlock\n", 0, 0, 0 );
 		return( LDAP_OPERATIONS_ERROR );	/* unexpected error */
 	}
 
@@ -215,19 +215,19 @@ get_ldapmessage_controls_ext(
          * check to see if controls were included
 	 */
 	if ( ber_get_option( ber, LBER_OPT_REMAINING_BYTES, &len ) != 0 ) {
-		LDAPDebug( LDAP_DEBUG_TRACE,
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		    "<= get_ldapmessage_controls LDAP_OPERATIONS_ERROR\n",
 		    0, 0, 0 );
 		return( LDAP_OPERATIONS_ERROR );	/* unexpected error */
 	}
 	if ( len == 0 ) {
-		LDAPDebug( LDAP_DEBUG_TRACE,
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		    "<= get_ldapmessage_controls no controls\n", 0, 0, 0 );
 		return( LDAP_SUCCESS );			/* no controls */
 	}
 	if (( tag = ber_peek_tag( ber, &len )) != LDAP_TAG_CONTROLS ) {
 		if ( tag == LBER_ERROR ) {
-			LDAPDebug( LDAP_DEBUG_TRACE,
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 			    "<= get_ldapmessage_controls LDAP_PROTOCOL_ERROR\n",
 			    0, 0, 0 );
 			return( LDAP_PROTOCOL_ERROR );	/* decoding error */
@@ -237,7 +237,7 @@ get_ldapmessage_controls_ext(
 		 * happen in LDAPv3, but we don't treat this is a hard error --
 		 * we just ignore the extra stuff.
 		 */
-		LDAPDebug( LDAP_DEBUG_TRACE,
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		    "<= get_ldapmessage_controls ignoring unrecognized data in request (tag 0x%x)\n",
 		    tag, 0, 0 );
 		return( LDAP_SUCCESS );
@@ -376,13 +376,13 @@ get_ldapmessage_controls_ext(
 	}
 #endif /* SLAPD_ECHO_CONTROL */
 
-	LDAPDebug( LDAP_DEBUG_TRACE,
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 	    "<= get_ldapmessage_controls %d controls\n", curcontrols, 0, 0 );
 	return( LDAP_SUCCESS );
 
 free_and_return:;
 	ldap_controls_free( ctrls );
-	LDAPDebug( LDAP_DEBUG_TRACE,
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 	    "<= get_ldapmessage_controls %i\n", rc, 0, 0 );
 	return( rc );
 }
@@ -402,7 +402,7 @@ slapi_control_present( LDAPControl **controls, char *oid, struct berval **val, i
 {
 	int	i;
 
-	LDAPDebug( LDAP_DEBUG_TRACE,
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 	    "=> slapi_control_present (looking for %s)\n", oid, 0, 0 );
 
 	if ( val != NULL ) {
@@ -410,7 +410,7 @@ slapi_control_present( LDAPControl **controls, char *oid, struct berval **val, i
 	}
 
 	if ( controls == NULL ) {
-		LDAPDebug( LDAP_DEBUG_TRACE,
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		    "<= slapi_control_present 0 (NO CONTROLS)\n", 0, 0, 0 );
 		return( 0 );
 	}
@@ -423,13 +423,13 @@ slapi_control_present( LDAPControl **controls, char *oid, struct berval **val, i
 					*iscritical = (int) controls[i]->ldctl_iscritical;
 				}
 			}
-			LDAPDebug( LDAP_DEBUG_TRACE,
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 			    "<= slapi_control_present 1 (FOUND)\n", 0, 0, 0 );
 			return( 1 );
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE,
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 	    "<= slapi_control_present 0 (NOT FOUND)\n", 0, 0, 0 );
 	return( 0 );
 }
diff --git a/ldap/servers/slapd/counters.c b/ldap/servers/slapd/counters.c
index 1d4ac89..1aa3390 100644
--- a/ldap/servers/slapd/counters.c
+++ b/ldap/servers/slapd/counters.c
@@ -146,13 +146,13 @@ counters_to_errors_log(const char *text)
 #if defined(DEBUG)
 	int i;
 	fetch_counters();
-	LDAPDebug( LDAP_DEBUG_ANY, "Counter Dump - %s\n",text, 0, 0);
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Counter Dump - %s\n",text, 0, 0);
 	for(i=0;i<num_counters;i++)
 	{
 		char value[40];
 		char *type= (char*)malloc(counter_size(&counters[i])+4);
 		counter_dump(type,value,i);
-		LDAPDebug( LDAP_DEBUG_ANY, "%s %s\n",type, value, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s %s\n",type, value, 0);
 		free(type);
 	}
 #endif
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index a3d55e0..fce22ef 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -140,7 +140,7 @@ accept_and_configure(int s, PRFileDesc *pr_acceptfd, PRNetAddr *pr_netaddr,
 	(*pr_clonefd) = PR_Accept(pr_acceptfd, pr_netaddr, pr_timeout);
 	if( !(*pr_clonefd) ) {
 		PRErrorCode prerr = PR_GetError();
-		LDAPDebug( LDAP_DEBUG_ANY, "PR_Accept() failed, "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "PR_Accept() failed, "
 				SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 				prerr, slapd_pr_strerror(prerr), 0 );
 		return(SLAPD_INVALID_SOCKET);
@@ -570,7 +570,7 @@ disk_monitoring_thread(void *nothing)
              */
             if(passed_threshold){
             	if(logs_disabled){
-            		LDAPDebug(LDAP_DEBUG_ANY, "Disk space is now within acceptable levels.  "
+            		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Disk space is now within acceptable levels.  "
                         "Restoring the log settings.\n",0,0,0);
                     if(using_accesslog){
                         config_set_accesslog_enabled(LOGGING_ON);
@@ -582,7 +582,7 @@ disk_monitoring_thread(void *nothing)
                         config_set_auditfaillog_enabled(LOGGING_ON);
                     }
                 } else {
-                	LDAPDebug(LDAP_DEBUG_ANY, "Disk space is now within acceptable levels.\n",0,0,0);
+                	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Disk space is now within acceptable levels.\n",0,0,0);
                 }
             	deleted_rotated_logs = 0;
             	passed_threshold = 0;
@@ -597,7 +597,7 @@ disk_monitoring_thread(void *nothing)
          *  Check if we are already critical
          */
         if(disk_space < 4096){ /* 4 k */
-            LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb.  "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb.  "
                 "Signaling slapd for shutdown...\n", dirstr , (disk_space / 1024), 0);
             g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
             return;
@@ -607,7 +607,7 @@ disk_monitoring_thread(void *nothing)
          *  if logging is not critical
          */
         if(verbose_logging != 0 && verbose_logging != LDAP_DEBUG_ANY){
-            LDAPDebug(LDAP_DEBUG_ANY, "Disk space is low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Disk space is low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
                 "temporarily setting error loglevel to the default level(%d).\n", dirstr,
                 (disk_space / 1024), SLAPD_DEFAULT_ERRORLOG_LEVEL);
             /* Setting the log level back to zero, actually sets the value to LDAP_DEBUG_ANY */
@@ -621,7 +621,7 @@ disk_monitoring_thread(void *nothing)
          *  access/audit logs, log another error, and continue.
          */
         if(!logs_disabled && !logging_critical){
-            LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
                 "disabling access and audit logging.\n", dirstr, (disk_space / 1024), 0);
             config_set_accesslog_enabled(LOGGING_OFF);
             config_set_auditlog_enabled(LOGGING_OFF);
@@ -634,7 +634,7 @@ disk_monitoring_thread(void *nothing)
          *  access/audit logging, then delete the rotated logs, log another error, and continue.
          */
         if(!deleted_rotated_logs && !logging_critical){
-            LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb, "
                 "deleting rotated logs.\n", dirstr, (disk_space / 1024), 0);
             log__delete_rotated_logs();
             deleted_rotated_logs = 1;
@@ -644,7 +644,7 @@ disk_monitoring_thread(void *nothing)
          *  Ok, we've done what we can, log a message if we continue to lose available disk space
          */
         if(disk_space < previous_mark){
-            LDAPDebug(LDAP_DEBUG_ANY, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Disk space is too low on disk (%s), remaining space: %" NSPRIu64 " Kb\n",
                 dirstr, (disk_space / 1024), 0);
         }
         /*
@@ -656,7 +656,7 @@ disk_monitoring_thread(void *nothing)
          *
          */
         if(disk_space < halfway){
-            LDAPDebug(LDAP_DEBUG_ANY, "Disk space on (%s) is too far below the threshold(%" NSPRIu64 " bytes).  "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Disk space on (%s) is too far below the threshold(%" NSPRIu64 " bytes).  "
                 "Waiting %d minutes for disk space to be cleaned up before shutting slapd down...\n",
                 dirstr, threshold, (grace_period / 60));
             time(&start);
@@ -678,7 +678,7 @@ disk_monitoring_thread(void *nothing)
                     /*
                      *  Excellent, we are back to acceptable levels, reset everything...
                      */
-                    LDAPDebug(LDAP_DEBUG_ANY, "Available disk space is now acceptable (%" NSPRIu64 " bytes).  Aborting"
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Available disk space is now acceptable (%" NSPRIu64 " bytes).  Aborting"
                                               " shutdown, and restoring the log settings.\n",disk_space,0,0);
                     if(logs_disabled && using_accesslog){
                         config_set_accesslog_enabled(LOGGING_ON);
@@ -701,7 +701,7 @@ disk_monitoring_thread(void *nothing)
                     /*
                      *  Disk space is critical, log an error, and shut it down now!
                      */
-                    LDAPDebug(LDAP_DEBUG_ANY, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb."
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Disk space is critically low on disk (%s), remaining space: %" NSPRIu64 " Kb."
                         "  Signaling slapd for shutdown...\n", dirstr, (disk_space / 1024), 0);
                     g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
                     return;
@@ -718,7 +718,7 @@ disk_monitoring_thread(void *nothing)
             /*
              *  If disk space was freed up we would of detected in the above while loop.  So shut it down.
              */
-            LDAPDebug(LDAP_DEBUG_ANY, "Disk space is still too low (%" NSPRIu64 " Kb).  Signaling slapd for shutdown...\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Disk space is still too low (%" NSPRIu64 " Kb).  Signaling slapd for shutdown...\n",
                 (disk_space / 1024), 0, 0);
             g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
 
@@ -1051,7 +1051,7 @@ void slapd_daemon( daemon_ports_t *ports )
 		(i_unix == NULL) &&
 #endif /* ENABLE_LDAPI */
 	    (s_tcps == NULL) ) {	/* nothing to do */
-	    LDAPDebug( LDAP_DEBUG_ANY,
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		"no port to listen on\n", 0, 0, 0 );
 	    exit( 1 );
 	}
@@ -1066,7 +1066,7 @@ void slapd_daemon( daemon_ports_t *ports )
         SLAPD_DEFAULT_THREAD_STACKSIZE);
     if ( NULL == time_thread_p ) {
 		PRErrorCode errorCode = PR_GetError();
-		LDAPDebug(LDAP_DEBUG_ANY, "Unable to create time thread - Shutting Down ("
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Unable to create time thread - Shutting Down ("
 				SLAPI_COMPONENT_NAME_NSPR " error %d - %s)\n",
 				errorCode, slapd_pr_strerror(errorCode), 0);
 		g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
@@ -1101,7 +1101,7 @@ void slapd_daemon( daemon_ports_t *ports )
                 SLAPD_DEFAULT_THREAD_STACKSIZE);
             if ( NULL == disk_thread_p ) {
                 PRErrorCode errorCode = PR_GetError();
-                LDAPDebug(LDAP_DEBUG_ANY, "Unable to create disk monitoring thread - Shutting Down ("
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Unable to create disk monitoring thread - Shutting Down ("
                     SLAPI_COMPONENT_NAME_NSPR " error %d - %s)\n",
                     errorCode, slapd_pr_strerror(errorCode), 0);
                 g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
@@ -1227,7 +1227,7 @@ void slapd_daemon( daemon_ports_t *ports )
 
 #ifdef ENABLE_NUNC_STANS
 	if (enable_nunc_stans && ns_thrpool_wait(tp)) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			   "ns_thrpool_wait failed errno %d (%s)\n", errno,
 			   slapd_system_strerror(errno), 0 );
 	}
@@ -1246,7 +1246,7 @@ void slapd_daemon( daemon_ports_t *ports )
 			break;
 		case -1: /* Error */
 			prerr = PR_GetError();
-			LDAPDebug( LDAP_DEBUG_TRACE, "PR_Poll() failed, "
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "PR_Poll() failed, "
 				   SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 				   prerr, slapd_system_strerror(prerr), 0 );
 			break;
@@ -1318,7 +1318,7 @@ void slapd_daemon( daemon_ports_t *ports )
 
 	threads = g_get_active_threadcnt();
 	if ( threads > 0 ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"slapd shutting down - waiting for %d thread%s to terminate\n",
 			threads, ( threads > 1 ) ? "s" : "", 0 );
 	}
@@ -1340,14 +1340,14 @@ void slapd_daemon( daemon_ports_t *ports )
 				spe = PR_Read(signalpipe[0], &x, 1);
 				if (spe < 0) {
 					PRErrorCode prerr = PR_GetError();
-					LDAPDebug( LDAP_DEBUG_ANY, "listener could not clear signal pipe, "
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "listener could not clear signal pipe, "
 							SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 							prerr, slapd_system_strerror(prerr), 0 );
 					break;
 				}
 			} else if (spe == -1) {
 				PRErrorCode prerr = PR_GetError();
-				LDAPDebug( LDAP_DEBUG_ANY, "PR_Poll() failed, "
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "PR_Poll() failed, "
 						SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 						prerr, slapd_system_strerror(prerr), 0 );
 				break;
@@ -1357,21 +1357,21 @@ void slapd_daemon( daemon_ports_t *ports )
 		}
 		DS_Sleep(PR_INTERVAL_NO_WAIT);
 		if ( threads != g_get_active_threadcnt() )  {
-			LDAPDebug( LDAP_DEBUG_TRACE,
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 					"slapd shutting down - waiting for %d threads to terminate\n",
 					g_get_active_threadcnt(), 0, 0 );
 			threads = g_get_active_threadcnt();
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_ANY,
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 	    "slapd shutting down - closing down internal subsystems and plugins\n",
 	    0, 0, 0 );
 
     log_access_flush();
 
 	/* let backends do whatever cleanup they need to do */
-	LDAPDebug( LDAP_DEBUG_TRACE,"slapd shutting down - waiting for backends to close down\n", 0, 0,0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"slapd shutting down - waiting for backends to close down\n", 0, 0,0 );
 
 	eq_stop();
 	if ( ! in_referral_mode ) {
@@ -1412,7 +1412,7 @@ void slapd_daemon( daemon_ports_t *ports )
 	be_cleanupall ();
 	plugin_dependency_freeall();
 	connection_post_shutdown_cleanup();
-	LDAPDebug( LDAP_DEBUG_TRACE, "slapd shutting down - backends closed down\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "slapd shutting down - backends closed down\n",
 			0, 0, 0 );
 	referrals_free();
 	schema_destroy_dse_lock();
@@ -1424,7 +1424,7 @@ void slapd_daemon( daemon_ports_t *ports )
 	if ( g_get_shutdown() == SLAPI_SHUTDOWN_DISKFULL ){
 		/* This is a server-induced shutdown, we need to manually remove the pid file */
 		if( unlink(get_pid_file()) ){
-			LDAPDebug( LDAP_DEBUG_ANY, "Failed to remove pid file %s\n", get_pid_file(), 0, 0 );
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to remove pid file %s\n", get_pid_file(), 0, 0 );
 		}
 	}
 }
@@ -1439,7 +1439,7 @@ int signal_listner()
 		/* this now means that the pipe is full
 		 * this is not a problem just go-on
 		 */
-		LDAPDebug( LDAP_DEBUG_CONNS,
+		LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
 			"listener could not write to signal pipe %d\n",
 			errno, 0, 0 );
 	}
@@ -1454,9 +1454,9 @@ static int clear_signal(struct POLL_STRUCT *fds)
 	if ( fds[FDS_SIGNAL_PIPE].out_flags & SLAPD_POLL_FLAGS ) {
 		char	buf[200];
 
-		LDAPDebug( LDAP_DEBUG_CONNS, "listener got signaled\n",	0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG, "listener got signaled\n",	0, 0, 0 );
 		if ( read( readsignalpipe, buf, 200 ) < 1 ) {
-			LDAPDebug( LDAP_DEBUG_ANY, "listener could not clear signal pipe\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "listener could not clear signal pipe\n",
 				0, 0, 0 );
 		}
 	} 
@@ -1483,7 +1483,7 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
 		> slapdFrontendConfig->reservedescriptors);
 	if ( ! accept_new_connections ) {
 		if ( last_accept_new_connections ) {
-			LDAPDebug( LDAP_DEBUG_ANY, "Not listening for new "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Not listening for new "
 				"connections - too many fds open\n", 0, 0, 0 );
 			/* reinitialize n_tcps and s_tcps to the pds */
 			first_time_setup_pr_read_pds = 1;
@@ -1491,7 +1491,7 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
 	} else {
 		if ( ! last_accept_new_connections &&
 			last_accept_new_connections != -1 ) {
-			LDAPDebug( LDAP_DEBUG_ANY, "Listening for new "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Listening for new "
 				"connections again\n", 0, 0, 0 );
 			/* reinitialize n_tcps and s_tcps to the pds */
 			first_time_setup_pr_read_pds = 1;
@@ -1529,7 +1529,7 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
 				listener_idxs[n_listeners].listenfd = *fdesc;
 				listener_idxs[n_listeners].idx = count;
 				n_listeners++;
-				LDAPDebug( LDAP_DEBUG_HOUSE, 
+				LDAPDebug(LDAP_DEBUG_HOUSE, LOG_DEBUG, 
 					"listening for connections on %d\n", socketdesc, 0, 0 );
 			}
 		} else {
@@ -1551,7 +1551,7 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
 				listener_idxs[n_listeners].idx = count;
 				listener_idxs[n_listeners].secure = 1;
 				n_listeners++;
-				LDAPDebug( LDAP_DEBUG_HOUSE, 
+				LDAPDebug(LDAP_DEBUG_HOUSE, LOG_DEBUG, 
 					"listening for SSL connections on %d\n", socketdesc, 0, 0 );
 			}
 		} else {
@@ -1575,7 +1575,7 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
 				listener_idxs[n_listeners].idx = count;
 				listener_idxs[n_listeners].local = 1;
 				n_listeners++;
-				LDAPDebug( LDAP_DEBUG_HOUSE,
+				LDAPDebug(LDAP_DEBUG_HOUSE, LOG_DEBUG,
 					"listening for LDAPI connections on %d\n", socketdesc, 0, 0 );
 			}
 		} else {
@@ -1770,7 +1770,7 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
 				if ( !readready && out_flags )
 				{
 					/* some error occured */
-					LDAPDebug( LDAP_DEBUG_CONNS,
+					LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
 					    "POLL_FN() says connection on sd %d is bad "
 					    "(closing)\n", c->c_sd, 0, 0 );
 					disconnect_server_nomutex( c, c->c_connid, -1,
@@ -1779,7 +1779,7 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
 				else if ( readready )
 				{
 					/* read activity */
-					LDAPDebug( LDAP_DEBUG_CONNS,
+					LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
 					    "read activity on %d\n", c->c_ci, 0, 0 );
 					c->c_idlesince = curtime;
 
@@ -1789,7 +1789,7 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
 						/* This might happen as a result of
 						 * trying to acquire a closing connection
 						 */
-						LDAPDebug (LDAP_DEBUG_ANY,
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 							"connection_activity: abandoning conn %" NSPRIu64 " as fd=%d is already closing\n",
 							c->c_connid,c->c_sd,0);
 						/* The call disconnect_server should do nothing,
@@ -1967,7 +1967,7 @@ ns_handle_pr_read_ready(struct ns_job_t *job)
 			LDAPDebug2Args(LDAP_DEBUG_CONNS, "socket has no data available conn %" NSPRIu64 " for fd=%d\n",
 				       c->c_connid, c->c_sd);
 		} else {
-			LDAPDebug(LDAP_DEBUG_CONNS, "socket has error [%d] conn %" NSPRIu64 " for fd=%d\n",
+			LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG, "socket has error [%d] conn %" NSPRIu64 " for fd=%d\n",
 				  errno, c->c_connid, c->c_sd);
 		}
 	}
@@ -2032,7 +2032,7 @@ slapd_poll( void *handle, int output )
 
     if (rc < 0) {
         PRErrorCode prerr = PR_GetError();
-        LDAPDebug(LDAP_DEBUG_ANY, "slapd_poll(%d) "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapd_poll(%d) "
             SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
             handle, prerr, slapd_pr_strerror(prerr));
         if ( prerr == PR_PENDING_INTERRUPT_ERROR ||
@@ -2043,7 +2043,7 @@ slapd_poll( void *handle, int output )
     } else if (rc == 0 && ioblock_timeout > 0) {
         PRIntn ihandle;
         ihandle = PR_FileDesc2NativeHandle((PRFileDesc *)handle);
-        LDAPDebug(LDAP_DEBUG_ANY, "slapd_poll(%d) timed out\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapd_poll(%d) timed out\n",
                 ihandle, 0, 0);
         PR_SetError(PR_IO_TIMEOUT_ERROR, EAGAIN); /* timeout */
         rc = -1;
@@ -2080,18 +2080,18 @@ write_function( int ignore, const void *buffer, int count, struct lextiof_socket
                 sentbytes += bytes;
             } else if (bytes < 0) {
                 PRErrorCode prerr = PR_GetError();
-                LDAPDebug(LDAP_DEBUG_CONNS, "PR_Write(%d) "
+                LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG, "PR_Write(%d) "
                           SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                           fd, prerr, slapd_pr_strerror( prerr ));
                 if ( !SLAPD_PR_WOULD_BLOCK_ERROR(prerr)) {
                     if (prerr != PR_CONNECT_RESET_ERROR) {
                         /* 'TCP connection reset by peer': no need to log */
-                        LDAPDebug(LDAP_DEBUG_ANY, "PR_Write(%d) "
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "PR_Write(%d) "
                                   SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                                   fd, prerr, slapd_pr_strerror( prerr ));
                     }
                     if (sentbytes < count) {
-                        LDAPDebug(LDAP_DEBUG_CONNS,
+                        LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                                   "PR_Write(%d) - wrote only %d bytes (expected %d bytes) - 0 (EOF)\n", /* disconnected */
                                   fd, sentbytes, count);
                     }
@@ -2099,7 +2099,7 @@ write_function( int ignore, const void *buffer, int count, struct lextiof_socket
                 }
             } else if (bytes == 0) { /* disconnect */
                 PRErrorCode prerr = PR_GetError();
-                LDAPDebug(LDAP_DEBUG_CONNS,
+                LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                           "PR_Write(%d) - 0 (EOF) %d:%s\n", /* disconnected */
                           fd, prerr, slapd_pr_strerror(prerr));
                 PR_SetError(PR_PIPE_ERROR, EPIPE);
@@ -2109,7 +2109,7 @@ write_function( int ignore, const void *buffer, int count, struct lextiof_socket
             if (sentbytes == count) { /* success */
                 return count;
             } else if (sentbytes > count) { /* too many bytes */
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "PR_Write(%d) overflow - sent %d bytes (expected %d bytes) - error\n",
                           fd, sentbytes, count);
                 PR_SetError(PR_BUFFER_OVERFLOW_ERROR, EMSGSIZE);
@@ -2560,7 +2560,7 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
         
 		if (rv < 0) {
 			PRErrorCode prerr = PR_GetError();
-			LDAPDebug (LDAP_DEBUG_ANY, "SSL_HandshakeCallback() %d "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "SSL_HandshakeCallback() %d "
 					SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 					rv, prerr, slapd_pr_strerror( prerr ));
 		}
@@ -2568,7 +2568,7 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
 
 		if (rv < 0) {
 			PRErrorCode prerr = PR_GetError();
-			LDAPDebug (LDAP_DEBUG_ANY, "SSL_BadCertHook(%i) %i "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "SSL_BadCertHook(%i) %i "
 					SLAPI_COMPONENT_NAME_NSPR " error %d\n",
 					conn->c_sd, rv, prerr);
 		}
@@ -2641,7 +2641,7 @@ ns_handle_new_connection(struct ns_job_t *job)
 			 */
 			ns_disable_listener(li);
 		} else {
-			LDAPDebug(LDAP_DEBUG_CONNS, "Error accepting new connection listenfd=%d [%d:%s]\n",
+			LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG, "Error accepting new connection listenfd=%d [%d:%s]\n",
 				  PR_FileDesc2NativeHandle(li->listenfd), prerr,
 				  slapd_pr_strerror(prerr));
 		}
@@ -2671,10 +2671,10 @@ static int init_shutdown_detect(void)
     int rc;
     sigset_t proc_mask;
         
-    LDAPDebug( LDAP_DEBUG_TRACE, "Reseting signal mask....\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Reseting signal mask....\n", 0, 0, 0);
     (void)sigemptyset( &proc_mask );
     rc = pthread_sigmask( SIG_SETMASK, &proc_mask, NULL );
-    LDAPDebug( LDAP_DEBUG_TRACE, " %s \n", 
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, " %s \n", 
 	       rc ? "Failed to reset signal mask":"....Done (signal mask reset)!!", 0, 0 );
   }
   
@@ -2722,7 +2722,7 @@ unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps,
 	int			isfirsttime = 1;
 
 	if ( ct->size <= slapdFrontendConfig->reservedescriptors ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "ERROR: Not enough descriptors to accept any connections. "
 		    "This may be because the maxdescriptors configuration "
 		    "directive is too small, the hard limit on descriptors is "
@@ -2748,13 +2748,13 @@ unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps,
 
 		for (nap = ports->n_listenaddr; nap && *nap; nap++) {
 			if (isfirsttime) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"slapd started.  Listening on %s port %d for LDAP requests\n",
 					netaddr2string(*nap, addrbuf, sizeof(addrbuf)),
 					ports->n_port, 0 );
 				isfirsttime = 0;
 			} else {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"Listening on %s port %d for LDAP requests\n",
 					netaddr2string(*nap, addrbuf, sizeof(addrbuf)),
 					ports->n_port, 0 );
@@ -2767,13 +2767,13 @@ unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps,
 
 		for (sap = ports->s_listenaddr; sap && *sap; sap++) {
 			if (isfirsttime) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"slapd started.  Listening on %s port %d for LDAPS requests\n",
 					netaddr2string(*sap, addrbuf, sizeof(addrbuf)),
 					ports->s_port, 0 );
 				isfirsttime = 0;
 			} else {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"Listening on %s port %d for LDAPS requests\n",
 					netaddr2string(*sap, addrbuf, sizeof(addrbuf)),
 					ports->s_port, 0 );
@@ -2785,7 +2785,7 @@ unfurl_banners(Connection_Table *ct,daemon_ports_t *ports, PRFileDesc **n_tcps,
 	if ( i_unix != NULL ) {                                 /* LDAPI */
 		PRNetAddr   **iap = ports->i_listenaddr;
 
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"%sListening on %s for LDAPI requests\n", isfirsttime?"slapd started.  ":"",
 			(*iap)->local.path, 0 );
 	}
@@ -2823,7 +2823,7 @@ set_shutdown (int sig)
      * yourself).
      */
 #if 0
-    LDAPDebug( LDAP_DEBUG_ANY, "slapd got shutdown signal\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapd got shutdown signal\n", 0, 0, 0 );
 #endif
 	g_set_shutdown( SLAPI_SHUTDOWN_SIGNAL );
 #ifndef LINUX
@@ -2868,7 +2868,7 @@ slapd_do_nothing (int sig)
      * yourself).
      */
 #if 0
-	LDAPDebug( LDAP_DEBUG_TRACE, "slapd got SIGUSR1\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "slapd got SIGUSR1\n", 0, 0, 0 );
 #endif
 	(void) SIGNAL( SIGUSR1, slapd_do_nothing );
 
@@ -2893,7 +2893,7 @@ slapd_wait4child(int sig)
      * yourself).
      */
 #if 0
-        LDAPDebug( LDAP_DEBUG_ARGS, "listener: catching SIGCHLD\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "listener: catching SIGCHLD\n", 0, 0, 0 );
 #endif
 #ifdef USE_WAITPID
         while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0)
@@ -3168,7 +3168,7 @@ createsignalpipe( void )
 	}
 	if ( PR_CreatePipe( &signalpipe[0], &signalpipe[1] ) != 0 ) {
 		PRErrorCode prerr = PR_GetError();
-		LDAPDebug( LDAP_DEBUG_ANY, "PR_CreatePipe() failed, "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "PR_CreatePipe() failed, "
 			SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 		    prerr, slapd_pr_strerror(prerr), SLAPD_DEFAULT_THREAD_STACKSIZE );
 		return( -1 );
@@ -3176,11 +3176,11 @@ createsignalpipe( void )
 	writesignalpipe = PR_FileDesc2NativeHandle(signalpipe[1]);
 	readsignalpipe = PR_FileDesc2NativeHandle(signalpipe[0]);
 	if(fcntl(writesignalpipe, F_SETFD, O_NONBLOCK) == -1){
-		LDAPDebug( LDAP_DEBUG_ANY,"createsignalpipe: failed to set FD for write pipe (%d).\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"createsignalpipe: failed to set FD for write pipe (%d).\n",
 				errno, 0, 0 );
 	}
 	if(fcntl(readsignalpipe, F_SETFD, O_NONBLOCK) == -1){
-		LDAPDebug( LDAP_DEBUG_ANY,"createsignalpipe: failed to set FD for read pipe (%d).\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"createsignalpipe: failed to set FD for read pipe (%d).\n",
 				errno, 0, 0);
 	}
 	return( 0 );
@@ -3215,11 +3215,11 @@ catch_signals()
         (void)sigprocmask( SIG_BLOCK, &caught_signals, NULL );
  
         if (( sig = sigwait( &caught_signals )) < 0 ) {
-            LDAPDebug( LDAP_DEBUG_ANY, "catch_signals: sigwait returned -1\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "catch_signals: sigwait returned -1\n",
                     0, 0, 0 );
             continue;
         } else {
-            LDAPDebug( LDAP_DEBUG_TRACE, "catch_signals: detected signal %d\n",
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "catch_signals: detected signal %d\n",
                     sig, 0, 0 );
             switch ( sig ) {
             case SIGUSR1:
@@ -3233,7 +3233,7 @@ catch_signals()
                 slapd_wait4child( sig );
                 break;
             default:
-                LDAPDebug( LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "catch_signals: unknown signal (%d) received\n",
                     sig, 0, 0 );
             }
@@ -3316,7 +3316,7 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local )
 	pr_socketoption.value.keep_alive = 1;
 	if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE ) {
 		PRErrorCode prerr = PR_GetError();
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"PR_SetSocketOption(PR_SockOpt_Keepalive failed, "
 				SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 				prerr, slapd_pr_strerror(prerr), 0 );
@@ -3327,7 +3327,7 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local )
 		pr_socketoption.value.non_blocking = 0;
 		if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE ) {
 			PRErrorCode prerr = PR_GetError();
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"PR_SetSocketOption(PR_SockOpt_Nonblocking) failed, "
 					SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 					prerr, slapd_pr_strerror(prerr), 0 );
@@ -3338,7 +3338,7 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local )
 		pr_socketoption.value.non_blocking = 1;
 		if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE ) {
 			PRErrorCode prerr = PR_GetError();
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"PR_SetSocketOption(PR_SockOpt_Nonblocking) failed, "
 				SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 				prerr, slapd_pr_strerror(prerr), 0 );
@@ -3350,7 +3350,7 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local )
 		 pr_socketoption.value.no_delay = 1;
 		 if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE) {
 			PRErrorCode prerr = PR_GetError();
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				   "PR_SetSocketOption(PR_SockOpt_NoDelay) failed, "
 					SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 					prerr, slapd_pr_strerror( prerr ), 0 );
@@ -3360,7 +3360,7 @@ int configure_pr_socket( PRFileDesc **pr_socket, int secure, int local )
 		pr_socketoption.value.no_delay = 0;
 		if ( PR_SetSocketOption( *pr_socket, &pr_socketoption ) == PR_FAILURE) {
 			PRErrorCode prerr = PR_GetError();
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"PR_SetSocketOption(PR_SockOpt_NoDelay) failed, "
 				SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 				prerr, slapd_pr_strerror( prerr ), 0 );
@@ -3389,7 +3389,7 @@ void configure_ns_socket( int * ns )
 	}
 	/* check for errors */
 	if((rc = setsockopt( *ns, IPPROTO_TCP, TCP_NODELAY, (char * ) &on, sizeof(on) ) != 0)){
-		LDAPDebug( LDAP_DEBUG_ANY,"configure_ns_socket: Failed to configure socket (%d).\n", rc, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"configure_ns_socket: Failed to configure socket (%d).\n", rc, 0, 0);
 	}
 
 	return;
diff --git a/ldap/servers/slapd/defbackend.c b/ldap/servers/slapd/defbackend.c
index da4a701..120a35f 100644
--- a/ldap/servers/slapd/defbackend.c
+++ b/ldap/servers/slapd/defbackend.c
@@ -60,7 +60,7 @@ defbackend_init( void )
     char		*errmsg;
     Slapi_PBlock	pb;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "defbackend_init\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "defbackend_init\n", 0, 0, 0 );
 
     /*
      * create a new backend
@@ -119,7 +119,7 @@ defbackend_init( void )
 
 cleanup_and_return:
     if ( rc != 0 ) {
-	LDAPDebug( LDAP_DEBUG_ANY, "defbackend_init: failed (%s)\n",
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "defbackend_init: failed (%s)\n",
 		errmsg, 0, 0 );
 	exit( 1 );
     }
@@ -144,7 +144,7 @@ defbackend_get_backend( void )
 static int
 defbackend_default( Slapi_PBlock *pb )
 {
-    LDAPDebug( LDAP_DEBUG_TRACE, "defbackend_default\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "defbackend_default\n", 0, 0, 0 );
 
     send_nobackend_ldap_result( pb );
 
@@ -155,7 +155,7 @@ defbackend_default( Slapi_PBlock *pb )
 static int
 defbackend_noop( Slapi_PBlock *pb )
 {
-    LDAPDebug( LDAP_DEBUG_TRACE, "defbackend_noop\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "defbackend_noop\n", 0, 0, 0 );
 
     return( DEFBACKEND_OP_HANDLED );
 }
@@ -164,7 +164,7 @@ defbackend_noop( Slapi_PBlock *pb )
 static int
 defbackend_abandon( Slapi_PBlock *pb )
 {
-    LDAPDebug( LDAP_DEBUG_TRACE, "defbackend_abandon\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "defbackend_abandon\n", 0, 0, 0 );
 
     /* nothing to do */
     return( DEFBACKEND_OP_HANDLED );
@@ -223,7 +223,7 @@ defbackend_bind( Slapi_PBlock *pb )
     ber_tag_t		method;
     struct berval	*cred;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "defbackend_bind\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "defbackend_bind\n", 0, 0, 0 );
 
     /*
      * Accept simple binds that do not contain passwords (but do not
@@ -277,7 +277,7 @@ defbackend_bind( Slapi_PBlock *pb )
 static int
 defbackend_next_search_entry( Slapi_PBlock *pb )
 {
-    LDAPDebug( LDAP_DEBUG_TRACE, "defbackend_next_search_entry\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "defbackend_next_search_entry\n", 0, 0, 0 );
 
     return( 0 );	/* no entries and no error */
 }
diff --git a/ldap/servers/slapd/delete.c b/ldap/servers/slapd/delete.c
index 6b7488d..da236fd 100644
--- a/ldap/servers/slapd/delete.c
+++ b/ldap/servers/slapd/delete.c
@@ -43,7 +43,7 @@ do_delete( Slapi_PBlock *pb )
 	char	    *rawdn = NULL;
 	int			err = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_delete\n", 0, 0, 0 );
 	
 	slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
 	ber = operation->o_ber;
@@ -58,7 +58,7 @@ do_delete( Slapi_PBlock *pb )
 	 */
 
 	if ( ber_scanf( pb->pb_op->o_ber, "a", &rawdn ) == LBER_ERROR ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "ber_scanf failed (op=Delete; params=DN)\n", 0, 0, 0 );
 		op_shared_log_error_access (pb, "DEL", "???", "decoding error");
 		send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL, NULL, 0,
diff --git a/ldap/servers/slapd/detach.c b/ldap/servers/slapd/detach.c
index 102ce33..a6f4ec4 100644
--- a/ldap/servers/slapd/detach.c
+++ b/ldap/servers/slapd/detach.c
@@ -225,7 +225,7 @@ static void raise_process_fd_limits(void)
 	if ( getrlimit( RLIMIT_NOFILE, &rl ) != 0 ) {
 		int oserr = errno;
 
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "getrlimit of descriptor limit failed - error %d (%s)\n",
 		    oserr, slapd_system_strerror( oserr ), 0 );
 		return;
@@ -247,7 +247,7 @@ static void raise_process_fd_limits(void)
 		if ( setrlimit( RLIMIT_NOFILE, &setrl ) != 0 ) {
 			int oserr = errno;
 
-			LDAPDebug( LDAP_DEBUG_ANY, "setrlimit of descriptor "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "setrlimit of descriptor "
 			    "limit to %d failed - error %d (%s)\n",
 			    setrl.rlim_cur, oserr,
 			    slapd_system_strerror(oserr));
@@ -256,7 +256,7 @@ static void raise_process_fd_limits(void)
 	}
 		    
 	(void)getrlimit( RLIMIT_NOFILE, &rl );
-	LDAPDebug( LDAP_DEBUG_TRACE, "descriptor limit changed from %d to %d\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "descriptor limit changed from %d to %d\n",
 	    curlim, rl.rlim_cur, 0 );
 }
 
@@ -274,11 +274,11 @@ raise_process_limits()
 	if (getrlimit(RLIMIT_DATA,&rl) == 0) {
 	    rl.rlim_cur = rl.rlim_max;
 	    if (setrlimit(RLIMIT_DATA,&rl) != 0) {
-	        LDAPDebug(LDAP_DEBUG_TRACE,"setrlimit(RLIMIT_DATA) failed %d\n",
+	        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"setrlimit(RLIMIT_DATA) failed %d\n",
 			  errno,0,0);
 	    }
 	} else {
-	    LDAPDebug(LDAP_DEBUG_TRACE,"getrlimit(RLIMIT_DATA) failed %d\n",
+	    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"getrlimit(RLIMIT_DATA) failed %d\n",
 		      errno,0,0);
 	}
 #endif
@@ -287,11 +287,11 @@ raise_process_limits()
 	if (getrlimit(RLIMIT_VMEM,&rl) == 0) {
 	    rl.rlim_cur = rl.rlim_max;
 	    if (setrlimit(RLIMIT_VMEM,&rl) != 0) {
-	        LDAPDebug(LDAP_DEBUG_TRACE,"setrlimit(RLIMIT_VMEM) failed %d\n",
+	        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"setrlimit(RLIMIT_VMEM) failed %d\n",
 			  errno,0,0);
 	    }
 	} else {
-	    LDAPDebug(LDAP_DEBUG_TRACE,"getrlimit(RLIMIT_VMEM) failed %d\n",
+	    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"getrlimit(RLIMIT_VMEM) failed %d\n",
 		      errno,0,0);
 	}
 #endif /* RLIMIT_VMEM */
diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c
index 445c3c2..1767073 100644
--- a/ldap/servers/slapd/dn.c
+++ b/ldap/servers/slapd/dn.c
@@ -340,7 +340,7 @@ substr_dn_normalize_orig( char *dn, char *end )
 			} else if ( *s == '"' ) {
 				state = B4SEPARATOR;
 				if (!value) {
-					LDAPDebug( LDAP_DEBUG_ANY,
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 						"slapi_dn_normalize - missing value\n", 0, 0, 0 );
 					break;
 				}
@@ -390,7 +390,7 @@ substr_dn_normalize_orig( char *dn, char *end )
 			}
 			break;
 		default:
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"slapi_dn_normalize - unknown state %d\n", state, 0, 0 );
 			break;
 		}
@@ -1073,7 +1073,7 @@ slapi_dn_normalize_ext(char *src, size_t src_len, char **dest, size_t *dest_len)
             }
             break;
         default:
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "slapi_dn_normalize_ext - unknown state %d\n", state, 0, 0 );
             break;
         }
@@ -1365,9 +1365,9 @@ rdn_av_swap( struct berval *av1, struct berval *av2, int escape )
 char *
 slapi_dn_normalize_original( char *dn )
 {
-	/* LDAPDebug( LDAP_DEBUG_TRACE, "=> slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
 	*(substr_dn_normalize_orig( dn, dn + strlen( dn ))) = '\0';
-	/* LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
 
 	return( dn );
 }
@@ -1376,9 +1376,9 @@ slapi_dn_normalize_original( char *dn )
 char *
 slapi_dn_normalize_case_original( char *dn )
 {
-	/* LDAPDebug( LDAP_DEBUG_TRACE, "=> slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
 	*(substr_dn_normalize_orig( dn, dn + strlen( dn ))) = '\0';
-	/* LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
 
 	/* normalize case */
 	return( slapi_dn_ignore_case( dn ));
@@ -1392,9 +1392,9 @@ slapi_dn_normalize_case_original( char *dn )
 char *
 slapi_dn_normalize( char *dn )
 {
-	/* LDAPDebug( LDAP_DEBUG_TRACE, "=> slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
     *(substr_dn_normalize( dn, dn + strlen( dn ))) = '\0';
-	/* LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= slapi_dn_normalize \"%s\"\n", dn, 0, 0 ); */
     return dn;
 }
 
@@ -2730,7 +2730,7 @@ slapi_moddn_get_newdn(Slapi_DN *dn_olddn, const char *newrdn, const char *newsup
 static void
 sdn_dump( const Slapi_DN *sdn, const char *text)
 {
-    LDAPDebug( LDAP_DEBUG_ANY, "SDN %s ptr=%lx dn=%s\n", text, sdn, (sdn->dn==NULL?"NULL":sdn->dn));
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "SDN %s ptr=%lx dn=%s\n", text, sdn, (sdn->dn==NULL?"NULL":sdn->dn));
 }
 #endif
 
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index 3541e1c..9317108 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -2332,7 +2332,7 @@ dse_add(Slapi_PBlock *pb) /* JCM There should only be one exit point from this f
     if(dse_call_callback(pdse, pb, SLAPI_OPERATION_ADD, DSE_FLAG_PREOP, e,
                          NULL, &returncode, returntext)!=SLAPI_DSE_CALLBACK_OK) {
         if (!returncode) {
-            LDAPDebug( LDAP_DEBUG_ANY, "dse_add: DSE PREOP callback returned error but did not set returncode\n", 0, 0, 0 );
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dse_add: DSE PREOP callback returned error but did not set returncode\n", 0, 0, 0 );
             returncode = LDAP_OPERATIONS_ERROR;
         }
         rc = returncode;
diff --git a/ldap/servers/slapd/dynalib.c b/ldap/servers/slapd/dynalib.c
index e3d00ee..d112564 100644
--- a/ldap/servers/slapd/dynalib.c
+++ b/ldap/servers/slapd/dynalib.c
@@ -124,17 +124,17 @@ symload_report_error( const char *libpath, char *symbol, char *plugin, int libop
 	if ( errlen > 0 ) {
 		errtext = slapi_ch_malloc( errlen+1 );
 		if ( PR_GetErrorText( errtext ) > 0 ) {
-			LDAPDebug( LDAP_DEBUG_ANY, SLAPI_COMPONENT_NAME_NSPR " error %d: %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, SLAPI_COMPONENT_NAME_NSPR " error %d: %s\n",
 				PR_GetError(), errtext, 0 );
 		}
 		slapi_ch_free( (void **)&errtext );
 	}
 	if ( libopen ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"Could not load symbol \"%s\" from \"%s\" for plugin %s\n",
 					symbol, libpath, plugin );
 	} else {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"Could not open library \"%s\" for plugin %s\n",
 			libpath, plugin, 0 );
 	}
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 0abfde8..8bbf0c4 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -245,7 +245,7 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
 	 * In case an entry starts with rdn:, dn must be provided.
 	 */
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> str2entry_fast\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> str2entry_fast\n", 0, 0, 0 );
 
 	e = slapi_entry_alloc();
 	slapi_entry_init(e,NULL,NULL);
@@ -375,7 +375,7 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
 		if ( type.bv_len == SLAPI_ATTR_DN_LENGTH && PL_strncasecmp( type.bv_val, SLAPI_ATTR_DN, type.bv_len ) == 0 ) {
 			if ( slapi_entry_get_dn_const(e)!=NULL ) {
 				char ebuf[ BUFSIZ ];
-				LDAPDebug( LDAP_DEBUG_TRACE,
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 					"str2entry_fast: entry has multiple dns \"%s\" and "
 					"\"%s\" (second ignored)\n",
 					slapi_entry_get_dn_const(e),
@@ -427,7 +427,7 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
 		/* retrieve uniqueid */
 		if ((type.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type.bv_val, SLAPI_ATTR_UNIQUEID) == 0)) {
 			if (e->e_uniqueid != NULL){
-				LDAPDebug (LDAP_DEBUG_TRACE, 
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 						   "str2entry_fast: entry has multiple uniqueids %s "
 						   "and %s (second ignored)\n",
 						   e->e_uniqueid, value.bv_val, 0);
@@ -459,7 +459,7 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
 				case ATTRIBUTE_PRESENT:
 					if(attrlist_append_nosyntax_init(&e->e_attrs, type.bv_val, &a)==0 /* Found */)
 					{
-						LDAPDebug (LDAP_DEBUG_ANY, "str2entry_fast: Error. Non-contiguous attribute values for %s\n", type.bv_val, 0, 0);
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "str2entry_fast: Error. Non-contiguous attribute values for %s\n", type.bv_val, 0, 0);
 						PR_ASSERT(0);
 						continue;
 					}
@@ -467,13 +467,13 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
 				case ATTRIBUTE_DELETED:
 					if(attrlist_append_nosyntax_init(&e->e_deleted_attrs, type.bv_val, &a)==0 /* Found */)
 					{
-						LDAPDebug (LDAP_DEBUG_ANY, "str2entry_fast: Error. Non-contiguous deleted attribute values for %s\n", type.bv_val, 0, 0);
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "str2entry_fast: Error. Non-contiguous deleted attribute values for %s\n", type.bv_val, 0, 0);
 						PR_ASSERT(0);
 						continue;
 					}
 					break;
 				case ATTRIBUTE_NOTFOUND:
-					LDAPDebug (LDAP_DEBUG_ANY, "str2entry_fast: Error. Non-contiguous deleted attribute values for %s\n", type.bv_val, 0, 0);
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "str2entry_fast: Error. Non-contiguous deleted attribute values for %s\n", type.bv_val, 0, 0);
 					PR_ASSERT(0);
 					continue;
 					/* break; ??? */
@@ -560,7 +560,7 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
 	slapi_ch_free_string(&ptype);
 	if ( attr_val_cnt >= ENTRY_MAX_ATTRIBUTE_VALUE_COUNT )
 	{
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "str2entry_fast: entry %s exceeded max attribute value cound %ld\n",
 			slapi_entry_get_dn_const(e)?slapi_entry_get_dn_const(e):"unknown",
 			attr_val_cnt, 0 );
@@ -591,7 +591,7 @@ str2entry_fast( const char *rawdn, const Slapi_RDN *srdn, char *s, int flags, in
 	/* check to make sure there was a dn: line */
 	if ( slapi_entry_get_dn_const(e)==NULL ) {
 		if (!(SLAPI_STR2ENTRY_INCLUDE_VERSION_STR & flags))
-			LDAPDebug( LDAP_DEBUG_ANY, "str2entry_fast: entry has no dn\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "str2entry_fast: entry has no dn\n",
 									   0, 0, 0 );
 		slapi_entry_free( e );
 		e = NULL;
@@ -601,7 +601,7 @@ done:
 	csnset_free(&valuecsnset);
 	csn_free(&attributedeletioncsn);
 	csn_free(&maxcsn);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= str2entry_fast 0x%x\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= str2entry_fast 0x%x\n",
 		e, 0, 0 );
 	return( e );
 }
@@ -825,7 +825,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 		bvtype = bv_null;
 		bvvalue = bv_null;
 		if ( slapi_ldif_parse_line( s, &bvtype, &bvvalue, &freeval ) < 0 ) {
-		    LDAPDebug(LDAP_DEBUG_ANY,
+		    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		                  "Warning: Entry (%s), ignoring invalid line \"%s\"...\n",
 		                  rawdn ? rawdn : "", s, 0);
 		    continue;
@@ -908,7 +908,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 		if ( strcasecmp( type, "dn" ) == 0 ) {
 			if ( slapi_entry_get_dn_const(e)!=NULL ) {
 				char ebuf[ BUFSIZ ];
-				LDAPDebug( LDAP_DEBUG_TRACE,
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 					"str2entry_dupcheck: entry has multiple dns \"%s\" "
 					"and \"%s\" (second ignored)\n",
 					slapi_entry_get_dn_const(e),
@@ -951,7 +951,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 		/* retrieve uniqueid */
 		if ((bvtype.bv_len == SLAPI_ATTR_UNIQUEID_LENGTH) && (PL_strcasecmp (type, SLAPI_ATTR_UNIQUEID) == 0)) {
 			if (e->e_uniqueid != NULL){
-				LDAPDebug (LDAP_DEBUG_TRACE, 
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 						   "str2entry_dupcheck: entry has multiple uniqueids %s "
 						   "and %s (second ignored)\n", 
 						   e->e_uniqueid, valuecharptr, 0);
@@ -1138,7 +1138,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 		else
 		{
 		    /* Failure adding to value tree */
-		    LDAPDebug( LDAP_DEBUG_ANY, "str2entry_dupcheck: unexpected failure %d adding value\n", rc, 0, 0 );
+		    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "str2entry_dupcheck: unexpected failure %d adding value\n", rc, 0, 0 );
 		    slapi_value_free(&value); /* value not consumed - free it */
 		    slapi_entry_free( e ); e = NULL;
 		    goto free_and_return;
@@ -1152,7 +1152,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
     if ( slapi_entry_get_dn_const(e)==NULL )
     {
 		if (!(SLAPI_STR2ENTRY_INCLUDE_VERSION_STR & flags))
-	    	LDAPDebug( LDAP_DEBUG_ANY, "str2entry_dupcheck: entry has no dn\n",
+	    	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "str2entry_dupcheck: entry has no dn\n",
 									   0, 0, 0 );
 	    slapi_entry_free( e ); e = NULL;
 	    goto free_and_return;
@@ -1173,11 +1173,11 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
 		if ( sa->sa_numdups > 0 )
 		{
 		    if ( sa->sa_numdups > 1 ) {
-				LDAPDebug( LDAP_DEBUG_ANY, "str2entry_dupcheck: %d duplicate values for attribute "
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "str2entry_dupcheck: %d duplicate values for attribute "
 					"type %s detected in entry %s. Extra values ignored.\n",
 					sa->sa_numdups, sa->sa_type, slapi_entry_get_dn_const(e) );
 		    } else {
-				LDAPDebug( LDAP_DEBUG_ANY, "str2entry_dupcheck: Duplicate value for attribute "
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "str2entry_dupcheck: Duplicate value for attribute "
 					"type %s detected in entry %s. Extra value ignored.\n",
 					sa->sa_type, slapi_entry_get_dn_const(e), 0 );
 		    }
@@ -1249,7 +1249,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
     /* Add the RDN values, if asked, and if not already present */
     if ( flags & SLAPI_STR2ENTRY_ADDRDNVALS ) {
         if ( slapi_entry_add_rdn_values( e ) != LDAP_SUCCESS ) {
-            LDAPDebug( LDAP_DEBUG_TRACE,
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                        "str2entry_dupcheck: entry has badly formatted dn\n",
                        0, 0, 0 );
             slapi_entry_free( e ); e = NULL;
@@ -1281,7 +1281,7 @@ free_and_return:
 	csn_free(&attributedeletioncsn);
 	csn_free(&maxcsn);
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= str2entry_dupcheck 0x%x \"%s\"\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= str2entry_dupcheck 0x%x \"%s\"\n",
 		e, slapi_sdn_get_dn (slapi_entry_get_sdn_const(e)), 0 );
     return e;
 }
@@ -1332,7 +1332,7 @@ slapi_str2entry( char *s, int flags )
 	Slapi_Entry *e;
 	int read_stateinfo= ~( flags & SLAPI_STR2ENTRY_IGNORE_STATE );
 
-	LDAPDebug( LDAP_DEBUG_ARGS,
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG,
 			"slapi_str2entry: flags=0x%x, entry=\"%.50s...\"\n",
 			flags, s, 0 );
 
@@ -1393,7 +1393,7 @@ slapi_str2entry_ext( const char *normdn, const Slapi_RDN *srdn, char *s, int fla
 		return slapi_str2entry( s, flags );
 	}
 
-	LDAPDebug( LDAP_DEBUG_ARGS,
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG,
 			"slapi_str2entry_ext: flags=0x%x, dn=\"%s\", entry=\"%.50s...\"\n",
 			flags, normdn, s );
 
@@ -2173,7 +2173,7 @@ static void
 entry_dump( const Slapi_Entry *e, const char *text)
 {
 	const char *dn= slapi_entry_get_dn_const(e);
-    LDAPDebug( LDAP_DEBUG_ANY, "Entry %s ptr=%lx dn=%s\n", text, e, (dn==NULL?"NULL":dn));
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Entry %s ptr=%lx dn=%s\n", text, e, (dn==NULL?"NULL":dn));
 }
 #endif
 
@@ -3281,7 +3281,7 @@ slapi_entry_add_rdn_values( Slapi_Entry *e )
                 if ((ava.ava_value.bv_len != bv->bv_len) ||
                     (memcmp(ava.ava_value.bv_val, bv->bv_val, bv->bv_len) != 0)) {
                     /* bytes not identical so reject */
-                    LDAPDebug(LDAP_DEBUG_TRACE, "RDN value is not identical to entry value for type %s in entry %s\n", 
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "RDN value is not identical to entry value for type %s in entry %s\n", 
                                type, dn ? dn : "<null>", 0 );
 #if 0
                     /* 
@@ -3327,7 +3327,7 @@ slapi_entry_has_children_ext(const Slapi_Entry *entry, int include_tombstone)
 	Slapi_Attr *attr;
 	int count = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> slapi_has_children( %s )\n", slapi_entry_get_dn_const(entry), 0, 0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> slapi_has_children( %s )\n", slapi_entry_get_dn_const(entry), 0, 0);
 
 	/*If the subordinatecount exists, and it's nonzero, then return 1.*/
 	if (slapi_entry_attr_find( entry, "numsubordinates", &attr) == 0)
@@ -3367,7 +3367,7 @@ slapi_entry_has_children_ext(const Slapi_Entry *entry, int include_tombstone)
 			}
 		}
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_has_children 0\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= slapi_has_children 0\n", 0, 0, 0 );
 	return(0);
 }
 
@@ -3388,7 +3388,7 @@ slapi_entry_rename(Slapi_Entry *e, const char *newrdn, int deleteoldrdn, Slapi_D
     Slapi_Mods *smods = NULL;
     Slapi_DN newsrdn;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> slapi_entry_rename\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> slapi_entry_rename\n", 0, 0, 0 );
 
     slapi_sdn_init(&newsrdn);
     /* Check if entry or newrdn are NULL. */
@@ -3462,7 +3462,7 @@ done:
     slapi_mods_free(&smods);
     slapi_sdn_done(&newsrdn);
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_entry_rename\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= slapi_entry_rename\n", 0, 0, 0 );
     return err;
 }
 
@@ -3495,7 +3495,7 @@ entry_apply_mods_ignore_error( Slapi_Entry *e, LDAPMod **mods, int ignore_error
 	int	err;
 	LDAPMod **mp = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> entry_apply_mods\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> entry_apply_mods\n", 0, 0, 0 );
 
 	err = LDAP_SUCCESS;
 	for ( mp = mods; mp && *mp; mp++ )
@@ -3508,7 +3508,7 @@ entry_apply_mods_ignore_error( Slapi_Entry *e, LDAPMod **mods, int ignore_error
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= entry_apply_mods %d\n", err, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= entry_apply_mods %d\n", err, 0, 0 );
 	return( err );
 }
 
@@ -3660,7 +3660,7 @@ entry_apply_mod( Slapi_Entry *e, const LDAPMod *mod )
 	  if((strcasecmp(mod->mod_type,"objectclass") == 0)  
               && (strncasecmp((const char *)mod->mod_bvalues[i]->bv_val,"ldapsubentry",mod->mod_bvalues[i]->bv_len) == 0)) 
 	    sawsubentry=PR_TRUE;
-	  LDAPDebug( LDAP_DEBUG_ARGS, "   %s: %s\n", mod->mod_type, mod->mod_bvalues[i]->bv_val, 0 );
+	  LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   %s: %s\n", mod->mod_type, mod->mod_bvalues[i]->bv_val, 0 );
 	}
 	bvcnt = i;
 
@@ -3682,24 +3682,24 @@ entry_apply_mod( Slapi_Entry *e, const LDAPMod *mod )
 	switch ( mod->mod_op & ~LDAP_MOD_BVALUES )
 	{
 	case LDAP_MOD_ADD:
-		LDAPDebug( LDAP_DEBUG_ARGS, "   add: %s\n", mod->mod_type, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   add: %s\n", mod->mod_type, 0, 0 );
 		if(sawsubentry) e->e_flags |= SLAPI_ENTRY_LDAPSUBENTRY;
 		err = slapi_entry_add_values( e, mod->mod_type, mod->mod_bvalues );
 		break;
 
 	case LDAP_MOD_DELETE:
-		LDAPDebug( LDAP_DEBUG_ARGS, "   delete: %s\n", mod->mod_type, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   delete: %s\n", mod->mod_type, 0, 0 );
 		if(sawsubentry) e->e_flags |= 0;
 		err = slapi_entry_delete_values( e, mod->mod_type, mod->mod_bvalues );
 		break;
 
 	case LDAP_MOD_REPLACE:
-		LDAPDebug( LDAP_DEBUG_ARGS, "   replace: %s\n", mod->mod_type, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   replace: %s\n", mod->mod_type, 0, 0 );
 		err = entry_replace_values( e, mod->mod_type, mod->mod_bvalues );
 		break;
 	}
 done:
-	LDAPDebug( LDAP_DEBUG_ARGS, "   -\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   -\n", 0, 0, 0 );
 
 	return( err );
 }
@@ -3823,7 +3823,7 @@ delete_values_sv_internal(
 
 	/* delete the entire attribute */
 	if ( valuestodelete == NULL || valuestodelete[0] == NULL ){
-		LDAPDebug( LDAP_DEBUG_ARGS, "removing entire attribute %s\n",
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "removing entire attribute %s\n",
 		    type, 0, 0 );
 		retVal = attrlist_delete( &e->e_attrs, type);
 		if (flags & SLAPI_VALUE_FLAG_IGNOREERROR) {
@@ -3835,7 +3835,7 @@ delete_values_sv_internal(
 	/* delete specific values - find the attribute first */
 	a= attrlist_find(e->e_attrs, type);
 	if ( a == NULL ) {
-		LDAPDebug( LDAP_DEBUG_ARGS, "could not find attribute %s\n",
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "could not find attribute %s\n",
 		    type, 0, 0 );
 		if (flags & SLAPI_VALUE_FLAG_IGNOREERROR) {
 			return LDAP_SUCCESS;
@@ -3864,7 +3864,7 @@ delete_values_sv_internal(
 			 */
 			if ( retVal==LDAP_OPERATIONS_ERROR )
 			{
-				LDAPDebug( LDAP_DEBUG_ANY, "Possible existing duplicate "
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Possible existing duplicate "
 					"value for attribute type %s found in "
 					"entry %s\n", a->a_type, slapi_entry_get_dn_const(e), 0 );
 			}
@@ -4031,7 +4031,7 @@ slapi_entry_diff(Slapi_Mods *smods, Slapi_Entry *e1, Slapi_Entry *e2, int diff_c
                                                slapi_value_get_berval(e1_val)))
                 {
                     /* attr-value e1_val not found in e2_attr; add it */
-                    LDAPDebug(LDAP_DEBUG_TRACE,
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                         "slapi_entry_diff: attr-val of %s is not in e2; "
                         "add it\n",
                         e1_attr_name, 0, 0);
@@ -4043,7 +4043,7 @@ slapi_entry_diff(Slapi_Mods *smods, Slapi_Entry *e1, Slapi_Entry *e2, int diff_c
         else
         {
             /* attr e1_attr_names not found in e2 */
-            LDAPDebug(LDAP_DEBUG_TRACE,
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                       "slapi_entry_diff: attr %s is not in e2; add it\n",
                       e1_attr_name, 0, 0);
             slapi_mods_add_mod_values(smods, LDAP_MOD_ADD,
@@ -4077,7 +4077,7 @@ slapi_entry_diff(Slapi_Mods *smods, Slapi_Entry *e1, Slapi_Entry *e2, int diff_c
                                                slapi_value_get_berval(e2_val)))
                 {
                     /* attr-value e2_val not found in e1_attr; delete it */
-                    LDAPDebug(LDAP_DEBUG_TRACE,
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                         "slapi_entry_diff: attr-val of %s is not in e1; "
                         "delete it\n",
                         e2_attr_name, 0, 0);
@@ -4089,7 +4089,7 @@ slapi_entry_diff(Slapi_Mods *smods, Slapi_Entry *e1, Slapi_Entry *e2, int diff_c
         else
         {
             /* attr e2_attr_names not in e1 */
-            LDAPDebug(LDAP_DEBUG_TRACE,
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                       "slapi_entry_diff: attr %s is not in e1; delete it\n",
                       e2_attr_name, 0, 0);
             slapi_mods_add_mod_values(smods, LDAP_MOD_DELETE, e2_attr_name, NULL);
@@ -4184,7 +4184,7 @@ slapi_entries_diff(Slapi_Entry **old_entries, Slapi_Entry **curr_entries,
                     rval = 1;
                     if (isfirst)
                     {
-                        LDAPDebug(LDAP_DEBUG_ANY, "%sEntry %s\n", my_logging_prestr,
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%sEntry %s\n", my_logging_prestr,
                                   slapi_entry_get_dn_const(*oep), 0);
                         isfirst = 0;
                     }
@@ -4192,23 +4192,23 @@ slapi_entries_diff(Slapi_Entry **old_entries, Slapi_Entry **curr_entries,
                     switch (mod->mod_op & ~LDAP_MOD_BVALUES)
                     {
                     case LDAP_MOD_DELETE:
-                        LDAPDebug(LDAP_DEBUG_ANY,
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                   "  Del Attribute %s Value %s\n",
                                   mod->mod_type, mod->mod_bvalues?
                                   mod->mod_bvalues[0]->bv_val:"N/A", 0);
                         break;
                     case LDAP_MOD_ADD:
-                        LDAPDebug(LDAP_DEBUG_ANY, 
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                                   "  Add Attribute %s Value %s\n",
                                   mod->mod_type, mod->mod_bvalues[0]->bv_val, 0);
                         break;
                     case LDAP_MOD_REPLACE:
-                        LDAPDebug(LDAP_DEBUG_ANY,
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                   "  Rep Attribute %s Value %s\n",
                                   mod->mod_type, mod->mod_bvalues[0]->bv_val, 0);
                         break;
                     default:
-                        LDAPDebug(LDAP_DEBUG_ANY,
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                   "  Unknown op %d Attribute %s\n",
                                   mod->mod_op & ~LDAP_MOD_BVALUES,
                                   mod->mod_type, 0);
@@ -4245,7 +4245,7 @@ slapi_entries_diff(Slapi_Entry **old_entries, Slapi_Entry **curr_entries,
             slapi_entry_clear_flag(*oep, SLAPI_ENTRY_FLAG_DIFF_IN_BOTH);
         } else {
             rval = 1;
-            LDAPDebug(LDAP_DEBUG_ANY, "Add %sEntry %s\n", 
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Add %sEntry %s\n", 
                       my_logging_prestr, slapi_entry_get_dn_const(*oep), 0);
             if (testall)
             {
@@ -4274,7 +4274,7 @@ slapi_entries_diff(Slapi_Entry **old_entries, Slapi_Entry **curr_entries,
         } else {
             rval = 1;
 
-            LDAPDebug(LDAP_DEBUG_ANY, "Del %sEntry %s\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Del %sEntry %s\n",
                       my_logging_prestr, slapi_entry_get_dn_const(*cep), 0);
 
             if (testall)
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index a8f8455..3f53521 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -676,7 +676,7 @@ entry_delete_present_values_wsi_single_valued(Slapi_Entry *e, const char *type,
 	if ( vals == NULL || vals[0] == NULL )
 	{
 		/* delete the entire attribute */
-		LDAPDebug( LDAP_DEBUG_ARGS, "removing entire attribute %s\n", type, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "removing entire attribute %s\n", type, 0, 0 );
 		attr_set_deletion_csn(a,csn);
 		if(urp)
 		{
@@ -746,7 +746,7 @@ entry_delete_present_values_wsi_single_valued(Slapi_Entry *e, const char *type,
 				 */
 				if ( retVal==LDAP_OPERATIONS_ERROR )
 				{
-					LDAPDebug( LDAP_DEBUG_ANY, "Possible existing duplicate "
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Possible existing duplicate "
 						"value for attribute type %s found in "
 						"entry %s\n", a->a_type, slapi_entry_get_dn_const(e), 0 );
 				}
@@ -766,7 +766,7 @@ entry_delete_present_values_wsi_multi_valued(Slapi_Entry *e, const char *type, s
 		if ( vals == NULL || vals[0] == NULL )
 		{
 			/* delete the entire attribute */
-			LDAPDebug( LDAP_DEBUG_ARGS, "removing entire attribute %s\n", type, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "removing entire attribute %s\n", type, 0, 0 );
 			attr_set_deletion_csn(a,csn);
 			if(urp)
 			{
@@ -855,7 +855,7 @@ entry_delete_present_values_wsi_multi_valued(Slapi_Entry *e, const char *type, s
 					 */
 					if ( retVal==LDAP_OPERATIONS_ERROR )
 					{
-						LDAPDebug( LDAP_DEBUG_ANY, "Possible existing duplicate "
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Possible existing duplicate "
 						           "value for attribute type %s found in "
 						           "entry %s\n", a->a_type, slapi_entry_get_dn_const(e), 0 );
 					}
@@ -902,17 +902,17 @@ entry_apply_mod_wsi(Slapi_Entry *e, const LDAPMod *mod, const CSN *csn, int urp)
 	switch ( mod->mod_op & ~LDAP_MOD_BVALUES )
 	{
 	case LDAP_MOD_ADD:
-		LDAPDebug( LDAP_DEBUG_ARGS, "   add: %s\n", mod->mod_type, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   add: %s\n", mod->mod_type, 0, 0 );
 		retVal = entry_add_present_values_wsi( e, mod->mod_type, mod->mod_bvalues, csn, urp, 0 );
 		break;
 
 	case LDAP_MOD_DELETE:
-		LDAPDebug( LDAP_DEBUG_ARGS, "   delete: %s\n", mod->mod_type, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   delete: %s\n", mod->mod_type, 0, 0 );
 		retVal = entry_delete_present_values_wsi( e, mod->mod_type, mod->mod_bvalues, csn, urp, mod->mod_op, NULL );
 		break;
 
 	case LDAP_MOD_REPLACE:
-		LDAPDebug( LDAP_DEBUG_ARGS, "   replace: %s\n", mod->mod_type, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   replace: %s\n", mod->mod_type, 0, 0 );
 		retVal = entry_replace_present_values_wsi( e, mod->mod_type, mod->mod_bvalues, csn, urp );
 		break;
 	}
@@ -920,10 +920,10 @@ entry_apply_mod_wsi(Slapi_Entry *e, const LDAPMod *mod, const CSN *csn, int urp)
 		for ( i = 0;
 		      mod->mod_bvalues != NULL && mod->mod_bvalues[i] != NULL;
 		      i++ ) {
-			LDAPDebug( LDAP_DEBUG_ARGS, "   %s: %s\n",
+			LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   %s: %s\n",
 			           mod->mod_type, mod->mod_bvalues[i]->bv_val, 0 );
 		}
-		LDAPDebug( LDAP_DEBUG_ARGS, "   -\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "   -\n", 0, 0, 0 );
 	}
 
 	/* 
@@ -976,7 +976,7 @@ entry_apply_mods_wsi(Slapi_Entry *e, Slapi_Mods *smods, const CSN *csn, int urp)
 		localcsn = *csn; /* make a copy */
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> entry_apply_mods_wsi\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> entry_apply_mods_wsi\n", 0, 0, 0 );
 
 	mod = slapi_mods_get_first_mod(smods);
 	while(NULL!=mod && retVal==LDAP_SUCCESS)
@@ -1000,7 +1000,7 @@ entry_apply_mods_wsi(Slapi_Entry *e, Slapi_Mods *smods, const CSN *csn, int urp)
 		mod = slapi_mods_get_next_mod(smods);
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= entry_apply_mods_wsi %d\n", retVal, 0, 0 );	
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= entry_apply_mods_wsi %d\n", retVal, 0, 0 );	
 	
 	return retVal;
 }
diff --git a/ldap/servers/slapd/errormap.c b/ldap/servers/slapd/errormap.c
index efc39df..250d7d6 100644
--- a/ldap/servers/slapd/errormap.c
+++ b/ldap/servers/slapd/errormap.c
@@ -153,11 +153,11 @@ SECU_Strerror(PRErrorCode errNum) {
     	for (i = low + 1; i <= high; ++i) {
 	    num = errStrings[i].errNum;
 	    if (num <= lastNum) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"sequence error in error strings at item %d\n"
 			"error %d (%s)\n",
 			i, lastNum, errStrings[i-1].errString );
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"should come after \n"
 			"error %d (%s)\n",
 			num, errStrings[i].errString, 0 );
diff --git a/ldap/servers/slapd/extendop.c b/ldap/servers/slapd/extendop.c
index 978c92f..d67ef2c 100644
--- a/ldap/servers/slapd/extendop.c
+++ b/ldap/servers/slapd/extendop.c
@@ -32,7 +32,7 @@ static void extop_handle_import_start(Slapi_PBlock *pb, char *extoid,
     int ret;
 
     if (extval == NULL || extval->bv_val == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "extop_handle_import_start: no data supplied\n", 0, 0, 0);
         send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, 
                          "no data supplied", 0, NULL);
@@ -56,7 +56,7 @@ static void extop_handle_import_start(Slapi_PBlock *pb, char *extoid,
     }
     sdn = slapi_sdn_new_dn_passin(orig);
     if (!sdn) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "extop_handle_import_start: out of memory\n", 0, 0, 0);
         send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL);
         return;
@@ -69,7 +69,7 @@ static void extop_handle_import_start(Slapi_PBlock *pb, char *extoid,
         be = slapi_be_select_by_instance_name(suffix);
     }
     if (be == NULL || be == defbackend_get_backend()) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "bulk import: invalid suffix or instance name '%s'\n",
                   suffix, 0, 0);
         send_ldap_result(pb, LDAP_NO_SUCH_OBJECT, NULL, 
@@ -112,7 +112,7 @@ static void extop_handle_import_start(Slapi_PBlock *pb, char *extoid,
 
     if (be->be_wire_import == NULL) {
         /* not supported by this backend */
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "bulk import attempted on '%s' (not supported)\n",
                   suffix, 0, 0);
         send_ldap_result(pb, LDAP_NOT_SUPPORTED, NULL, NULL, 0, NULL);
@@ -125,7 +125,7 @@ static void extop_handle_import_start(Slapi_PBlock *pb, char *extoid,
     slapi_pblock_set(pb, SLAPI_BULK_IMPORT_STATE, &ret);
     ret = (*be->be_wire_import)(pb);
     if (ret != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "extop_handle_import_start: error starting import (%d)\n",
                   ret, 0, 0);
         send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL);
@@ -145,7 +145,7 @@ static void extop_handle_import_start(Slapi_PBlock *pb, char *extoid,
     bv.bv_len = 0;
     slapi_pblock_set(pb, SLAPI_EXT_OP_RET_VALUE, &bv);
     send_ldap_result(pb, LDAP_SUCCESS, NULL, NULL, 0, NULL);
-    LDAPDebug(LDAP_DEBUG_ANY,
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "Bulk import: begin import on '%s'.\n", suffix, 0, 0);
 
 out:
@@ -168,7 +168,7 @@ static void extop_handle_import_done(Slapi_PBlock *pb, char *extoid,
 
     if ((be == NULL) || (be->be_wire_import == NULL)) {
         /* can this even happen? */
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "extop_handle_import_done: backend not supported\n",
                   0, 0, 0);
         send_ldap_result(pb, LDAP_NOT_SUPPORTED, NULL, NULL, 0, NULL);
@@ -182,7 +182,7 @@ static void extop_handle_import_done(Slapi_PBlock *pb, char *extoid,
     slapi_pblock_set(pb, SLAPI_BULK_IMPORT_STATE, &ret);
     ret = (*be->be_wire_import)(pb);
     if (ret != 0) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "bulk import: error ending import (%d)\n",
                   ret, 0, 0);
         send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL);
@@ -195,7 +195,7 @@ static void extop_handle_import_done(Slapi_PBlock *pb, char *extoid,
     bv.bv_len = 0;
     slapi_pblock_set(pb, SLAPI_EXT_OP_RET_VALUE, &bv);
     send_ldap_result(pb, LDAP_SUCCESS, NULL, NULL, 0, NULL);
-    LDAPDebug(LDAP_DEBUG_ANY,
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "Bulk import completed successfully.\n", 0, 0, 0);
     return;
 }
@@ -212,7 +212,7 @@ do_extended( Slapi_PBlock *pb )
     ber_tag_t   tag;
     const char  *name;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "do_extended\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_extended\n", 0, 0, 0 );
 
     /*
      * Parse the extended request. It looks like this:
@@ -225,7 +225,7 @@ do_extended( Slapi_PBlock *pb )
 
     if ( ber_scanf( pb->pb_op->o_ber, "{a", &extoid )
         == LBER_ERROR ) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "ber_scanf failed (op=extended; params=OID)\n",
             0, 0, 0 );
         op_shared_log_error_access (pb, "EXT", "???", "decoding error: fail to get extension OID");
@@ -251,12 +251,12 @@ do_extended( Slapi_PBlock *pb )
         }
     }
     if ( NULL == ( name = extended_op_oid2string( extoid ))) {
-        LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s)\n", extoid, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "do_extended: oid (%s)\n", extoid, 0, 0 );
 
         slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d EXT oid=\"%s\"\n",
                 pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid );
     } else {
-        LDAPDebug( LDAP_DEBUG_ARGS, "do_extended: oid (%s-%s)\n",
+        LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "do_extended: oid (%s-%s)\n",
                 extoid, name, 0 );
 
         slapi_log_access( LDAP_DEBUG_STATS,
diff --git a/ldap/servers/slapd/factory.c b/ldap/servers/slapd/factory.c
index 7237f0c..146e7a4 100644
--- a/ldap/servers/slapd/factory.c
+++ b/ldap/servers/slapd/factory.c
@@ -170,9 +170,9 @@ factory_type_add_extension(struct factory_type *ft, struct factory_extension *fe
     }
     else
     {
-        LDAPDebug( LDAP_DEBUG_ANY, "ERROR: factory.c: Registration of %s extension by %s failed.\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: factory.c: Registration of %s extension by %s failed.\n",
                    ft->name, fe->pluginname, 0);
-        LDAPDebug( LDAP_DEBUG_ANY, "ERROR: factory.c: %d extensions already registered. Max is %d\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: factory.c: %d extensions already registered. Max is %d\n",
                    ft->extension_count, MAX_EXTENSIONS, 0);
     }
 
@@ -193,7 +193,7 @@ factory_type_decrement_existence(struct factory_type *ft)
 	if(ft->existence_count<0)
 	{
 	    /* This just shouldn't happen */
-   		LDAPDebug( LDAP_DEBUG_ANY, "ERROR: factory.c: %lu %s object extensions in existence.\n", ft->extension_count, ft->name, 0);
+   		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: factory.c: %lu %s object extensions in existence.\n", ft->extension_count, ft->name, 0);
 	}
 }
 
@@ -274,8 +274,8 @@ factory_register_type(const char *name, size_t offset)
 	}
 	else
 	{
-   		LDAPDebug( LDAP_DEBUG_ANY, "ERROR: factory.c: Registration of %s object failed.\n", name, 0, 0);
-   		LDAPDebug( LDAP_DEBUG_ANY, "ERROR: factory.c: %d objects already registered. Max is %d\n", number_of_types, MAX_TYPES, 0);
+   		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: factory.c: Registration of %s object failed.\n", name, 0, 0);
+   		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: factory.c: %d objects already registered. Max is %d\n", number_of_types, MAX_TYPES, 0);
 	    type= -1;
 	}
 	PR_Unlock(factory_type_store_lock);
@@ -323,7 +323,7 @@ factory_create_extension(int type,void *object,void *parent)
 	else
 	{
 	    /* The type wasn't registered. Programming error? */
-   		LDAPDebug( LDAP_DEBUG_ANY, "ERROR: factory.c: Object type handle %d not valid. Object not registered?\n", type, 0, 0);
+   		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: factory.c: Object type handle %d not valid. Object not registered?\n", type, 0, 0);
 	}
 	return (void*)extension;
 }
@@ -364,7 +364,7 @@ factory_destroy_extension(int type,void *object,void *parent,void **extension)
 		else
 		{
 			/* The type wasn't registered. Programming error? */
-			LDAPDebug( LDAP_DEBUG_ANY, "ERROR: factory.c: Object type handle %d not valid. Object not registered?\n", type, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: factory.c: Object type handle %d not valid. Object not registered?\n", type, 0, 0);
 		}
 		slapi_ch_free(extension);
 	}
@@ -429,7 +429,7 @@ slapi_register_object_extension(
 	}
 	else
 	{
-   		LDAPDebug( LDAP_DEBUG_ANY, "ERROR: factory.c: Plugin %s failed to register extension for object %s.\n", pluginname, objectname, 0);
+   		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: factory.c: Plugin %s failed to register extension for object %s.\n", pluginname, objectname, 0);
 		rc= -1;
 		delete_factory_extension(&fe);
 	}
diff --git a/ldap/servers/slapd/filter.c b/ldap/servers/slapd/filter.c
index 03636ba..ca4224e 100644
--- a/ldap/servers/slapd/filter.c
+++ b/ldap/servers/slapd/filter.c
@@ -153,7 +153,7 @@ get_filter_internal( Connection *conn, BerElement *ber,
     struct slapi_filter	*f;
     char		*ftmp, *type = NULL;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> get_filter_internal\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> get_filter_internal\n", 0, 0, 0 );
 
 	/*
 	 * Track and check the depth of nesting.  Use post-increment on
@@ -164,7 +164,7 @@ get_filter_internal( Connection *conn, BerElement *ber,
 		*filt = NULL;
 		*fstr = NULL;
 		err = LDAP_UNWILLING_TO_PERFORM;
-		LDAPDebug( LDAP_DEBUG_FILTER, "<= get_filter_internal %d"
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= get_filter_internal %d"
 				" (maximum nesting level of %d exceeded)\n",
 				err, maxdepth, 0 );
 		return( err );
@@ -211,7 +211,7 @@ get_filter_internal( Connection *conn, BerElement *ber,
 	f->f_choice = ber_peek_tag( ber, &len );
 	switch ( f->f_choice ) {
 	case LDAP_FILTER_EQUALITY:
-		LDAPDebug( LDAP_DEBUG_FILTER, "EQUALITY\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "EQUALITY\n", 0, 0, 0 );
 		if ( (err = get_ava( ber, &f->f_ava )) == 0 ) {
 
 			if ( 0 == strcasecmp ( f->f_avtype, "objectclass")) {
@@ -260,26 +260,26 @@ get_filter_internal( Connection *conn, BerElement *ber,
 		break;
 
 	case LDAP_FILTER_SUBSTRINGS:
-		LDAPDebug( LDAP_DEBUG_FILTER, "SUBSTRINGS\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "SUBSTRINGS\n", 0, 0, 0 );
 		err = get_substring_filter( conn, ber, f, fstr );
 		break;
 
 	case LDAP_FILTER_GE:
-		LDAPDebug( LDAP_DEBUG_FILTER, "GE\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "GE\n", 0, 0, 0 );
 		if ( (err = get_ava( ber, &f->f_ava )) == 0 ) {
 		  *fstr=filter_escape_filter_value(f, FILTER_GE_FMT, FILTER_GE_LEN);
 		}
 		break;
 
 	case LDAP_FILTER_LE:
-		LDAPDebug( LDAP_DEBUG_FILTER, "LE\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "LE\n", 0, 0, 0 );
 		if ( (err = get_ava( ber, &f->f_ava )) == 0 ) {
 		  *fstr=filter_escape_filter_value(f, FILTER_LE_FMT, FILTER_LE_LEN);
 		}
 		break;
 
 	case LDAP_FILTER_PRESENT:
-		LDAPDebug( LDAP_DEBUG_FILTER, "PRESENT\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "PRESENT\n", 0, 0, 0 );
 		if ( ber_scanf( ber, "a", &type ) == LBER_ERROR ) {
             slapi_ch_free_string(&type);
 			err = LDAP_PROTOCOL_ERROR;
@@ -293,22 +293,22 @@ get_filter_internal( Connection *conn, BerElement *ber,
 		break;
 
 	case LDAP_FILTER_APPROX:
-		LDAPDebug( LDAP_DEBUG_FILTER, "APPROX\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "APPROX\n", 0, 0, 0 );
 		if ( (err = get_ava( ber, &f->f_ava )) == 0 ) {
 		  *fstr=filter_escape_filter_value(f, FILTER_APROX_FMT, FILTER_APROX_LEN);
 		}
 		break;
 
     case LDAP_FILTER_EXTENDED:
-        LDAPDebug( LDAP_DEBUG_FILTER, "EXTENDED\n", 0, 0, 0 );
+        LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "EXTENDED\n", 0, 0, 0 );
         if ( conn->c_ldapversion < 3 ) {
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "extensible filter received from v2 client\n",
                 0, 0, 0 );
             err = LDAP_PROTOCOL_ERROR;
         } else if ( (err = get_extensible_filter( ber, &f->f_mr )) == LDAP_SUCCESS ) {           
             *fstr=filter_escape_filter_value_extended(f); 
-            LDAPDebug (LDAP_DEBUG_FILTER, "%s\n", *fstr, 0, 0);
+            LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "%s\n", *fstr, 0, 0);
             if(f->f_mr_oid==NULL) {
             /*
             * We accept:
@@ -323,7 +323,7 @@ get_filter_internal( Connection *conn, BerElement *ber,
         break;
 
 	case LDAP_FILTER_AND:
-		LDAPDebug( LDAP_DEBUG_FILTER, "AND\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "AND\n", 0, 0, 0 );
 		if ( (err = get_filter_list( conn, ber, &f->f_and, &ftmp, maxdepth,
 					curdepth, subentry_dont_rewrite,
 					has_tombstone_filter, has_ruv_filter ))
@@ -335,7 +335,7 @@ get_filter_internal( Connection *conn, BerElement *ber,
 		break;
 
 	case LDAP_FILTER_OR:
-		LDAPDebug( LDAP_DEBUG_FILTER, "OR\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "OR\n", 0, 0, 0 );
 		if ( (err = get_filter_list( conn, ber, &f->f_or, &ftmp, maxdepth,
 					curdepth, subentry_dont_rewrite,
 					has_tombstone_filter, has_ruv_filter ))
@@ -347,7 +347,7 @@ get_filter_internal( Connection *conn, BerElement *ber,
 		break;
 
 	case LDAP_FILTER_NOT:
-		LDAPDebug( LDAP_DEBUG_FILTER, "NOT\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "NOT\n", 0, 0, 0 );
 		(void) ber_skip_tag( ber, &len );
 		if ( (err = get_filter_internal( conn, ber, &f->f_not, &ftmp, maxdepth,
 					curdepth, subentry_dont_rewrite,
@@ -360,7 +360,7 @@ get_filter_internal( Connection *conn, BerElement *ber,
 		break;
 
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY, "get_filter_internal: unknown type 0x%lX\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "get_filter_internal: unknown type 0x%lX\n",
 		    f->f_choice, 0, 0 );
 		err = LDAP_PROTOCOL_ERROR;
 		break;
@@ -372,7 +372,7 @@ get_filter_internal( Connection *conn, BerElement *ber,
 		slapi_ch_free( (void**)fstr );
 	}
 	*filt = f;
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= get_filter_internal %d\n", err, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= get_filter_internal %d\n", err, 0, 0 );
 	return( err );
 }
 
@@ -388,7 +388,7 @@ get_filter_list( Connection *conn, BerElement *ber,
 	ber_len_t	len = LBER_ERROR;
 	char		*last;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> get_filter_list\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> get_filter_list\n", 0, 0, 0 );
 
 	*fstr = NULL;
 	new = f;
@@ -423,11 +423,11 @@ get_filter_list( Connection *conn, BerElement *ber,
 	   len if it has reached the end, and -1 is not a valid value
 	   for a real len */
 	if ( (tag != LBER_END_OF_SEQORSET) && (len != -1) && (*fstr != NULL) ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "   error parsing filter list\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "   error parsing filter list\n", 0, 0, 0 );
 		slapi_ch_free((void**)fstr );
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= get_filter_list\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= get_filter_list\n", 0, 0, 0 );
 	return(( *fstr == NULL ) ? LDAP_PROTOCOL_ERROR : 0 );
 }
 
@@ -444,7 +444,7 @@ get_substring_filter(
 	char		*val, *eval, *last, *type = NULL;
 	size_t fstr_len;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> get_substring_filter\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> get_substring_filter\n", 0, 0, 0 );
 
 	if ( ber_scanf( ber, "{a", &type ) == LBER_ERROR ) {
 		slapi_ch_free_string(&type);
@@ -480,7 +480,7 @@ get_substring_filter(
 
 		switch ( tag ) {
 		case LDAP_SUBSTRING_INITIAL:
-			LDAPDebug( LDAP_DEBUG_FILTER, "  INITIAL\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "  INITIAL\n", 0, 0, 0 );
 			if ( f->f_sub_initial != NULL ) {
 				return( LDAP_PROTOCOL_ERROR );
 			}
@@ -497,7 +497,7 @@ get_substring_filter(
 			break;
 
 		case LDAP_SUBSTRING_ANY:
-			LDAPDebug( LDAP_DEBUG_FILTER, "  ANY\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "  ANY\n", 0, 0, 0 );
 			charray_add(&f->f_sub_any, val);
 			eval = (char*)slapi_escape_filter_value(val, -1);
 			if(eval){
@@ -512,7 +512,7 @@ get_substring_filter(
 			break;
 
 		case LDAP_SUBSTRING_FINAL:
-			LDAPDebug( LDAP_DEBUG_FILTER, "  FINAL\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "  FINAL\n", 0, 0, 0 );
 			if ( f->f_sub_final != NULL ) {
 				return( LDAP_PROTOCOL_ERROR );
 			}
@@ -530,13 +530,13 @@ get_substring_filter(
 			break;
 
 		default:
-			LDAPDebug( LDAP_DEBUG_FILTER, "  unknown tag 0x%lX\n", tag, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "  unknown tag 0x%lX\n", tag, 0, 0 );
 			return( LDAP_PROTOCOL_ERROR );
 		}
 	}
 
 	if ( (tag != LBER_END_OF_SEQORSET) && (len != -1) ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "  error reading substring filter\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "  error reading substring filter\n", 0, 0, 0 );
 		return( LDAP_PROTOCOL_ERROR );
 	}
 	if ( f->f_sub_initial == NULL && f->f_sub_any == NULL &&
@@ -554,7 +554,7 @@ get_substring_filter(
 	}
 	strcat( *fstr, ")" );
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= get_substring_filter\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= get_substring_filter\n", 0, 0, 0 );
 	return( 0 );
 }
 
@@ -567,7 +567,7 @@ get_extensible_filter( BerElement *ber, mr_filter_t* mrf )
 	char		*last;
 	int		rc = LDAP_SUCCESS;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> get_extensible_filter\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> get_extensible_filter\n", 0, 0, 0 );
 	memset (mrf, 0, sizeof (mr_filter_t));
 
 	gotelem = gotoid = gotvalue = 0;
@@ -642,11 +642,11 @@ get_extensible_filter( BerElement *ber, mr_filter_t* mrf )
 		goto parsing_error;
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= get_extensible_filter %i\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= get_extensible_filter %i\n", rc, 0, 0 );
 	return rc;
 
 parsing_error:;
-	LDAPDebug( LDAP_DEBUG_ANY, "error parsing extensible filter\n",
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "error parsing extensible filter\n",
 	    0, 0, 0 );
 	return( LDAP_PROTOCOL_ERROR );
 }
@@ -666,7 +666,7 @@ slapi_filter_dup(Slapi_Filter *f)
 
 	out = (struct slapi_filter*)slapi_ch_calloc(1, sizeof(struct slapi_filter));
 	if ( out == NULL ) {
-		LDAPDebug(LDAP_DEBUG_ANY, "slapi_filter_dup: memory allocation error\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapi_filter_dup: memory allocation error\n",
 		    0, 0, 0 );
 		return NULL;
 	}
@@ -675,7 +675,7 @@ slapi_filter_dup(Slapi_Filter *f)
 	out->f_hash = f->f_hash;
 	out->f_flags = f->f_flags;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "slapi_filter_dup type 0x%lX\n", f->f_choice, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "slapi_filter_dup type 0x%lX\n", f->f_choice, 0, 0 );
 	switch ( f->f_choice ) {
 	case LDAP_FILTER_EQUALITY:
 	case LDAP_FILTER_GE:
@@ -723,7 +723,7 @@ slapi_filter_dup(Slapi_Filter *f)
 		break;
 
 	default:
-		LDAPDebug(LDAP_DEBUG_FILTER, "slapi_filter_dup: unknown type 0x%lX\n",
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "slapi_filter_dup: unknown type 0x%lX\n",
 		    f->f_choice, 0, 0 );
 		break;
 	}
@@ -738,7 +738,7 @@ slapi_filter_free( struct slapi_filter *f, int recurse )
 		return;
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "slapi_filter_free type 0x%lX\n", f->f_choice, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "slapi_filter_free type 0x%lX\n", f->f_choice, 0, 0 );
 	switch ( f->f_choice ) {
 	case LDAP_FILTER_EQUALITY:
 	case LDAP_FILTER_GE:
@@ -787,7 +787,7 @@ slapi_filter_free( struct slapi_filter *f, int recurse )
 		break;
 
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY, "slapi_filter_free: unknown type 0x%lX\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapi_filter_free: unknown type 0x%lX\n",
 		    f->f_choice, 0, 0 );
 		break;
 	}
diff --git a/ldap/servers/slapd/filtercmp.c b/ldap/servers/slapd/filtercmp.c
index 31670ed..fe8c2ee 100644
--- a/ldap/servers/slapd/filtercmp.c
+++ b/ldap/servers/slapd/filtercmp.c
@@ -195,7 +195,7 @@ void filter_compute_hash(struct slapi_filter *f)
 	/* get the normalized value (according to the matching rule) */
 	pb = get_mr_normval(f->f_mr_oid, f->f_mr_type, inval, &outval);
 	if (!pb) {
-		LDAPDebug(LDAP_DEBUG_ANY, "$$$ out of memory !\n", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "$$$ out of memory !\n", 0, 0, 0);
 		return;
 	}
 	if (outval && outval[0]) {
@@ -207,7 +207,7 @@ void filter_compute_hash(struct slapi_filter *f)
 	    STIR(h);
 	break;
     default:
-	LDAPDebug(LDAP_DEBUG_ANY, "$$$ can't handle filter type %d !\n",
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "$$$ can't handle filter type %d !\n",
 		  f->f_choice, 0, 0);
     }
 
@@ -328,7 +328,7 @@ int slapi_filter_compare(struct slapi_filter *f1, struct slapi_filter *f2)
     int ret;
     Slapi_Attr sattr;
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "=> filter compare\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> filter compare\n", 0, 0, 0);
 
     /* allow for the possibility that one of the filters hasn't had a hash
      * computed (and is therefore 0).  this means that a filter node whose
@@ -410,12 +410,12 @@ int slapi_filter_compare(struct slapi_filter *f1, struct slapi_filter *f2)
 	    done_mr_normval(pb2);
 	break;
     default:
-	LDAPDebug(LDAP_DEBUG_ANY, "ERR can't handle filter %d\n", f1->f_choice,
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERR can't handle filter %d\n", f1->f_choice,
 		  0, 0);
 	ret = 1;
     }
 
 done:
-    LDAPDebug(LDAP_DEBUG_TRACE, "<= filter compare: %d\n", ret, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= filter compare: %d\n", ret, 0, 0);
     return ret;
 }
diff --git a/ldap/servers/slapd/filterentry.c b/ldap/servers/slapd/filterentry.c
index fe8dc28..657b4a8 100644
--- a/ldap/servers/slapd/filterentry.c
+++ b/ldap/servers/slapd/filterentry.c
@@ -115,7 +115,7 @@ slapi_filter_test_ext_internal(
 {
 	int	rc;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> slapi_filter_test_ext\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> slapi_filter_test_ext\n", 0, 0, 0 );
 
 	/*
 	 * RJP: Not sure if this is semantically right, but we have to
@@ -128,58 +128,58 @@ slapi_filter_test_ext_internal(
 
 	switch ( f->f_choice ) {
 	case LDAP_FILTER_EQUALITY:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    EQUALITY\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    EQUALITY\n", 0, 0, 0 );
 		rc = test_ava_filter( pb, e, e->e_attrs, &f->f_ava, LDAP_FILTER_EQUALITY,
 					verify_access , only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_SUBSTRINGS:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    SUBSTRINGS\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    SUBSTRINGS\n", 0, 0, 0 );
 		rc = test_substring_filter( pb, e, f, verify_access , only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_GE:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    GE\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    GE\n", 0, 0, 0 );
 		rc = test_ava_filter( pb, e, e->e_attrs, &f->f_ava, LDAP_FILTER_GE,
 					verify_access , only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_LE:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    LE\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    LE\n", 0, 0, 0 );
 		rc = test_ava_filter( pb, e, e->e_attrs, &f->f_ava, LDAP_FILTER_LE,
 					verify_access , only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_PRESENT:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    PRESENT\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    PRESENT\n", 0, 0, 0 );
 		rc = test_presence_filter( pb, e, f->f_type, verify_access , only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_APPROX:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    APPROX\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    APPROX\n", 0, 0, 0 );
 		rc = test_ava_filter( pb, e, e->e_attrs, &f->f_ava, LDAP_FILTER_APPROX,
 					verify_access , only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_EXTENDED:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    EXTENDED\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    EXTENDED\n", 0, 0, 0 );
 		rc = test_extensible_filter( pb, e, &f->f_mr, verify_access , only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_AND:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    AND\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    AND\n", 0, 0, 0 );
 		rc = test_filter_list( pb, e, f->f_and, 
 					LDAP_FILTER_AND , verify_access, only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_OR:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    OR\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    OR\n", 0, 0, 0 );
 		rc = test_filter_list( pb, e, f->f_or, 
 					LDAP_FILTER_OR , verify_access, only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_NOT:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    NOT\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    NOT\n", 0, 0, 0 );
 		rc = slapi_filter_test_ext_internal( pb, e, f->f_not , verify_access, only_check_access, access_check_done);
 		if(!(verify_access && only_check_access))  /* dont play with access control return codes */
 		{
@@ -202,12 +202,12 @@ slapi_filter_test_ext_internal(
 		break;
 
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY, "    unknown filter type 0x%lX\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "    unknown filter type 0x%lX\n",
 		    f->f_choice, 0, 0 );
 		rc = -1;
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= slapi_filter_test %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= slapi_filter_test %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -275,7 +275,7 @@ int test_ava_filter(
 {
 	int			rc;
 	
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> test_ava_filter\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> test_ava_filter\n", 0, 0, 0 );
 
 	*access_check_done = 0;
 
@@ -314,7 +314,7 @@ int test_ava_filter(
 								SLAPI_ACL_SEARCH, ACLPLUGIN_ACCESS_DEFAULT, NULL );
 			*access_check_done = -1;
 			if ( only_check_access || rc != LDAP_SUCCESS ) {
-				LDAPDebug( LDAP_DEBUG_FILTER, "<= test_ava_filter %d\n",
+				LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= test_ava_filter %d\n",
 					rc, 0, 0 );
 				return( rc );
 			}
@@ -331,7 +331,7 @@ int test_ava_filter(
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= test_ava_filter %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= test_ava_filter %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -462,7 +462,7 @@ test_extensible_filter(
      */
     int	rc;
 		
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> test_extensible_filter\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> test_extensible_filter\n", 0, 0, 0 );
 
 	*access_check_done = 0;
 
@@ -580,7 +580,7 @@ test_extensible_filter(
 		}
 	}
 
-    LDAPDebug( LDAP_DEBUG_FILTER, "<= test_extensible_filter %d\n", rc, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= test_extensible_filter %d\n", rc, 0, 0 );
     return( rc );
 }
 
@@ -600,7 +600,7 @@ test_filter_list(
 	struct slapi_filter	*f;
 	int access_check_tmp = -1;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> test_filter_list\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> test_filter_list\n", 0, 0, 0 );
 
 	*access_check_done = -1;
 
@@ -627,7 +627,7 @@ test_filter_list(
 			*access_check_done = 0;
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= test_filter_list %d\n", nomatch, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= test_filter_list %d\n", nomatch, 0, 0 );
 	return( nomatch );
 }
 
@@ -683,7 +683,7 @@ int test_substring_filter(
 	Slapi_Attr	*a;
 	int		rc;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> test_substring_filter\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> test_substring_filter\n", 0, 0, 0 );
 
 	*access_check_done = 0;
 
@@ -737,7 +737,7 @@ int test_substring_filter(
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= test_substring_filter %d\n",
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= test_substring_filter %d\n",
 	    rc, 0, 0 );
 	return( rc );
 }
@@ -844,7 +844,7 @@ slapi_vattr_filter_test_ext_internal(
 {
 	int	rc = LDAP_SUCCESS;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> slapi_vattr_filter_test_ext\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> slapi_vattr_filter_test_ext\n", 0, 0, 0 );
 
 	/*
 	 * RJP: Not sure if this is semantically right, but we have to
@@ -855,11 +855,11 @@ slapi_vattr_filter_test_ext_internal(
 	  return(0);
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> test_substring_filter\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> test_substring_filter\n", 0, 0, 0 );
 
 	switch ( f->f_choice ) {
 	case LDAP_FILTER_EQUALITY:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    EQUALITY\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    EQUALITY\n", 0, 0, 0 );
 		if ( verify_access ) {
 			rc = test_filter_access( pb, e, f->f_ava.ava_type,
 											&f->f_ava.ava_value);
@@ -872,7 +872,7 @@ slapi_vattr_filter_test_ext_internal(
 		break;
 
 	case LDAP_FILTER_SUBSTRINGS:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    SUBSTRINGS\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    SUBSTRINGS\n", 0, 0, 0 );
 		if ( verify_access ) {
 			rc = test_filter_access( pb, e, f->f_sub_type, NULL);
 			*access_check_done = 1;
@@ -884,7 +884,7 @@ slapi_vattr_filter_test_ext_internal(
 		break;
 
 	case LDAP_FILTER_GE:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    GE\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    GE\n", 0, 0, 0 );
 		if ( verify_access ) {
 			rc = test_filter_access( pb, e, f->f_ava.ava_type,
 										&f->f_ava.ava_value);
@@ -897,7 +897,7 @@ slapi_vattr_filter_test_ext_internal(
 		break;
 
 	case LDAP_FILTER_LE:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    LE\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    LE\n", 0, 0, 0 );
 		if ( verify_access ) {
 			rc = test_filter_access( pb, e, f->f_ava.ava_type,
 										&f->f_ava.ava_value);
@@ -910,7 +910,7 @@ slapi_vattr_filter_test_ext_internal(
 		break;
 
 	case LDAP_FILTER_PRESENT:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    PRESENT\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    PRESENT\n", 0, 0, 0 );
 		if ( verify_access ) {
 			rc = test_filter_access( pb, e, f->f_type, NULL);
 			*access_check_done = 1;
@@ -922,7 +922,7 @@ slapi_vattr_filter_test_ext_internal(
 		break;
 
 	case LDAP_FILTER_APPROX:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    APPROX\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    APPROX\n", 0, 0, 0 );
 		if ( verify_access ) {
 			rc = test_filter_access( pb, e, f->f_ava.ava_type,
 										&f->f_ava.ava_value);
@@ -935,25 +935,25 @@ slapi_vattr_filter_test_ext_internal(
 		break;
 
 	case LDAP_FILTER_EXTENDED:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    EXTENDED\n", 0, 0, 0 );		
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    EXTENDED\n", 0, 0, 0 );		
 		rc = test_extensible_filter( pb, e, &f->f_mr, verify_access ,
 											only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_AND:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    AND\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    AND\n", 0, 0, 0 );
 		rc = vattr_test_filter_list_and( pb, e, f->f_and,
 					LDAP_FILTER_AND , verify_access, only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_OR:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    OR\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    OR\n", 0, 0, 0 );
 		rc = vattr_test_filter_list_or( pb, e, f->f_or,
 					LDAP_FILTER_OR , verify_access, only_check_access, access_check_done);
 		break;
 
 	case LDAP_FILTER_NOT:
-		LDAPDebug( LDAP_DEBUG_FILTER, "    NOT\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "    NOT\n", 0, 0, 0 );
 		rc = slapi_vattr_filter_test_ext_internal( pb, e, f->f_not , verify_access, only_check_access, access_check_done);
 		if(verify_access && only_check_access) 
 		{
@@ -993,13 +993,13 @@ slapi_vattr_filter_test_ext_internal(
 		break;
 
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY, "    unknown filter type 0x%lX\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "    unknown filter type 0x%lX\n",
 		    f->f_choice, 0, 0 );
 		rc = -1;
 	}
 
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= slapi_vattr_filter_test %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= slapi_vattr_filter_test %d\n", rc, 0, 0 );
 	return( rc );
 }
 
@@ -1037,7 +1037,7 @@ vattr_test_filter_list_and(
 	int rc = 0;
 	struct slapi_filter	*f;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> vattr_test_filter_list_and\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> vattr_test_filter_list_and\n", 0, 0, 0 );
 
 	for ( f = flist; f != NULL; f = f->f_next ) {
 		rc = slapi_vattr_filter_test_ext_internal( pb, e, f, verify_access, only_check_access, access_check_done );
@@ -1058,7 +1058,7 @@ vattr_test_filter_list_and(
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= test_filter_list_and %d\n", nomatch, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= test_filter_list_and %d\n", nomatch, 0, 0 );
 	if (undefined) return undefined;
 	return( nomatch );
 }
@@ -1079,7 +1079,7 @@ vattr_test_filter_list_or(
 	int rc = 0;
 	struct slapi_filter	*f;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> vattr_test_filter_list_or\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> vattr_test_filter_list_or\n", 0, 0, 0 );
 
 	for ( f = flist; f != NULL; f = f->f_next ) {
 		if ( verify_access) {
@@ -1107,7 +1107,7 @@ vattr_test_filter_list_or(
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= test_filter_list_or %d\n", nomatch, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= test_filter_list_or %d\n", nomatch, 0, 0 );
 
 	if (nomatch == 1) return undefined;
 	return( nomatch );
diff --git a/ldap/servers/slapd/init.c b/ldap/servers/slapd/init.c
index 5567d60..5ccdea8 100644
--- a/ldap/servers/slapd/init.c
+++ b/ldap/servers/slapd/init.c
@@ -35,7 +35,7 @@ slapd_init()
 
 	if ( g_get_current_conn_count_mutex() == NULL )
 	{
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "init: PR_NewLock failed\n", 0, 0, 0 );
 		exit( -1 );
 	}
@@ -44,7 +44,7 @@ slapd_init()
 	set_attr_to_protected_list(PSEUDO_ATTR_UNHASHEDUSERPASSWORD, 0);
 #ifndef HAVE_TIME_R
 	if ((time_func_mutex = PR_NewLock()) == NULL ) {
-                LDAPDebug( LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "init: PR_NewLock failed\n", 0, 0, 0 );
                 exit(-1);
         }
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 538a167..9a114a0 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -1434,13 +1434,13 @@ FrontendConfig_init(void) {
 #if SLAPI_CFG_USE_RWLOCK == 1
   /* initialize the read/write configuration lock */
   if ( (cfg->cfg_rwlock = slapi_new_rwlock()) == NULL ) {
-	LDAPDebug ( LDAP_DEBUG_ANY, "FrontendConfig_init: "
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "FrontendConfig_init: "
 	  "failed to initialize cfg_rwlock. Exiting now.",0,0,0);
 	exit(-1);
   }
 #else
   if ((cfg->cfg_lock = PR_NewLock()) == NULL){
-	LDAPDebug(LDAP_DEBUG_ANY, "FrontendConfig_init: "
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "FrontendConfig_init: "
 	  "failed to initialize cfg_lock. Exiting now.",0,0,0);
 	exit(-1);
   }
@@ -2037,7 +2037,7 @@ config_set_port( const char *attrname, char *port, char *errorbuf, int apply ) {
   }
 
   if ( nPort == 0 ) {
-      LDAPDebug( LDAP_DEBUG_ANY, "Information: Non-Secure Port Disabled\n", 0, 0, 0 );
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Information: Non-Secure Port Disabled\n", 0, 0, 0 );
   }
   
   if ( apply ) {
@@ -7181,7 +7181,7 @@ config_set_allowed_sasl_mechs(const char *attrname, char *value, char *errorbuf,
     remove_commas(value);
 
     if(invalid_sasl_mech(value)){
-        LDAPDebug(LDAP_DEBUG_ANY,"Invalid value/character for sasl mechanism (%s).  Use ASCII "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Invalid value/character for sasl mechanism (%s).  Use ASCII "
                                  "characters, upto 20 characters, that are upper-case letters, "
                                  "digits, hyphens, or underscores\n", value, 0, 0);
         return LDAP_UNWILLING_TO_PERFORM;
@@ -7628,7 +7628,7 @@ config_set(const char *attr, struct berval **values, char *errorbuf, int apply)
 							(char *)values[ii]->bv_val, cgas->whichlog,
 							errorbuf, apply);
 			} else {
-				LDAPDebug(LDAP_DEBUG_ANY, 
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 						  "config_set: the attribute %s is read only; ignoring new value %s\n",
 						  attr, values[ii]->bv_val, 0);
 			}
diff --git a/ldap/servers/slapd/localhost.c b/ldap/servers/slapd/localhost.c
index b5df93f..2e2a75a 100644
--- a/ldap/servers/slapd/localhost.c
+++ b/ldap/servers/slapd/localhost.c
@@ -64,7 +64,7 @@ find_localhost_DNS(void)
     if (gethostname (hostname, MAXHOSTNAMELEN)) {
         int oserr = errno;
 
-        LDAPDebug (LDAP_DEBUG_ANY, "gethostname() failed, error %d (%s)\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "gethostname() failed, error %d (%s)\n",
                 oserr, slapd_system_strerror( oserr ), 0 );
         return NULL;
     }
@@ -72,23 +72,23 @@ find_localhost_DNS(void)
     if (hp == NULL) {
         int oserr = errno;
 
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "gethostbyname(\"%s\") failed, error %d (%s)\n",
                 hostname, oserr, slapd_system_strerror( oserr ));
         return NULL;
     }
     if (hp->h_name == NULL) {
-        LDAPDebug (LDAP_DEBUG_ANY, "gethostbyname(\"%s\")->h_name == NULL\n", hostname, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "gethostbyname(\"%s\")->h_name == NULL\n", hostname, 0, 0);
         return NULL;
     }
     if (strchr (hp->h_name, '.') != NULL) {
-        LDAPDebug (LDAP_DEBUG_CONFIG, "h_name == %s\n", hp->h_name, 0, 0);
+        LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "h_name == %s\n", hp->h_name, 0, 0);
         return slapi_ch_strdup (hp->h_name);
     } else if (hp->h_aliases != NULL) {
         for (alias = hp->h_aliases; *alias != NULL; ++alias) {
             if (strchr  (*alias, '.') != NULL &&
                 strncmp (*alias, hp->h_name, strlen (hp->h_name))) {
-                LDAPDebug (LDAP_DEBUG_CONFIG, "h_alias == %s\n", *alias, 0, 0);
+                LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "h_alias == %s\n", *alias, 0, 0);
                 return slapi_ch_strdup (*alias);
             }
         }
@@ -100,7 +100,7 @@ find_localhost_DNS(void)
     if (f != NULL) {
         while (fgets (line, sizeof(line), f)) {
             if (strncasecmp (line, "domain", 6) == 0 && isspace (line[6])) {
-                LDAPDebug (LDAP_DEBUG_CONFIG, "%s: %s\n", _PATH_RESCONF, line, 0);
+                LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "%s: %s\n", _PATH_RESCONF, line, 0);
                 for (cp = &line[7]; *cp && isspace(*cp); ++cp);
                 if (*cp) {
                     domain = cp;
@@ -138,7 +138,7 @@ find_localhost_DNS(void)
         PL_strcatn (hostname, sizeof(hostname), ".");
         PL_strcatn (hostname, sizeof(hostname), domain);
     }
-    LDAPDebug (LDAP_DEBUG_CONFIG, "hostname == %s\n", hostname, 0, 0);
+    LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "hostname == %s\n", hostname, 0, 0);
     return slapi_ch_strdup (hostname);
 }
 
@@ -192,7 +192,7 @@ set_localhost_DN(void)
 
     if (localhost_DNS != NULL) {
         localhost_DN = convert_DNS_to_DN (localhost_DNS);
-        LDAPDebug (LDAP_DEBUG_CONFIG, "DNS %s -> DN %s\n", localhost_DNS, localhost_DN, 0);
+        LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "DNS %s -> DN %s\n", localhost_DNS, localhost_DN, 0);
     }
     slapi_ch_free_string(&localhost_DNS);
 }
@@ -224,7 +224,7 @@ get_config_DN()
 		if ( host )
 			c = slapi_ch_malloc (20 + strlen (host));
 		else {
-			LDAPDebug (LDAP_DEBUG_CONFIG, "get_locahost_DN() returned \"\"\n",
+			LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "get_locahost_DN() returned \"\"\n",
 						 0, 0, 0);
 			c = slapi_ch_malloc (20);
 		}
diff --git a/ldap/servers/slapd/lock.c b/ldap/servers/slapd/lock.c
index 0cc4694..b74c420 100644
--- a/ldap/servers/slapd/lock.c
+++ b/ldap/servers/slapd/lock.c
@@ -33,7 +33,7 @@ lock_fopen( char *fname, char *type, FILE **lfp )
 	/* open the lock file */
 	PR_snprintf( buf, MAXPATHLEN, "%s%s", fname, ".lock" );
 	if ( (*lfp = fopen( buf, "w" )) == NULL ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "could not open \"%s\"\n", buf, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "could not open \"%s\"\n", buf, 0, 0 );
 		return( NULL );
 	}
 
@@ -48,7 +48,7 @@ lock_fopen( char *fname, char *type, FILE **lfp )
 
 	/* open the log file */
 	if ( (fp = fopen( fname, type )) == NULL ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "could not open \"%s\"\n", fname, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "could not open \"%s\"\n", fname, 0, 0 );
 #ifdef USE_LOCKF
 		lockf( fileno( *lfp ), F_ULOCK, 0 );
 #else
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
index e5c6e11..18884b6 100644
--- a/ldap/servers/slapd/log.c
+++ b/ldap/servers/slapd/log.c
@@ -474,7 +474,7 @@ log_update_accesslogdir(char *pathname, int apply)
 
 	/* try to open the file, we may have a incorrect path */
 	if (! LOG_OPEN_APPEND(fp, pathname, loginfo.log_access_mode)) {
-		LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't open file %s. "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: can't open file %s. "
 				"errno %d (%s)\n",
 				pathname, errno, slapd_system_strerror(errno));
 		/* stay with the current log file */
@@ -495,7 +495,7 @@ log_update_accesslogdir(char *pathname, int apply)
 	if (loginfo.log_access_fdes) {
 		LogFileInfo	*logp, *d_logp;
 
-		LDAPDebug(LDAP_DEBUG_TRACE,
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		   	"LOGINFO:Closing the access log file. "
 			"Moving to a new access log file (%s)\n", pathname,0,0);
 
@@ -629,7 +629,7 @@ log_update_auditlogdir(char *pathname, int apply)
 
 	/* try to open the file, we may have a incorrect path */
 	if (! LOG_OPEN_APPEND(fp, pathname, loginfo.log_audit_mode)) {
-		LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't open file %s. "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: can't open file %s. "
 				"errno %d (%s)\n",
 				pathname, errno, slapd_system_strerror(errno));
 		/* stay with the current log file */
@@ -649,7 +649,7 @@ log_update_auditlogdir(char *pathname, int apply)
 	LOG_AUDIT_LOCK_WRITE ();
 	if (loginfo.log_audit_fdes) {
 		LogFileInfo	*logp, *d_logp;
-		LDAPDebug(LDAP_DEBUG_TRACE,
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		   	"LOGINFO:Closing the audit log file. "
 			"Moving to a new audit file (%s)\n", pathname,0,0);
 
@@ -707,7 +707,7 @@ log_update_auditfaillogdir(char *pathname, int apply)
 
     /* try to open the file, we may have a incorrect path */
     if (! LOG_OPEN_APPEND(fp, pathname, loginfo.log_auditfail_mode)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't open file %s. "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: can't open file %s. "
                 "errno %d (%s)\n",
                 pathname, errno, slapd_system_strerror(errno));
         /* stay with the current log file */
@@ -727,7 +727,7 @@ log_update_auditfaillogdir(char *pathname, int apply)
     LOG_AUDITFAIL_LOCK_WRITE ();
     if (loginfo.log_auditfail_fdes) {
         LogFileInfo *logp, *d_logp;
-        LDAPDebug(LDAP_DEBUG_TRACE,
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
             "LOGINFO:Closing the auditfail log file. "
             "Moving to a new auditfail file (%s)\n", pathname,0,0);
 
@@ -880,7 +880,7 @@ log_set_numlogsperdir(const char *attrname, char *numlogs_str, int logtype, char
 	  break;
 	default:
 	  rv = LDAP_OPERATIONS_ERROR;
-	  LDAPDebug( LDAP_DEBUG_ANY, 
+	  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 				 "log_set_numlogsperdir: invalid log type %d", logtype,0,0 );
 	}
   }
@@ -976,7 +976,7 @@ log_set_logsize(const char *attrname, char *logsize_str, int logtype, char *retu
 	}
 	/* logsize is in MB */
 	if (rv == 2) {
-		LDAPDebug (LDAP_DEBUG_ANY, 
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 			   "Invalid value for Maximum log size:"
 			   "Maxlogsize:%d (MB) exceeds Maxdisksize:%d (MB)\n", 
 			    logsize, mdiskspace/LOG_MB_IN_BYTES,0);
@@ -2013,7 +2013,7 @@ slapd_log_audit_internal (
         if (log__needrotation(loginfo.log_audit_fdes,
                     SLAPD_AUDIT_LOG) == LOG_ROTATE) {
             if (log__open_auditlogfile(LOGFILE_NEW, 1) != LOG_SUCCESS) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "LOGINFO: Unable to open audit file:%s\n",
                     loginfo.log_audit_file,0,0);
                 LOG_AUDIT_UNLOCK_WRITE();
@@ -2072,7 +2072,7 @@ slapd_log_auditfail_internal (
         if (log__needrotation(loginfo.log_auditfail_fdes,
                     SLAPD_AUDITFAIL_LOG) == LOG_ROTATE) {
             if (log__open_auditfaillogfile(LOGFILE_NEW, 1) != LOG_SUCCESS) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "LOGINFO: Unable to open auditfail file:%s\n",
                           loginfo.log_auditfail_file,0,0);
                 LOG_AUDITFAIL_UNLOCK_WRITE();
@@ -2650,7 +2650,7 @@ log__open_accesslogfile(int logfile_state, int locked)
 		int oserr = errno;
 		loginfo.log_access_fdes = NULL;
 		if (!locked)  LOG_ACCESS_UNLOCK_WRITE();
-		LDAPDebug(LDAP_DEBUG_ANY, "access file open %s failed errno %d (%s)\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "access file open %s failed errno %d (%s)\n",
 				  loginfo.log_access_file, oserr, slapd_system_strerror(oserr));
 		return LOG_UNABLE_TO_OPENFILE;
 	}
@@ -2667,7 +2667,7 @@ log__open_accesslogfile(int logfile_state, int locked)
 	if (! LOG_OPEN_WRITE(fpinfo, loginfo.log_accessinfo_file, loginfo.log_access_mode)) {
 		int oserr = errno;
 		if (!locked) LOG_ACCESS_UNLOCK_WRITE();
-		LDAPDebug( LDAP_DEBUG_ANY, "accessinfo file open %s failed errno %d (%s)\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "accessinfo file open %s failed errno %d (%s)\n",
 					    loginfo.log_accessinfo_file,
 				            oserr, slapd_system_strerror(oserr));
 		return LOG_UNABLE_TO_OPENFILE;
@@ -2820,12 +2820,12 @@ log_rotate:
 	if (logtype!=SLAPD_ERROR_LOG)
 	{
 		if (type == LOG_SIZE_EXCEEDED) {
-			LDAPDebug (LDAP_DEBUG_TRACE,
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 				   "LOGINFO:End of Log because size exceeded(Max:%" 
 				   NSPRI64 "d bytes) (Is:%" NSPRI64 "d bytes)\n",
 				   maxlogsize, f_size, 0);
 		} else  if ( type == LOG_EXPIRED) {
-			LDAPDebug(LDAP_DEBUG_TRACE,
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 				   "LOGINFO:End of Log because time exceeded(Max:%d secs) (Is:%ld secs)\n",
 					rotationtime_secs, curr_time - log_createtime,0);
 		}
@@ -3024,7 +3024,7 @@ log__delete_rotated_logs()
 		log_convert_time (logp->l_ctime, tbuf, 1);
 		PR_snprintf (buffer, sizeof(buffer), "%s.%s", loginfo.log_access_file, tbuf);
 
-		LDAPDebug(LDAP_DEBUG_ANY,"Deleted Rotated Log: %s\n",buffer,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Deleted Rotated Log: %s\n",buffer,0,0);
 
 		if (PR_Delete(buffer) != PR_SUCCESS) {
 			logp = logp->l_next;
@@ -3737,7 +3737,7 @@ delete_logfile:
 	if (!locked) {
 		/* if locked, we should not call LDAPDebug, 
 		   which tries to get a lock internally. */
-		LDAPDebug(LDAP_DEBUG_TRACE, 
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 			   "LOGINFO:Removing file:%s.%s because of (%s)\n",
 					loginfo.log_error_file, tbuf,
 					logstr);
@@ -4633,7 +4633,7 @@ log__open_auditlogfile(int logfile_state, int locked)
 
 	/* open a new log file */
 	if (! LOG_OPEN_APPEND(fp, loginfo.log_audit_file, loginfo.log_audit_mode)) {
-		LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't open file %s. "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: can't open file %s. "
 				"errno %d (%s)\n",
 				loginfo.log_audit_file, errno, slapd_system_strerror(errno));
 		if (!locked) LOG_AUDIT_UNLOCK_WRITE();
@@ -4654,7 +4654,7 @@ log__open_auditlogfile(int logfile_state, int locked)
 	loginfo.log_audit_state |= LOGGING_NEED_TITLE;
 
 	if (! LOG_OPEN_WRITE(fpinfo, loginfo.log_auditinfo_file, loginfo.log_audit_mode)) {
-		LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't open file %s. "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: can't open file %s. "
 				"errno %d (%s)\n",
 				loginfo.log_auditinfo_file, errno, slapd_system_strerror(errno));
 		if (!locked) LOG_AUDIT_UNLOCK_WRITE();
@@ -4759,7 +4759,7 @@ log__open_auditfaillogfile(int logfile_state, int locked)
 
     /* open a new log file */
     if (! LOG_OPEN_APPEND(fp, loginfo.log_auditfail_file, loginfo.log_auditfail_mode)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't open file %s. "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: can't open file %s. "
                   "errno %d (%s)\n",
                   loginfo.log_auditfail_file, errno, slapd_system_strerror(errno));
         if (!locked) LOG_AUDITFAIL_UNLOCK_WRITE();
@@ -4780,7 +4780,7 @@ log__open_auditfaillogfile(int logfile_state, int locked)
     loginfo.log_auditfail_state |= LOGGING_NEED_TITLE;
 
     if (! LOG_OPEN_WRITE(fpinfo, loginfo.log_auditfailinfo_file, loginfo.log_auditfail_mode)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't open file %s. "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: can't open file %s. "
                   "errno %d (%s)\n",
                   loginfo.log_auditfailinfo_file, errno, slapd_system_strerror(errno));
         if (!locked) LOG_AUDITFAIL_UNLOCK_WRITE();
@@ -4927,7 +4927,7 @@ static void log_flush_buffer(LogBufferInfo *lbi, int type, int sync_now)
         if (log__needrotation(loginfo.log_access_fdes,
 				SLAPD_ACCESS_LOG) == LOG_ROTATE) {
     		if (log__open_accesslogfile(LOGFILE_NEW, 1) != LOG_SUCCESS) {
-    			LDAPDebug(LDAP_DEBUG_ANY,
+    			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
     				"LOGINFO: Unable to open access file:%s\n",
     				loginfo.log_access_file,0,0);
 			lbi->current = lbi->top; /* reset counter to prevent overwriting rest of lbi struct */
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
index e9e5ab9..4b77fbb 100644
--- a/ldap/servers/slapd/main.c
+++ b/ldap/servers/slapd/main.c
@@ -94,10 +94,10 @@ static int init_cmd_shutdown_detect(void)
     int rc;
     sigset_t proc_mask;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "Reseting signal mask....\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Reseting signal mask....\n", 0, 0, 0);
     (void)sigemptyset( &proc_mask );
     rc = pthread_sigmask( SIG_SETMASK, &proc_mask, NULL );
-    LDAPDebug( LDAP_DEBUG_TRACE, " %s \n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, " %s \n",
                rc ? "Failed to reset signal mask":"....Done (signal mask reset)!!", 0, 0 );
   }
 
@@ -182,14 +182,14 @@ chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn, PRBool both)
   {
     if((ptr=strrchr(log,'/'))==NULL)
     {
-      LDAPDebug(LDAP_DEBUG_ANY, "Caution changing ownership of ./%s \n",name,0,0);
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Caution changing ownership of ./%s \n",name,0,0);
       if(slapd_chown_if_not_owner(log, pw->pw_uid, -1 )){
-          LDAPDebug(LDAP_DEBUG_ANY, "chown_dir_files: file (%s) chown failed (%d) %s.\n",
+          LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "chown_dir_files: file (%s) chown failed (%d) %s.\n",
                   log, errno, slapd_system_strerror(errno));
       }
       rc=1;
     } else if(log==ptr) {
-      LDAPDebug(LDAP_DEBUG_ANY, "Caution changing ownership of / directory and its contents to %s\n",pw->pw_name,0,0);
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Caution changing ownership of / directory and its contents to %s\n",pw->pw_name,0,0);
       *(++ptr)='\0';
     } else {
       *ptr='\0';
@@ -207,7 +207,7 @@ chown_dir_files(char *name, struct passwd *pw, PRBool strip_fn, PRBool both)
         gid = -1;
       }
       if(slapd_chown_if_not_owner( file, pw->pw_uid, gid )){
-        LDAPDebug(LDAP_DEBUG_ANY, "chown_dir_files: file (%s) chown failed (%d) %s.\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "chown_dir_files: file (%s) chown failed (%d) %s.\n",
                   file, errno, slapd_system_strerror(errno));
       }
     }
@@ -228,7 +228,7 @@ fix_ownership(void)
 	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
 	if (slapdFrontendConfig->localuser == NULL) {
-		LDAPDebug(LDAP_DEBUG_ANY, 
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 			"Local user missing from frontend configuration\n",
 			0, 0, 0);
 		return; 
@@ -237,7 +237,7 @@ fix_ownership(void)
 	if (slapdFrontendConfig->localuserinfo == NULL) {
 		pw = getpwnam( slapdFrontendConfig->localuser );
 		if ( NULL == pw ) {
-			LDAPDebug(LDAP_DEBUG_ANY, 
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 				"Unable to find user %s in system account database, "
 				"errno %d (%s)\n",
 				slapdFrontendConfig->localuser, errno, strerror(errno));
@@ -283,20 +283,20 @@ static int main_setuid(char *username)
 	    if (pw == NULL) {
 		int oserr = errno;
 
-		LDAPDebug (LDAP_DEBUG_ANY, "getpwnam(%s) == NULL, error %d (%s)\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "getpwnam(%s) == NULL, error %d (%s)\n",
 			   username, oserr, slapd_system_strerror(oserr));
 	    } else {
 		if (setgid (pw->pw_gid) != 0) {
 		    int oserr = errno;
 
-		    LDAPDebug (LDAP_DEBUG_ANY, "setgid(%li) != 0, error %d (%s)\n",
+		    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "setgid(%li) != 0, error %d (%s)\n",
 			       (long)pw->pw_gid, oserr, slapd_system_strerror(oserr));
 			return -1;
 		}
 		if (setuid (pw->pw_uid) != 0) {
 		    int oserr = errno;
 
-		    LDAPDebug (LDAP_DEBUG_ANY, "setuid(%li) != 0, error %d (%s)\n",
+		    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "setuid(%li) != 0, error %d (%s)\n",
 			       (long)pw->pw_uid, oserr, slapd_system_strerror(oserr));
 			return -1;
 		}
@@ -757,7 +757,7 @@ main( int argc, char **argv)
 		/* do it before splitting off to other modes too -robey */
 		/* -richm: must be done before reading config files */
 		if (0 != (return_value = compute_init())) {
-			LDAPDebug(LDAP_DEBUG_ANY, "Initialization Failed 0 %d\n",return_value,0,0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Initialization Failed 0 %d\n",return_value,0,0);
 			exit (1);
 		}
 		entry_computed_attr_init();
@@ -777,7 +777,7 @@ main( int argc, char **argv)
 
 #ifdef PUMPKIN_HOUR
 	if ( time( NULL ) > (PUMPKIN_HOUR - 10) ) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		"ERROR: ** This beta software has expired **\n", 0, 0, 0 );
 		exit( 1 );
 	}
@@ -842,7 +842,7 @@ main( int argc, char **argv)
 
 		return_value = daemon_pre_setuid_init(&ports_info);
 		if (0 != return_value) {
-			LDAPDebug( LDAP_DEBUG_ANY, "Failed to init daemon\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to init daemon\n",
 				   0, 0, 0 );
 			exit(1);
 		}
@@ -851,7 +851,7 @@ main( int argc, char **argv)
 	/* Now, sockets are open, so we can safely change identity now */
 	return_value = main_setuid(slapdFrontendConfig->localuser);
 	if (0 != return_value) {
-		LDAPDebug( LDAP_DEBUG_ANY, "Failed to change user and group identity to that of %s\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to change user and group identity to that of %s\n",
 				   slapdFrontendConfig->localuser, 0, 0 );
 		exit(1);
 	}
@@ -899,7 +899,7 @@ main( int argc, char **argv)
 	case SLAPD_EXEMODE_REFERRAL:
 		/* check that all the necessary info was given, then go on */
 		if (! config_check_referral_mode()) {
-			LDAPDebug(LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				  "ERROR: No referral URL supplied\n", 0, 0, 0);
 			usage( myname, extraname );
 			exit(1);
@@ -937,12 +937,12 @@ main( int argc, char **argv)
 
 		/* Ensure that we can read from and write to our rundir */
 		if (access(rundir, R_OK | W_OK)) {
-			LDAPDebug(LDAP_DEBUG_ANY, "Unable to access " CONFIG_RUNDIR_ATTRIBUTE ": %s\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Unable to access " CONFIG_RUNDIR_ATTRIBUTE ": %s\n",
 				slapd_system_strerror(errno), 0, 0);
-			LDAPDebug(LDAP_DEBUG_ANY, "Ensure that user \"%s\" has read and write "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Ensure that user \"%s\" has read and write "
 				"permissions on %s\n",
 				slapdFrontendConfig->localuser, rundir, 0);
-			LDAPDebug(LDAP_DEBUG_ANY, "Shutting down.\n", 0, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Shutting down.\n", 0, 0, 0);
 			slapi_ch_free_string(&rundir);
 			return_value = 1;
 			goto cleanup;
@@ -988,7 +988,7 @@ main( int argc, char **argv)
 	if ((slapd_exemode != SLAPD_EXEMODE_REFERRAL) &&
 		( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
 					skip_db_protect_check) == -1 ))  {
- 		LDAPDebug( LDAP_DEBUG_ANY, 
+ 		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 				"Shutting down due to possible conflicts with other slapd processes\n",
 				0, 0, 0 );
 		return_value = 1;
@@ -1004,7 +1004,7 @@ main( int argc, char **argv)
 	if (1) {
 	  char *versionstring = config_get_versionstring();
 	  char *buildnum = config_get_buildnum();
-	  LDAPDebug( LDAP_DEBUG_ANY, "%s B%s starting up\n",
+	  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "%s B%s starting up\n",
 			 versionstring, buildnum, 0 );
 	  slapi_ch_free((void **)&buildnum);
 	  slapi_ch_free((void **)&versionstring);
@@ -1032,7 +1032,7 @@ main( int argc, char **argv)
 
 		if (mapping_tree_init())
 		{
-			LDAPDebug( LDAP_DEBUG_ANY, "Failed to init mapping tree\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to init mapping tree\n",
 				0, 0, 0 );
 			return_value = 1;
 			goto cleanup;
@@ -1047,7 +1047,7 @@ main( int argc, char **argv)
 		slapi_sdn_free (&sdn);
 		if (rc != UID_SUCCESS)
 		{
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"Fatal Error---Failed to initialize uniqueid generator; error = %d. "
 				"Exiting now.\n", rc, 0, 0 );
 			return_value = 1;
@@ -1057,11 +1057,11 @@ main( int argc, char **argv)
 		/* --ugaston: register the start-tls plugin */
 		if ( slapd_security_library_is_initialized() != 0 ) {
 			start_tls_register_plugin();
-			LDAPDebug( LDAP_DEBUG_PLUGIN, "Start TLS plugin registered.\n",
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Start TLS plugin registered.\n",
 				0, 0, 0 );
 		} 
 		passwd_modify_register_plugin();
-		LDAPDebug( LDAP_DEBUG_PLUGIN, 
+		LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, 
 					"Password Modify plugin registered.\n", 0, 0, 0 );
 
 		/* Cleanup old tasks that may still be in the DSE from a previous 
@@ -1107,7 +1107,7 @@ main( int argc, char **argv)
 		} else if (i_port) {
 		} else if ( config_get_security()) {
 		} else {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                                 "Fatal Error---No ports specified. "
                                 "Exiting now.\n", 0, 0, 0 );
 			
@@ -1125,7 +1125,7 @@ main( int argc, char **argv)
 		pw_init();
 		/* Initialize the sasl mapping code */
 		if (sasl_map_init()) {
-			LDAPDebug( LDAP_DEBUG_ANY, "Failed to initialize sasl mapping code\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to initialize sasl mapping code\n", 0, 0, 0 );
 		}
 	}
 
@@ -1148,7 +1148,7 @@ main( int argc, char **argv)
 		time( &starttime );
 		slapd_daemon(&ports_info);
 	}
- 	LDAPDebug( LDAP_DEBUG_ANY, "slapd stopped.\n", 0, 0, 0 );
+ 	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapd stopped.\n", 0, 0, 0 );
 	reslimit_cleanup();
 	compute_terminate();
 	vattr_cleanup();
@@ -2012,7 +2012,7 @@ slapd_exemode_ldif2db(void)
     slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
     if ( ldif_file == NULL ) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "ERROR: Required argument -i <ldiffile> missing\n",
                    0, 0, 0 );
         usage( myname, extraname );
@@ -2034,7 +2034,7 @@ slapd_exemode_ldif2db(void)
 
 		if (lookup_instance_name_by_suffixes(db2ldif_include, db2ldif_exclude,
 													&instances) < 0) {
-			LDAPDebug(LDAP_DEBUG_ANY, 
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 				"ERROR: backend instances name [-n <name>] or "
 				"included suffix [-s <suffix>] need to be specified.\n",
 				0, 0, 0);
@@ -2046,26 +2046,26 @@ slapd_exemode_ldif2db(void)
 				;
 
 			if (counter == 0) {
-				LDAPDebug(LDAP_DEBUG_ANY, 
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 					"ERROR 1: There is no backend instance to import to.\n",
 					0, 0, 0);
 				return 1;
 			} else if (counter > 1) {
 				int i;
-				LDAPDebug(LDAP_DEBUG_ANY, 
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 					"ERROR: There are multiple backend instances specified:\n",
 					0, 0, 0);
 				for (i = 0; i < counter; i++)
-					LDAPDebug(LDAP_DEBUG_ANY, "     : %s\n",
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "     : %s\n",
 											  instances[i], 0, 0);
         		return 1;
 			} else {
-				LDAPDebug(LDAP_DEBUG_ANY, "Backend Instance: %s\n",
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Backend Instance: %s\n",
 					*instances, 0, 0);
 				cmd_line_instance_name = *instances;
 			}
 		} else {
-			LDAPDebug(LDAP_DEBUG_ANY, 
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 				"ERROR 2: There is no backend instance to import to.\n",
 				0, 0, 0);
 			return 1;
@@ -2074,7 +2074,7 @@ slapd_exemode_ldif2db(void)
 
     plugin = lookup_plugin_by_instance_name(cmd_line_instance_name);
     if (plugin == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                   "ERROR: Could not find backend '%s'.\n",
                   cmd_line_instance_name, 0, 0);
         return 1;
@@ -2087,14 +2087,14 @@ slapd_exemode_ldif2db(void)
     if ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
                                skip_db_protect_check) == -1 )  {
 
-        LDAPDebug( LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                    "Shutting down due to possible conflicts with other slapd processes\n",
                    0, 0, 0 );
         return 1;
     }
     /* check for slapi v2 support */
     if (! SLAPI_PLUGIN_IS_V2(plugin)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ERROR: %s is too old to reindex all.\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: %s is too old to reindex all.\n",
                   plugin->plg_name, 0, 0);
         return 1;
     }
@@ -2121,7 +2121,7 @@ slapd_exemode_ldif2db(void)
     if ( plugin->plg_ldif2db != NULL ) {
         return_value = (*plugin->plg_ldif2db)( &pb );
     } else {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "ERROR: no ldif2db function defined for "
                    "%s\n", plugin->plg_name, 0, 0 );
         return_value = -1;
@@ -2157,7 +2157,7 @@ slapd_exemode_db2ldif(int argc, char** argv)
 
 		if (lookup_instance_name_by_suffixes(db2ldif_include, db2ldif_exclude,
 													&instances) < 0) {
-			LDAPDebug(LDAP_DEBUG_ANY, 
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 				"ERROR: backend instances name [-n <name>] or "
 				"included suffix [-s <suffix>] need to be specified.\n",
 				0, 0, 0);
@@ -2169,19 +2169,19 @@ slapd_exemode_db2ldif(int argc, char** argv)
 				;
 
 			if (counter == 0) {
-				LDAPDebug(LDAP_DEBUG_ANY, 
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 					"ERROR 1: There is no backend instance to export from.\n",
 					0, 0, 0);
 				return 1;
 			} else {
-				LDAPDebug(LDAP_DEBUG_ANY, "Backend Instance(s): \n", 0, 0, 0);
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Backend Instance(s): \n", 0, 0, 0);
 				for (ip = instances, counter = 0; ip && *ip; ip++, counter++) {
-					LDAPDebug(LDAP_DEBUG_ANY, "\t%s\n", *ip, 0, 0);
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "\t%s\n", *ip, 0, 0);
 				}
 				cmd_line_instance_names = instances;
 			}
 		} else {
-			LDAPDebug(LDAP_DEBUG_ANY, 
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 				"ERROR 2: There is no backend instance to export from.\n",
 				0, 0, 0);
 			return 1;
@@ -2196,14 +2196,14 @@ slapd_exemode_db2ldif(int argc, char** argv)
 
 	    plugin = lookup_plugin_by_instance_name(*instp);
 	    if (plugin == NULL) {
-	        LDAPDebug(LDAP_DEBUG_ANY, 
+	        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 	                  "ERROR: Could not find backend '%s'.\n", 
 	                  *instp, 0, 0);
 	        return 1;
 	    }
 	
 		if (plugin->plg_db2ldif == NULL) {
-			LDAPDebug(LDAP_DEBUG_ANY, "ERROR: no db2ldif function defined for "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: no db2ldif function defined for "
 					  "backend %s - cannot export\n", *instp, 0, 0);
 			return 1;
 		}
@@ -2214,7 +2214,7 @@ slapd_exemode_db2ldif(int argc, char** argv)
 	     */
 	    if ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
 								   skip_db_protect_check) == -1 )  {
-	        LDAPDebug( LDAP_DEBUG_ANY, 
+	        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 	                   "Shutting down due to possible conflicts "
 					   "with other slapd processes\n",
 	                   0, 0, 0 );
@@ -2222,7 +2222,7 @@ slapd_exemode_db2ldif(int argc, char** argv)
 	    }
 	
 	    if (! (SLAPI_PLUGIN_IS_V2(plugin))) {
-	        LDAPDebug(LDAP_DEBUG_ANY, "ERROR: %s is too old to do exports.\n",
+	        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: %s is too old to do exports.\n",
 	                  plugin->plg_name, 0, 0);
 	        return 1;
 	    }
@@ -2374,7 +2374,7 @@ static int slapd_exemode_db2index(void)
 
         if (lookup_instance_name_by_suffixes(db2ldif_include, db2ldif_exclude,
                                              &instances) < 0) {
-            LDAPDebug(LDAP_DEBUG_ANY, 
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                       "ERROR: backend instances name [-n <name>] or "
                       "included suffix [-s <suffix>] need to be specified.\n",
                       0, 0, 0);
@@ -2386,26 +2386,26 @@ static int slapd_exemode_db2index(void)
                 ;
 
             if (counter == 0) {
-                LDAPDebug(LDAP_DEBUG_ANY, 
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                           "ERROR 1: There is no backend instance to import to.\n",
                           0, 0, 0);
                 return 1;
             } else if (counter > 1) {
                 int i;
-                LDAPDebug(LDAP_DEBUG_ANY, 
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                           "ERROR: There are multiple backend instances specified:\n",
                           0, 0, 0);
                 for (i = 0; i < counter; i++)
-                    LDAPDebug(LDAP_DEBUG_ANY, "     : %s\n",
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "     : %s\n",
                               instances[i], 0, 0);
                 return 1;
             } else {
-                LDAPDebug(LDAP_DEBUG_ANY, "Backend Instance: %s\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Backend Instance: %s\n",
                           *instances, 0, 0);
                 cmd_line_instance_name = *instances;
             }
         } else {
-            LDAPDebug(LDAP_DEBUG_ANY, 
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                       "ERROR 2: There is no backend instance to import to.\n",
                       0, 0, 0);
             return 1;
@@ -2414,7 +2414,7 @@ static int slapd_exemode_db2index(void)
 
     plugin = lookup_plugin_by_instance_name(cmd_line_instance_name);
     if (plugin == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                   "ERROR: Could not find backend '%s'.\n",
                   cmd_line_instance_name, 0, 0);
         return 1;
@@ -2423,7 +2423,7 @@ static int slapd_exemode_db2index(void)
     /* make sure nothing else is running */
     if (add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
                               skip_db_protect_check) == -1) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Shutting down due to possible conflicts with other "
                   "slapd processes.\n", 0, 0, 0);
         return 1;
@@ -2456,13 +2456,13 @@ slapd_exemode_db2archive(void)
 	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 	
 	if ((backend_plugin = plugin_get_by_name("ldbm database")) == NULL) {
-		LDAPDebug(LDAP_DEBUG_ANY, 
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 			"ERROR: Could not find the ldbm backend plugin.\n",
 			0, 0, 0);
 		return 1;
 	}
 	if (NULL == archive_name) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "ERROR: no archive directory supplied\n",
 		    0, 0, 0 );
 		return 1;
@@ -2474,13 +2474,13 @@ slapd_exemode_db2archive(void)
 	 */
 	if ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
 	                           skip_db_protect_check) == -1 )  {
-	    LDAPDebug( LDAP_DEBUG_ANY, 
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 		       "Shutting down due to possible conflicts with other slapd processes\n",
 		       0, 0, 0 );
 	    return 1;
 	}
 	if (compute_init()) {
-		LDAPDebug(LDAP_DEBUG_ANY, "Initialization Failed 0 %d\n",return_value,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Initialization Failed 0 %d\n",return_value,0,0);
 		return 1;
 	}
 	if (!is_quiet) {
@@ -2510,13 +2510,13 @@ slapd_exemode_archive2db(void)
 	slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 	
 	if ((backend_plugin = plugin_get_by_name("ldbm database")) == NULL) {
-		LDAPDebug(LDAP_DEBUG_ANY, 
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 			"ERROR: Could not find the ldbm backend plugin.\n",
 			0, 0, 0);
 		return 1;
 	}
 	if (NULL == archive_name) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "ERROR: no archive directory supplied\n",
 		    0, 0, 0 );
 		return 1;
@@ -2528,13 +2528,13 @@ slapd_exemode_archive2db(void)
 	 */
 	if ( add_new_slapd_process(slapd_exemode, db2ldif_dump_replica,
 	                           skip_db_protect_check) == -1 )  {
-	    LDAPDebug( LDAP_DEBUG_ANY, 
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 		       "Shutting down due to possible conflicts with other slapd processes\n",
 		       0, 0, 0 );
 	    return 1;
 	}
 	if (compute_init()) {
-		LDAPDebug(LDAP_DEBUG_ANY, "Initialization Failed 0 %d\n",return_value,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Initialization Failed 0 %d\n",return_value,0,0);
 		return 1;
 	}
 
@@ -2569,7 +2569,7 @@ slapd_exemode_upgradedb(void)
     slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
     if ( archive_name == NULL ) {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "ERROR: Required argument -a <backup_dir> missing\n",
                    0, 0, 0 );
         usage( myname, extraname );
@@ -2582,7 +2582,7 @@ slapd_exemode_upgradedb(void)
     mapping_tree_init();
 
     if ((backend_plugin = plugin_get_by_name("ldbm database")) == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
             "ERROR: Could not find the ldbm backend plugin.\n",
             0, 0, 0);
         return 1;
@@ -2593,14 +2593,14 @@ slapd_exemode_upgradedb(void)
      * slapd processes that are currently running
      */
     if (add_new_slapd_process(slapd_exemode, 0, skip_db_protect_check) == -1) {
-        LDAPDebug( LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
                    "Shutting down due to possible conflicts with other slapd processes\n",
                    0, 0, 0 );
         return 1;
     }
     /* check for slapi v2 support */
     if (! SLAPI_PLUGIN_IS_V2(backend_plugin)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ERROR: %s is too old to do convert idl.\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: %s is too old to do convert idl.\n",
                   backend_plugin->plg_name, 0, 0);
         return 1;
     }
@@ -2620,7 +2620,7 @@ slapd_exemode_upgradedb(void)
     if ( backend_plugin->plg_upgradedb != NULL ) {
         return_value = (*backend_plugin->plg_upgradedb)( &pb );
     } else {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "ERROR: no upgradedb function defined for "
                    "%s\n", backend_plugin->plg_name, 0, 0 );
         return_value = -1;
@@ -2695,7 +2695,7 @@ slapd_exemode_upgradednformat(void)
     if ( backend_plugin->plg_upgradednformat != NULL ) {
         rc  = (*backend_plugin->plg_upgradednformat)( &pb );
     } else {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "ERROR: no upgradednformat function defined for "
                    "%s\n", backend_plugin->plg_name, 0, 0 );
     }
@@ -2719,7 +2719,7 @@ slapd_exemode_dbverify(void)
      */
     mapping_tree_init();
     if ((backend_plugin = plugin_get_by_name("ldbm database")) == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
             "ERROR: Could not find the ldbm backend plugin.\n",
             0, 0, 0);
         return 1;
@@ -2727,7 +2727,7 @@ slapd_exemode_dbverify(void)
 
     /* check for slapi v2 support */
     if (! SLAPI_PLUGIN_IS_V2(backend_plugin)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ERROR: %s is too old to do dbverify.\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: %s is too old to do dbverify.\n",
                   backend_plugin->plg_name, 0, 0);
         return 1;
     }
@@ -2743,7 +2743,7 @@ slapd_exemode_dbverify(void)
     if ( backend_plugin->plg_dbverify != NULL ) {
         return_value = (*backend_plugin->plg_dbverify)( &pb );
     } else {
-        LDAPDebug( LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "ERROR: no db verify function defined for "
                    "%s\n", backend_plugin->plg_name, 0, 0 );
         return_value = -1;
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index 8d98275..8dbf111 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -429,7 +429,7 @@ mtn_state_to_int(const char * state_string, Slapi_Entry *entry)
     } else if (!strcasecmp(state_string, "container")) {
         return MTN_CONTAINER;
     } else {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "Warning: Unknown state, %s, for mapping tree node %s."
                 " Defaulting to DISABLED\n",
                 state_string, slapi_entry_get_dn(entry), 0);
@@ -452,7 +452,7 @@ mtn_get_referral_from_entry(Slapi_Entry * entry)
     slapi_attr_get_numvalues(attr, &nb);
     hint = slapi_attr_first_value(attr, &val);
     if (NULL == val) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Warning: The nsslapd-referral attribute has no value for the mapping tree node %s\n", slapi_entry_get_dn(entry), 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: The nsslapd-referral attribute has no value for the mapping tree node %s\n", slapi_entry_get_dn(entry), 0, 0);
     return NULL;
     }
 
@@ -517,7 +517,7 @@ get_backends_from_attr(Slapi_Attr *attr, backend ***be_list, char ***be_names,
             tmp_backend_name);
         if (new_node && (new_node != node))
         {
-                   LDAPDebug(LDAP_DEBUG_ANY,
+                   LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                    "ERROR: backend %s is already pointed to by a mapping tree"
                 " node.  Only one mapping tree node can point to a backend\n",
                    tmp_backend_name, 0, 0);
@@ -613,7 +613,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
     subtree = get_subtree_from_entry(entry);
     /* Make sure we know the root dn of the subtree for this node. */
     if (NULL == subtree) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Warning: Unable to determine the subtree represented by the mapping tree node %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: Unable to determine the subtree represented by the mapping tree node %s\n",
             slapi_entry_get_dn(entry), 0, 0);
         return lderr;
     }
@@ -633,7 +633,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
     /* Make sure a node does not already exist for this subtree */
     if (  parent_node != NULL && NULL != mtn_get_mapping_tree_node_by_entry(mapping_tree_root,
                 subtree)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "Warning: a mapping tree node for the"
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: a mapping tree node for the"
             " subtree %s already exists; unable to add the node %s\n",
             slapi_sdn_get_dn(subtree), slapi_entry_get_dn(entry), 0);
         slapi_sdn_free(&subtree);
@@ -665,7 +665,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
 
             if (NULL == be_list)
             {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "Warning: The nsslapd-backend attribute has no value for the mapping tree node %s\n",
                     slapi_entry_get_dn(entry), 0, 0);
                 continue;
@@ -679,7 +679,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
             
             slapi_attr_first_value(attr, &val);
             if (NULL == val) {
-                LDAPDebug(LDAP_DEBUG_ANY, "Warning: Can't determine the state of the mapping tree node %s\n", 
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: Can't determine the state of the mapping tree node %s\n", 
                     slapi_entry_get_dn(entry), 0, 0);
                 continue;
             }
@@ -690,7 +690,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
         } else if (!strcasecmp(type, "nsslapd-distribution-plugin")) {
             slapi_attr_first_value(attr, &val);
             if (NULL == val) {
-                LDAPDebug(LDAP_DEBUG_ANY, "Warning: The nsslapd-distribution-plugin attribute has no value for the mapping tree node %s\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: The nsslapd-distribution-plugin attribute has no value for the mapping tree node %s\n",
                     slapi_entry_get_dn(entry), 0, 0);
                 continue;
             }
@@ -698,7 +698,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
         } else if (!strcasecmp(type, "nsslapd-distribution-funct")) {
             slapi_attr_first_value(attr, &val);
             if (NULL == val) {
-                LDAPDebug(LDAP_DEBUG_ANY, "Warning: The nsslapd-distribution-plugin attribute has no value for the mapping tree node %s\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: The nsslapd-distribution-plugin attribute has no value for the mapping tree node %s\n",
                     slapi_entry_get_dn(entry), 0, 0);
                 continue;
             }
@@ -707,7 +707,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
             const char *sval;
             slapi_attr_first_value(attr, &val);
             if (NULL == val) {
-                LDAPDebug(LDAP_DEBUG_ANY, "Warning: The nsslapd-distribution-plugin attribute has no value for the mapping tree node %s\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: The nsslapd-distribution-plugin attribute has no value for the mapping tree node %s\n",
                     slapi_entry_get_dn(entry), 0, 0);
                 continue;
             }
@@ -719,7 +719,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
 	    else if (strcmp(sval,"referral") == 0)
 		plugin_rootmode = CHAIN_ROOT_UPDATE_REFERRAL;
 	    else 
-                LDAPDebug(LDAP_DEBUG_ANY, "Warning: The nsslapd-distribution-root-update attribute has undefined value (%s) for the mapping tree node %s\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Warning: The nsslapd-distribution-root-update attribute has undefined value (%s) for the mapping tree node %s\n",
                     sval, slapi_entry_get_dn(entry), 0);
         } else if (!strcasecmp(type, MAPPING_TREE_PARENT_ATTRIBUTE)) {
             Slapi_DN *parent_node_dn = get_parent_from_entry(entry);
@@ -729,7 +729,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
             if (parent_node == NULL)
             {
                 parent_node = mapping_tree_root;
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "Warning: could not find parent for %s defaulting to root\n",
                      slapi_entry_get_dn(entry), 0, 0);
             }
@@ -745,7 +745,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
         be = defbackend_get_backend();
         if(be == NULL)
         {
-             LDAPDebug(LDAP_DEBUG_ANY,
+             LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                         "ERROR: default container has not been created for the NULL SUFFIX node.\n",
                          0, 0, 0);
              slapi_sdn_free(&subtree);
@@ -778,7 +778,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
     if (((state == MTN_BACKEND) || (state == MTN_REFERRAL_ON_UPDATE))
          && (be_names == NULL))
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
         "ERROR: node %s must define a backend\n",
         slapi_entry_get_dn(entry), 0, 0);
         slapi_sdn_free(&subtree);
@@ -788,7 +788,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
     if (((state == MTN_REFERRAL) || (state == MTN_REFERRAL_ON_UPDATE))
         && (referral == NULL))
     {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
         "ERROR: node %s must define referrals to be in referral state\n",
         slapi_entry_get_dn(entry), 0, 0);
         slapi_sdn_free(&subtree);
@@ -802,7 +802,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
                                            "Entry Distribution", 1);
         if (plugin == NULL)
         {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "ERROR: node %s cannot find distribution plugin. "
                 SLAPI_COMPONENT_NAME_NSPR " %d (%s)\n",
                 slapi_entry_get_dn(entry), PR_GetError(), slapd_pr_strerror(PR_GetError()));
@@ -821,7 +821,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
     else
     {
         /* only one parameter configured -> ERROR */
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
             "ERROR: node %s must define both lib and funct"
             " for distribution plugin\n",
             slapi_entry_get_dn(entry), 0, 0);
@@ -930,7 +930,7 @@ mapping_tree_node_get_children(mapping_tree_node *target, int is_root)
     slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &res);
 
     if (res != LDAP_SUCCESS) {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING: Mapping tree unable to read %s: %d\n", 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: Mapping tree unable to read %s: %d\n", 
             MAPPING_TREE_BASE_DN, res, 0);
         result = -1;
         goto done;
@@ -940,7 +940,7 @@ mapping_tree_node_get_children(mapping_tree_node *target, int is_root)
      * of the target's children. */
     slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
     if (NULL == entries) {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING: No mapping tree node entries found under %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: No mapping tree node entries found under %s\n",
             MAPPING_TREE_BASE_DN, 0, 0);
         result = -1;
         goto done;
@@ -950,7 +950,7 @@ mapping_tree_node_get_children(mapping_tree_node *target, int is_root)
         mapping_tree_node *child = NULL;
 
         if (LDAP_SUCCESS != mapping_tree_entry_add(entries[x], &child)) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
              "ERROR: could not add mapping tree node %s\n",
             slapi_entry_get_dn(entries[x]), 0, 0);
             result = -1;
@@ -1009,7 +1009,7 @@ mapping_tree_node_validate(mapping_tree_node *node)
 
     if (node->mtn_parent) {
         if (!slapi_sdn_issuffix(node->mtn_subtree, node->mtn_parent->mtn_subtree)) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                 "Warning: Invalid mapping tree.  %s can not be a child of %s\n",
                 slapi_sdn_get_ndn(node->mtn_subtree), 
                 slapi_sdn_get_ndn(node->mtn_parent->mtn_subtree), 0);
@@ -1099,7 +1099,7 @@ int mapping_tree_entry_modify_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefor
                 if (parent_node == NULL)
                 {
                     parent_node = mapping_tree_root;
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "Error: could not find parent for %s\n",
                           slapi_entry_get_dn(entryAfter), 0, 0);
                     slapi_sdn_free(&subtree);
@@ -1300,7 +1300,7 @@ int mapping_tree_entry_modify_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefor
                 slapi_attr_first_value(attr, &val);
                 slapi_ch_free_string(&plugin_fct);
                 if (NULL == val) {
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "Warning: The nsslapd-distribution-funct attribute"
                     " has no value for the mapping tree node %s\n",
                     slapi_entry_get_dn(entryAfter), 0, 0);
@@ -1324,7 +1324,7 @@ int mapping_tree_entry_modify_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefor
                 slapi_attr_first_value(attr, &val);
                 slapi_ch_free_string(&plugin_lib);
                 if (NULL == val) {
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                         "Warning: The nsslapd-distribution-plugin attribute"
                         " has no value for the mapping tree node %s\n",
                     slapi_entry_get_dn(entryAfter), 0, 0);
@@ -1348,7 +1348,7 @@ int mapping_tree_entry_modify_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefor
                              "nsslapd-distribution-root-update", &attr);
                 slapi_attr_first_value(attr, &val);
                 if (NULL == val) {
-                    LDAPDebug(LDAP_DEBUG_ANY,
+                    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "Warning: The nsslapd-distribution-root-update attribute"
                     " has no value for the mapping tree node %s\n",
                     slapi_entry_get_dn(entryAfter), 0, 0);
@@ -1483,7 +1483,7 @@ int mapping_tree_entry_add_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore,
                                               CONFIG_DEFAULT_NAMING_CONTEXT,
                                               escaped);
             if (rc) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "mapping_tree_entry_add_callback: "
                     "setting %s to %s failed: RC=%d\n",
                     escaped, CONFIG_DEFAULT_NAMING_CONTEXT, rc);
@@ -2572,7 +2572,7 @@ mtn_get_be_distributed(Slapi_PBlock *pb, mapping_tree_node * target_node,
         /* paranoid check, never trust another programmer */
         else if ((index >= target_node->mtn_be_count) || (index < 0))
         {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "Warning: distribution plugin returned wrong backend"
                     " : %d for entry %s at node %s\n",
                      index, slapi_sdn_get_ndn(target_sdn),
@@ -2592,7 +2592,7 @@ mtn_get_be_distributed(Slapi_PBlock *pb, mapping_tree_node * target_node,
         /* there is several backends but no distribution function
          * return the first backend 
          */
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
         "Warning: distribution plugin not configured at node : %s\n",
         slapi_sdn_get_ndn(target_node->mtn_subtree), 0, 0);
         index = 0;
@@ -2712,7 +2712,7 @@ static int mtn_get_be(mapping_tree_node *target_node, Slapi_PBlock *pb,
                                 target_node->mtn_backend_names[*index]);
                         *be = target_node->mtn_be[*index];
                         if(*be==NULL) {
-                            LDAPDebug(LDAP_DEBUG_BACKLDBM,
+                            LDAPDebug(LDAP_DEBUG_BACKLDBM, LOG_DEBUG,
                                 "Warning: Mapping tree node entry for %s "
                                 "point to an unknown backend : %s\n",
                                 slapi_sdn_get_dn(target_node->mtn_subtree),
@@ -2727,7 +2727,7 @@ static int mtn_get_be(mapping_tree_node *target_node, Slapi_PBlock *pb,
                 }
                 if ((target_node->mtn_be_states) &&
                     (target_node->mtn_be_states[*index] == SLAPI_BE_STATE_OFFLINE)) {
-                    LDAPDebug(LDAP_DEBUG_TRACE,
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                         "Warning: Operation attempted on backend in OFFLINE "
                         "state : %s\n",
                          target_node->mtn_backend_names[*index], 0, 0);
@@ -3596,7 +3596,7 @@ mtn_internal_be_set_state(Slapi_Backend *be, int state)
     node = get_mapping_tree_node_by_name(mapping_tree_root, be_name);
     if (node == NULL)
     {
-        LDAPDebug(LDAP_DEBUG_TRACE,
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
             "Warning: backend %s is not declared in mapping tree\n",
              be_name, 0 ,0);
         goto done;
@@ -3619,7 +3619,7 @@ mtn_internal_be_set_state(Slapi_Backend *be, int state)
         /* backend is not declared in the mapping tree node
          * print out a warning
          */
-        LDAPDebug(LDAP_DEBUG_TRACE,
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
             "Warning: backend %s is not declared in mapping node entry\n",
              be_name, 0 ,0);
         goto done;
@@ -3757,7 +3757,7 @@ void mtn_wlock(void)
     slapi_rwlock_wrlock(myLock);
 #ifdef DEBUG
     lock_count--;
-    LDAPDebug(LDAP_DEBUG_ARGS, "mtn_wlock : lock count : %d\n", lock_count, 0, 0);
+    LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "mtn_wlock : lock count : %d\n", lock_count, 0, 0);
 #endif
 }
 
@@ -3766,7 +3766,7 @@ void mtn_lock(void)
     slapi_rwlock_rdlock(myLock);
 #ifdef DEBUG
     lock_count++;
-    LDAPDebug(LDAP_DEBUG_ARGS, "mtn_lock : lock count : %d\n", lock_count, 0, 0);
+    LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "mtn_lock : lock count : %d\n", lock_count, 0, 0);
 #endif
 }
 
@@ -3780,7 +3780,7 @@ void mtn_unlock(void)
         lock_count++;
     else
         lock_count = (int) 11111111;   /* this happening means problems */
-    LDAPDebug(LDAP_DEBUG_ARGS, "mtn_unlock : lock count : %d\n", lock_count, 0, 0);
+    LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "mtn_unlock : lock count : %d\n", lock_count, 0, 0);
 #endif
     slapi_rwlock_unlock(myLock);
 }
@@ -3820,7 +3820,7 @@ static void dump_mapping_tree(mapping_tree_node *parent, int depth)
 
     if (depth == 0)
     {
-        LDAPDebug(LDAP_DEBUG_ANY, "dump_mapping_tree\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "dump_mapping_tree\n", 0, 0, 0);
     }
     dump_indent[0] = '\0';
     for (i = 0; i < depth; i++)
@@ -3830,12 +3830,12 @@ static void dump_mapping_tree(mapping_tree_node *parent, int depth)
     {
         if (strlen(current->mtn_subtree->dn) == 0)
         {
-            LDAPDebug(LDAP_DEBUG_ANY, "MT_DUMP: %s%s (0x%x)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "MT_DUMP: %s%s (0x%x)\n",
                 dump_indent, "none", current);
         }
         else
         {
-            LDAPDebug(LDAP_DEBUG_ANY, "MT_DUMP: %s%s (0x%x)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "MT_DUMP: %s%s (0x%x)\n",
                 dump_indent, current->mtn_subtree->dn, current);
         }
         dump_mapping_tree(current, depth+1);
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index 2be6930..60d1f65 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -114,7 +114,7 @@ do_modify( Slapi_PBlock *pb )
 	int		pw_change = 0; 	/* 0 = no password change */
 	int		err;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_modify\n", 0, 0, 0 );
 
 	slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
 	ber = operation->o_ber;
@@ -145,7 +145,7 @@ do_modify( Slapi_PBlock *pb )
 		int rc = 0;
     	if ( ber_scanf( ber, "{a", &rawdn ) == LBER_ERROR )
     	{
-    		LDAPDebug( LDAP_DEBUG_ANY,
+    		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
     		    "ber_scanf failed (op=Modify; params=DN)\n", 0, 0, 0 );
 			op_shared_log_error_access (pb, "MOD", "???", "decoding error");
     		send_ldap_result( pb, LDAP_PROTOCOL_ERROR, NULL, NULL, 0, NULL );
@@ -167,7 +167,7 @@ do_modify( Slapi_PBlock *pb )
 		}
 	}
 
-	LDAPDebug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", rawdn, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "do_modify: dn (%s)\n", rawdn, 0, 0 );
 
 	/* 
 	 * If nsslapd-minssf-exclude-rootdse is on, the minssf check has been
@@ -285,7 +285,7 @@ do_modify( Slapi_PBlock *pb )
 		   int connid, opid;
 		   slapi_pblock_get(pb, SLAPI_CONN_ID, &connid);
 		   slapi_pblock_get(pb, SLAPI_OPERATION_ID, &opid);
-		   LDAPDebug( LDAP_DEBUG_ANY,"Rejecting replicated password policy operation(conn=%d op=%d) for "
+		   LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Rejecting replicated password policy operation(conn=%d op=%d) for "
 				   "entry %s.  To allow these changes to be accepted, set passwordIsGlobalPolicy to 'on' in "
 				   "cn=config.\n", connid, opid, rawdn);
 		}
@@ -358,11 +358,11 @@ do_modify( Slapi_PBlock *pb )
 	}
 
 #ifdef LDAP_DEBUG
-	LDAPDebug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "modifications:\n", 0, 0, 0 );
 	for (mod = slapi_mods_get_first_mod(&smods); mod != NULL; 
 		 mod = slapi_mods_get_next_mod(&smods))
 	{
-		LDAPDebug( LDAP_DEBUG_ARGS, "\t%s: %s\n",
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "\t%s: %s\n",
 		mod_op_image( mod->mod_op ), mod->mod_type, 0 );
 	}
 #endif
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
index 992700a..31cb5d9 100644
--- a/ldap/servers/slapd/modrdn.c
+++ b/ldap/servers/slapd/modrdn.c
@@ -52,7 +52,7 @@ do_modrdn( Slapi_PBlock *pb )
 	Slapi_DN	snewdn;
 	Slapi_DN	*snewsuperior = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_modrdn\n", 0, 0, 0 );
 
 	/* count the modrdn request */
 	slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsModifyRDNOps);
@@ -75,7 +75,7 @@ do_modrdn( Slapi_PBlock *pb )
 	 */
 
 	if (ber_scanf(ber, "{aab", &rawdn, &newrdn, &deloldrdn) == LBER_ERROR) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "ber_scanf failed (op=ModRDN; params=DN,newRDN,deleteOldRDN)\n",
 		    0, 0, 0 );
 		op_shared_log_error_access (pb, "MODRDN", "???", "decoding error");
@@ -88,7 +88,7 @@ do_modrdn( Slapi_PBlock *pb )
 	if ( ber_peek_tag( ber, &len ) == LDAP_TAG_NEWSUPERIOR ) {
 		/* This "len" is not used... */
 		if ( pb->pb_conn->c_ldapversion < LDAP_VERSION3 ) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			    "got newSuperior in LDAPv2 modrdn op\n", 0, 0, 0 );
 			op_shared_log_error_access (pb, "MODRDN",
 										rawdn?rawdn:"", "decoding error");
@@ -99,7 +99,7 @@ do_modrdn( Slapi_PBlock *pb )
 			goto free_and_return;
 		}
 		if ( ber_scanf( ber, "a", &rawnewsuperior ) == LBER_ERROR ) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			    "ber_scanf failed (op=ModRDN; params=newSuperior)\n",
 			    0, 0, 0 );
 			op_shared_log_error_access (pb, "MODRDN", rawdn, "decoding error");
@@ -209,7 +209,7 @@ do_modrdn( Slapi_PBlock *pb )
 		goto free_and_return;
 	}
 
-	LDAPDebug( LDAP_DEBUG_ARGS,
+	LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG,
 			   "do_modrdn: dn (%s) newrdn (%s) deloldrdn (%d)\n", dn, newrdn,
 			   deloldrdn );
 
@@ -552,7 +552,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
 
 	if (newsuperior != NULL) 
 	{
-		LDAPDebug(LDAP_DEBUG_ARGS, "do_moddn: newsuperior (%s)\n", newsuperior, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "do_moddn: newsuperior (%s)\n", newsuperior, 0, 0);
 	}
 
 	/* target spec is used to decide which plugins are applicable for the operation */
@@ -718,14 +718,14 @@ static int check_rdn_for_created_attrs(const char *newrdn)
 		slapi_rdn_init_dn(rdn, newrdn);
 		for (i = 0; type[i] != NULL; i++) {
 			if (slapi_rdn_contains_attr(rdn, type[i], &value)) {
-				LDAPDebug(LDAP_DEBUG_TRACE, "Invalid DN. RDN contains %s attribute\n", type[i], 0, 0);
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Invalid DN. RDN contains %s attribute\n", type[i], 0, 0);
 				rc = 1;
 				break;
 			}
 		}
 		slapi_rdn_free(&rdn);
 	} else {
-		LDAPDebug(LDAP_DEBUG_TRACE, "check_rdn_for_created_attrs: Error allocating RDN\n", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "check_rdn_for_created_attrs: Error allocating RDN\n", 0, 0, 0);
 		rc = -1;
 	}
 
diff --git a/ldap/servers/slapd/modutil.c b/ldap/servers/slapd/modutil.c
index a50f329..dd00e18 100644
--- a/ldap/servers/slapd/modutil.c
+++ b/ldap/servers/slapd/modutil.c
@@ -528,7 +528,7 @@ void
 slapi_mods_dump(const Slapi_Mods *smods, const char *text)
 {
 	int i;
-	LDAPDebug( LDAP_DEBUG_ANY, "smod - %s\n", text, 0, 0);
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "smod - %s\n", text, 0, 0);
 	for(i=0;i<smods->num_mods;i++)
 	{
 		slapi_mod_dump(smods->mods[i],i);
@@ -819,19 +819,19 @@ slapi_mod_dump(LDAPMod *mod, int n)
 	    switch ( operationtype )
 		{
 	    case LDAP_MOD_ADD:
-			LDAPDebug( LDAP_DEBUG_ANY, "smod %d - add: %s\n", n, mod->mod_type, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "smod %d - add: %s\n", n, mod->mod_type, 0);
 			break;
 
 	    case LDAP_MOD_DELETE:
-			LDAPDebug( LDAP_DEBUG_ANY, "smod %d - delete: %s\n", n, mod->mod_type, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "smod %d - delete: %s\n", n, mod->mod_type, 0);
 			break;
 
 	    case LDAP_MOD_REPLACE:
-			LDAPDebug( LDAP_DEBUG_ANY, "smod %d - replace: %s\n", n, mod->mod_type, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "smod %d - replace: %s\n", n, mod->mod_type, 0);
 			break;
 
 	    case LDAP_MOD_IGNORE:
-			LDAPDebug( LDAP_DEBUG_ANY, "smod %d - ignore: %s\n", n, mod->mod_type, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "smod %d - ignore: %s\n", n, mod->mod_type, 0);
 			break;
 	    }
 		if(operationtype!=LDAP_MOD_IGNORE)
@@ -846,13 +846,13 @@ slapi_mod_dump(LDAPMod *mod, int n)
 				bufp = buf;
 				slapi_ldif_put_type_and_value_with_options( &bufp, mod->mod_type, mod->mod_bvalues[i]->bv_val,	mod->mod_bvalues[i]->bv_len, 0 );
 				*bufp = '\0';
-				LDAPDebug( LDAP_DEBUG_ANY, "smod %d - value: %s", n, buf, 0);
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "smod %d - value: %s", n, buf, 0);
 				slapi_ch_free( (void**)&buf );
 			}
 		}
 	}
 	else
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "smod - null\n", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "smod - null\n", 0, 0, 0);
 	}
 }
diff --git a/ldap/servers/slapd/operation.c b/ldap/servers/slapd/operation.c
index 6c95552..9866eac 100644
--- a/ldap/servers/slapd/operation.c
+++ b/ldap/servers/slapd/operation.c
@@ -53,8 +53,8 @@ slapi_op_internal( Slapi_PBlock *pb )
 void
 operation_out_of_disk_space()
 {
-    LDAPDebug(LDAP_DEBUG_ANY, "*** DISK FULL ***\n", 0, 0, 0);
-    LDAPDebug(LDAP_DEBUG_ANY, "Attempting to shut down gracefully.\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "*** DISK FULL ***\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Attempting to shut down gracefully.\n", 0, 0, 0);
     g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
 }
 
@@ -602,10 +602,10 @@ slapi_connection_remove_operation( Slapi_PBlock *pb, Slapi_Connection *conn, Sla
 		;	/* NULL */
 	if ( *tmp == NULL ) {
 		if (op) {
-			LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: can't find op %d for conn %" NSPRIu64 "\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "connection_remove_operation: can't find op %d for conn %" NSPRIu64 "\n",
 			    (int)op->o_msgid, conn->c_connid, 0 );
 		} else {
-			LDAPDebug( LDAP_DEBUG_ANY, "connection_remove_operation: no operation provided\n",0, 0, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "connection_remove_operation: no operation provided\n",0, 0, 0);
 		}
 	} else {
 		*tmp = (*tmp)->o_next;
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 15207a5..db8c596 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -113,7 +113,7 @@ modify_update_last_modified_attr(Slapi_PBlock *pb, Slapi_Mods *smods)
     struct slapi_componentid *cid = NULL;
     slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "modify_update_last_modified_attr\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "modify_update_last_modified_attr\n", 0, 0, 0);
 
     slapi_pblock_get(pb, SLAPI_OPERATION, &op);
     bvals[0] = &bv;
@@ -1379,7 +1379,7 @@ iterate(Slapi_PBlock *pb, Slapi_Backend *be, int send_result,
                 if ( rc != LDAP_SUCCESS ) {
                     /* Send error result and 
                        abort op if the control is critical */
-                     LDAPDebug( LDAP_DEBUG_ANY,
+                     LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                     "Failed to get effective rights for entry (%s), rc=%d\n",
                     slapi_entry_get_dn_const(e), rc, 0 );
                     send_ldap_result( pb, rc, NULL, errbuf, 0, NULL );
@@ -1669,7 +1669,7 @@ compute_limits (Slapi_PBlock *pb)
     }
     slapi_pblock_set(pb, SLAPI_SEARCH_SIZELIMIT, &sizelimit);
 
-    LDAPDebug( LDAP_DEBUG_TRACE,
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
             "=> compute_limits: sizelimit=%d, timelimit=%d\n",
             sizelimit, timelimit, 0 );
 }
diff --git a/ldap/servers/slapd/passwd_extop.c b/ldap/servers/slapd/passwd_extop.c
index ad5b8da..4726fc5 100644
--- a/ldap/servers/slapd/passwd_extop.c
+++ b/ldap/servers/slapd/passwd_extop.c
@@ -68,7 +68,7 @@ static int passwd_check_pwd(Slapi_Entry *targetEntry, const char *pwd){
 	Slapi_Value cv;
 	Slapi_Value **bvals; 
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> passwd_check_pwd\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> passwd_check_pwd\n", 0, 0, 0 );
 	
 	slapi_value_init_string(&cv,pwd);
 	
@@ -82,7 +82,7 @@ static int passwd_check_pwd(Slapi_Entry *targetEntry, const char *pwd){
 	}
 
 	value_done(&cv);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= passwd_check_pwd: %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= passwd_check_pwd: %d\n", rc, 0, 0 );
 	
 	/* if the userPassword attribute is absent then rc is -1 */
 	return rc;
@@ -97,16 +97,16 @@ static int
 passwd_modify_getEntry( const char *dn, Slapi_Entry **e2 ) {
 	int		search_result = 0;
 	Slapi_DN 	sdn;
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> passwd_modify_getEntry\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> passwd_modify_getEntry\n", 0, 0, 0 );
 	slapi_sdn_init_dn_byref( &sdn, dn );
 	if ((search_result = slapi_search_internal_get_entry( &sdn, NULL, e2,
  					plugin_get_default_component_id())) != LDAP_SUCCESS ){
-	 LDAPDebug (LDAP_DEBUG_TRACE, "passwd_modify_getEntry: No such entry-(%s), err (%d)\n",
+	 LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "passwd_modify_getEntry: No such entry-(%s), err (%d)\n",
 					 dn, search_result, 0);
 	}
 
 	slapi_sdn_done( &sdn );
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= passwd_modify_getEntry: %d\n", search_result, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= passwd_modify_getEntry: %d\n", search_result, 0, 0 );
 	return search_result;
 }
 
@@ -123,7 +123,7 @@ passwd_apply_mods(Slapi_PBlock *pb_orig, const Slapi_DN *sdn, Slapi_Mods *mods,
 	LDAPControl **pb_resp_controls = NULL;
 	int ret=0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> passwd_apply_mods\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> passwd_apply_mods\n", 0, 0, 0 );
 
 	if (mods && (slapi_mods_get_num_mods(mods) > 0)) 
 	{
@@ -164,14 +164,14 @@ passwd_apply_mods(Slapi_PBlock *pb_orig, const Slapi_DN *sdn, Slapi_Mods *mods,
 		}
 
 		if (ret != LDAP_SUCCESS){
-			LDAPDebug(LDAP_DEBUG_TRACE, "WARNING: passwordPolicy modify error %d on entry '%s'\n",
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "WARNING: passwordPolicy modify error %d on entry '%s'\n",
 				ret, slapi_sdn_get_dn(sdn), 0);
 		}
 
 		pblock_done(&pb);
  	}
  
- 	LDAPDebug( LDAP_DEBUG_TRACE, "<= passwd_apply_mods: %d\n", ret, 0, 0 );
+ 	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= passwd_apply_mods: %d\n", ret, 0, 0 );
  
  	return ret;
 }
@@ -185,7 +185,7 @@ static int passwd_modify_userpassword(Slapi_PBlock *pb_orig, Slapi_Entry *target
 	int ret = 0;
 	Slapi_Mods smods;
 	
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> passwd_modify_userpassword\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> passwd_modify_userpassword\n", 0, 0, 0 );
 	
 	slapi_mods_init (&smods, 0);
 	slapi_mods_add_string(&smods, LDAP_MOD_REPLACE, SLAPI_USERPWD_ATTR, newPasswd);
@@ -196,7 +196,7 @@ static int passwd_modify_userpassword(Slapi_PBlock *pb_orig, Slapi_Entry *target
  
 	slapi_mods_done(&smods);
 	
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= passwd_modify_userpassword: %d\n", ret, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= passwd_modify_userpassword: %d\n", ret, 0, 0 );
 
 	return ret;
 }
@@ -302,7 +302,7 @@ static int passwd_modify_generate_policy_passwd( passwdPolicy *pwpolicy,
 			}
 			if ( categories > 0 ) {
 				/* password generator does not support passwordMin8Bit */
-    			LDAPDebug( LDAP_DEBUG_ANY,
+    			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"Unable to generate a password that meets the current "
 					"password syntax rules.  A minimum categories setting "
 					"of %d is not supported with random password generation.\n",
@@ -379,7 +379,7 @@ static int passwd_modify_generate_passwd( passwdPolicy *pwpolicy,
 		return LDAP_OPERATIONS_ERROR;
 	}
 	if ( pwpolicy->pw_min8bit > 0 ) {
-    	LDAPDebug( LDAP_DEBUG_ANY, "Unable to generate a password that meets "
+    	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Unable to generate a password that meets "
 						"the current password syntax rules.  8-bit syntax "
 						"restrictions are not supported with random password "
 						"generation.\n", 0, 0, 0 );
@@ -445,7 +445,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 	Slapi_Entry	*referrals = NULL;
 	/* Slapi_DN sdn; */
 
-    	LDAPDebug( LDAP_DEBUG_TRACE, "=> passwd_modify_extop\n", 0, 0, 0 );
+    	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> passwd_modify_extop\n", 0, 0, 0 );
 
 	/* Before going any further, we'll make sure that the right extended operation plugin
 	 * has been called: i.e., the OID shipped whithin the extended operation request must 
@@ -551,7 +551,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 		int rc = 0;
 		if ( ber_scanf( ber, "a", &rawdn) == LBER_ERROR ) {
 			slapi_ch_free_string(&rawdn);
-			LDAPDebug( LDAP_DEBUG_ANY, "ber_scanf failed :{\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_scanf failed :{\n", 0, 0, 0 );
 			errMesg = "ber_scanf failed at userID parse.\n";
 			rc = LDAP_PROTOCOL_ERROR;
 			goto free_and_return;
@@ -577,7 +577,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 	if (tag == LDAP_EXTOP_PASSMOD_TAG_OLDPWD ) {
 		if ( ber_scanf( ber, "a", &oldPasswd ) == LBER_ERROR ) {
 			slapi_ch_free_string(&oldPasswd);
-			LDAPDebug( LDAP_DEBUG_ANY, "ber_scanf failed :{\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_scanf failed :{\n", 0, 0, 0 );
 			errMesg = "ber_scanf failed at oldPasswd parse.\n";
 			rc = LDAP_PROTOCOL_ERROR;
 			goto free_and_return;
@@ -590,7 +590,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 	{
 		if ( ber_scanf( ber, "a", &newPasswd ) == LBER_ERROR ) {
 			slapi_ch_free_string(&newPasswd);
-			LDAPDebug( LDAP_DEBUG_ANY, "ber_scanf failed :{\n", 0, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_scanf failed :{\n", 0, 0, 0 );
 			errMesg = "ber_scanf failed at newPasswd parse.\n";
 			rc = LDAP_PROTOCOL_ERROR;
 			goto free_and_return;
@@ -599,7 +599,7 @@ passwd_modify_extop( Slapi_PBlock *pb )
 
 parse_req_done:	
 	/* Uncomment for debugging, otherwise we don't want to leak the password values into the log... */
-	/* LDAPDebug( LDAP_DEBUG_ARGS, "passwd: dn (%s), oldPasswd (%s) ,newPasswd (%s)\n",
+	/* LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "passwd: dn (%s), oldPasswd (%s) ,newPasswd (%s)\n",
 					 dn, oldPasswd, newPasswd); */
 
 	/* Get Bind DN */
@@ -806,7 +806,7 @@ parse_req_done:
 		slapi_pblock_set(pb, SLAPI_EXT_OP_RET_VALUE, gen_passwd);
 	}
 	
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= passwd_modify_extop: %d\n", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= passwd_modify_extop: %d\n", rc, 0, 0 );
 	
 	/* Free anything that we allocated above */
 free_and_return:
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index db5a9e7..2916aa9 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -157,7 +157,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CONN_ID:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_TRACE,
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_ID \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -170,7 +170,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		 * a pointer that could be freed out from under them.
 		 */
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_DN \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -181,7 +181,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CONN_AUTHTYPE:/* deprecated */
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_AUTHTYPE \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -208,7 +208,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 	case SLAPI_CONN_AUTHMETHOD:
                 /* returns a copy */
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_AUTHMETHOD \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -296,7 +296,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CONN_IS_REPLICATION_SESSION:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_IS_REPLICATION_SESSION \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -306,7 +306,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CONN_IS_SSL_SESSION:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_IS_SSL_SESSION \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -316,7 +316,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CONN_SASL_SSF:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			  "Connection is NULL and hence cannot access SLAPI_CONN_SASL_SSF \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -326,7 +326,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CONN_SSL_SSF:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			  "Connection is NULL and hence cannot access SLAPI_CONN_SSL_SSF \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -336,7 +336,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CONN_LOCAL_SSF:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			    "Connection is NULL and hence cannot access SLAPI_CONN_LOCAL_SSF \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -346,7 +346,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CONN_CERT:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_CERT \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -357,7 +357,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_OPERATION_TYPE:
 		if (pblock->pb_op == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Operation is NULL and hence cannot access SLAPI_OPERATION_TYPE \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -365,7 +365,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_OPINITIATED_TIME:
 		if (pblock->pb_op == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Operation is NULL and hence cannot access SLAPI_OPINITIATED_TIME \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -1830,7 +1830,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 
 	case SLAPI_CLIENT_DNS:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CLIENT_DNS \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -1972,7 +1972,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "Unknown parameter block argument %d\n", arg, 0, 0 );
 		return( -1 );
 	}
@@ -2021,7 +2021,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CONN_ID:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_ID \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -2034,7 +2034,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
              * free the current authtype.
              */
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_DN \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -2046,7 +2046,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
 	case SLAPI_CONN_AUTHTYPE: /* deprecated */
 	case SLAPI_CONN_AUTHMETHOD:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_AUTHMETHOD \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -2057,7 +2057,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CONN_IS_REPLICATION_SESSION:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CONN_IS_REPLICATION_SESSION \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -3452,7 +3452,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 	case SLAPI_CLIENT_DNS:
 		if (pblock->pb_conn == NULL) {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		          "Connection is NULL and hence cannot access SLAPI_CLIENT_DNS \n", 0, 0, 0 );
 			return (-1);
 		}
@@ -3587,7 +3587,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
 		break;
 
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		    "Unknown parameter block argument %d\n", arg, 0, 0 );
 		return( -1 );
 	}
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index e1b0987..a550e90 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -774,7 +774,7 @@ slapi_send_ldap_result( Slapi_PBlock *pb, int err, char *matched, char *text,
 		{
 			if (urls || nentries)
 			{
-				LDAPDebug( LDAP_DEBUG_ANY, "ERROR : urls or nentries set"
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR : urls or nentries set"
 					"in sendldap_result while NO_SUCH_OBJECT returned\n",0,0,0);
 			}
 
@@ -1281,7 +1281,7 @@ plugin_start(Slapi_Entry *entry, char *returntext)
 				if (enabled){
 				    if(plugin_index == plugin_idx){
 						/* finally, perform the op on the plugin */
-						LDAPDebug( LDAP_DEBUG_PLUGIN, "Starting %s plugin %s\n" ,
+						LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Starting %s plugin %s\n" ,
 								   config[plugin_index].type, config[plugin_index].name, 0 );
 						/*
 						 * Put the plugin into the temporary pblock so the startup functions have
@@ -1297,7 +1297,7 @@ plugin_start(Slapi_Entry *entry, char *returntext)
 							 * Delete the plugin(undo everything), as we don't know how far the start
 							 * function got.
 							 */
-							LDAPDebug( LDAP_DEBUG_ANY, "Failed to start %s plugin %s\n" ,
+							LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to start %s plugin %s\n" ,
 							           config[plugin_index].type, config[plugin_index].name, 0 );
 							PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE,"Failed to start plugin \"%s\".  See errors log.",
 							             config[plugin_index].name);
@@ -1343,14 +1343,14 @@ plugin_start(Slapi_Entry *entry, char *returntext)
 
 	if(plugins_started == 0){
 		/* a dependency was not resolved - error */
-		LDAPDebug( LDAP_DEBUG_ANY, "Error: Failed to resolve plugin dependencies\n" , 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: Failed to resolve plugin dependencies\n" , 0, 0, 0 );
 		PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE,"Failed to resolve plugin dependencies.");
 
 		/* list the plugins yet to perform op */
 		i = 0;
 		while(i < total_plugins){
 			if(config[i].op_done == 0){
-				LDAPDebug( LDAP_DEBUG_ANY, "Error: %s plugin %s is not started\n" , config[i].type, config[i].name, 0 );
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: %s plugin %s is not started\n" , config[i].type, config[i].name, 0 );
 				plugin_remove_plugins(config[i].plugin, config[i].type);
 			}
 			i++;
@@ -1774,7 +1774,7 @@ plugin_dependency_startall(int argc, char** argv, char *errmsg, int operation, c
 				{
 					/* finally, perform the op on the plugin */
 			
-					LDAPDebug( LDAP_DEBUG_PLUGIN, "Starting %s plugin %s\n" , config[plugin_index].type, config[plugin_index].name, 0 );
+					LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Starting %s plugin %s\n" , config[plugin_index].type, config[plugin_index].name, 0 );
 					/*
 					 * Put the plugin into the temporary pblock so the startup functions have
 					 * access to the real plugin for registering callbacks, tasks, etc.
@@ -1793,7 +1793,7 @@ plugin_dependency_startall(int argc, char** argv, char *errmsg, int operation, c
 						 * problem then the plugin will never start and eventually it will
 						 * trigger an exit anyway.
 						 */
-						LDAPDebug( LDAP_DEBUG_ANY, "Failed to start %s plugin %s\n" , config[plugin_index].type, config[plugin_index].name, 0 );
+						LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to start %s plugin %s\n" , config[plugin_index].type, config[plugin_index].name, 0 );
 						continue;
 					} else {
 						/* now set the plugin and all its registered plugin functions as started */
@@ -1841,7 +1841,7 @@ plugin_dependency_startall(int argc, char** argv, char *errmsg, int operation, c
 	if(plugins_started == 0)
 	{
 		/* a dependency was not resolved - error */
-		LDAPDebug( LDAP_DEBUG_ANY, "Error: Failed to resolve plugin dependencies\n" , 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: Failed to resolve plugin dependencies\n" , 0, 0, 0 );
 
 		/* list the plugins yet to perform op */
 		i = 0;
@@ -1849,7 +1849,7 @@ plugin_dependency_startall(int argc, char** argv, char *errmsg, int operation, c
 		{
 			if(config[i].op_done == 0)
 			{
-				LDAPDebug( LDAP_DEBUG_ANY, "Error: %s plugin %s is not started\n" , config[i].type, config[i].name, 0 );
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: %s plugin %s is not started\n" , config[i].type, config[i].name, 0 );
 			}
 			i++;
 		}
@@ -2422,7 +2422,7 @@ plugin_restart(Slapi_Entry *pentryBefore, Slapi_Entry *pentryAfter)
 	 * be allowed
 	 */
 	if(plugin_is_critical(pentryBefore)){
-		LDAPDebug(LDAP_DEBUG_ANY, "plugin_restart: Plugin (%s) is critical "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_restart: Plugin (%s) is critical "
 			"to server operation.  Server requires restart for changes to "
 			"take effect.\n", slapi_entry_get_dn(pentryBefore),0,0);
 		return 0;
@@ -2433,21 +2433,21 @@ plugin_restart(Slapi_Entry *pentryBefore, Slapi_Entry *pentryAfter)
 
 	if(plugin_delete(pentryBefore, returntext, 1) == LDAP_SUCCESS){
 		if(plugin_add(pentryAfter, returntext, 1) == LDAP_SUCCESS){
-			LDAPDebug(LDAP_DEBUG_PLUGIN, "plugin_restart: Plugin (%s) has been successfully "
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "plugin_restart: Plugin (%s) has been successfully "
 				"restarted after configuration change.\n",
 				slapi_entry_get_dn(pentryAfter),0,0);
 		} else {
-			LDAPDebug(LDAP_DEBUG_ANY, "plugin_restart: Plugin (%s) failed to restart after "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_restart: Plugin (%s) failed to restart after "
 				"configuration change (%s).  Reverting to original plugin entry.\n",
 				slapi_entry_get_dn(pentryAfter), returntext, 0);
 			if(plugin_add(pentryBefore, returntext, 1) != LDAP_SUCCESS){
-				LDAPDebug(LDAP_DEBUG_ANY, "plugin_restart: Plugin (%s) failed to reload "
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_restart: Plugin (%s) failed to reload "
 					"original plugin (%s)\n",slapi_entry_get_dn(pentryBefore), returntext, 0);
 			}
 			rc = 1;
 		}
 	} else {
-		LDAPDebug(LDAP_DEBUG_ANY,"plugin_restart: failed to disable/stop the plugin (%s): %s\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"plugin_restart: failed to disable/stop the plugin (%s): %s\n",
 			slapi_entry_get_dn(pentryBefore), returntext, 0);
 		rc = 1;
 	}
@@ -2504,7 +2504,7 @@ set_plugin_config_from_entry(
 	{
 		if (plugin_config_set_action(&config->plgc_schema_check, value))
 		{
-			LDAPDebug(LDAP_DEBUG_PLUGIN, "Error: invalid value %s for attribute %s "
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Error: invalid value %s for attribute %s "
 					  "from entry %s\n", value, ATTR_PLUGIN_SCHEMA_CHECK,
 					  slapi_entry_get_dn_const(plugin_entry));
 			status = 1;
@@ -2517,7 +2517,7 @@ set_plugin_config_from_entry(
 	{
 		if (plugin_config_set_action(&config->plgc_log_access, value))
 		{
-			LDAPDebug(LDAP_DEBUG_PLUGIN, "Error: invalid value %s for attribute %s "
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Error: invalid value %s for attribute %s "
 					  "from entry %s\n", value, ATTR_PLUGIN_LOG_ACCESS,
 					  slapi_entry_get_dn_const(plugin_entry));
 			status = 1;
@@ -2530,7 +2530,7 @@ set_plugin_config_from_entry(
 	{
 		if (plugin_config_set_action(&config->plgc_log_audit, value))
 		{
-			LDAPDebug(LDAP_DEBUG_PLUGIN, "Error: invalid value %s for attribute %s "
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Error: invalid value %s for attribute %s "
 					  "from entry %s\n", value, ATTR_PLUGIN_LOG_AUDIT,
 					  slapi_entry_get_dn_const(plugin_entry));
 			status = 1;
@@ -2543,7 +2543,7 @@ set_plugin_config_from_entry(
 	{
 		if (plugin_config_set_action(&config->plgc_invoke_for_replop, value))
 		{
-			LDAPDebug(LDAP_DEBUG_PLUGIN, "Error: invalid value %s for attribute %s "
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Error: invalid value %s for attribute %s "
 					  "from entry %s\n", value, ATTR_PLUGIN_INVOKE_FOR_REPLOP,
 					  slapi_entry_get_dn_const(plugin_entry));
 			status = 1;
@@ -2557,7 +2557,7 @@ set_plugin_config_from_entry(
 	{
 		if (plugin_set_subtree_config(&(config->plgc_target_subtrees), values[i]))
 		{
-			LDAPDebug(LDAP_DEBUG_PLUGIN, "Error: invalid value %s for attribute %s "
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Error: invalid value %s for attribute %s "
 					  "from entry %s\n", values[i], ATTR_PLUGIN_TARGET_SUBTREE,
 					  slapi_entry_get_dn_const(plugin_entry));
 			status = 1;
@@ -2576,7 +2576,7 @@ set_plugin_config_from_entry(
 	{
 		if (plugin_set_subtree_config(&(config->plgc_excluded_target_subtrees), values[i]))
 		{
-			LDAPDebug(LDAP_DEBUG_PLUGIN, "Error: invalid value %s for attribute %s "
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Error: invalid value %s for attribute %s "
 					  "from entry %s\n", values[i], ATTR_PLUGIN_EXCLUDE_TARGET_SUBTREE,
 					  slapi_entry_get_dn_const(plugin_entry));
 			status = 1;
@@ -2591,7 +2591,7 @@ set_plugin_config_from_entry(
 	{
 		if (plugin_set_subtree_config(&(config->plgc_bind_subtrees), values[i]))
 		{
-			LDAPDebug(LDAP_DEBUG_PLUGIN, "Error: invalid value %s for attribute %s "
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Error: invalid value %s for attribute %s "
 					  "from entry %s\n", values[i], ATTR_PLUGIN_BIND_SUBTREE,
 					  slapi_entry_get_dn_const(plugin_entry));
 			status = 1;
@@ -2610,7 +2610,7 @@ set_plugin_config_from_entry(
 	{
 		if (plugin_set_subtree_config(&(config->plgc_excluded_bind_subtrees), values[i]))
 		{
-			LDAPDebug(LDAP_DEBUG_PLUGIN, "Error: invalid value %s for attribute %s "
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Error: invalid value %s for attribute %s "
 					  "from entry %s\n", values[i], ATTR_PLUGIN_EXCLUDE_BIND_SUBTREE,
 					  slapi_entry_get_dn_const(plugin_entry));
 			status = 1;
@@ -2650,7 +2650,7 @@ add_plugin_description(Slapi_Entry *e, const char *attrname, char *val)
 	newval[0] = &desc;
 	if ((status = entry_replace_values(e, attrname, newval)) != 0)
 	{
-        LDAPDebug(LDAP_DEBUG_PLUGIN, "Error: failed to add value %s to "
+        LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "Error: failed to add value %s to "
 				  "attribute %s of entry %s\n", val, attrname,
 				  slapi_entry_get_dn_const(e));
 		status = 1;
@@ -2697,7 +2697,7 @@ plugin_add_descriptive_attributes( Slapi_Entry *e, struct slapdplugin *plugin )
 			/* This can happen for things such as disabled syntax plug-ins.  We
 			 * just treat this as a warning to allow the description attributes
 			 * to be set to a default value to avoid an objectclass violation. */
-			LDAPDebug(LDAP_DEBUG_PLUGIN,
+			LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG,
 					"Warning: couldn't find plugin %s in global list. "
 					"Adding default descriptive values.\n",
 					slapi_entry_get_dn_const(e), 0, 0 );
@@ -2835,7 +2835,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
 
 	if ((existname = plugin_exists(slapi_entry_get_sdn_const(plugin_entry))) != NULL)
 	{
-		LDAPDebug(LDAP_DEBUG_ANY, "plugin_setup: the plugin named %s already exists, "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_setup: the plugin named %s already exists, "
 		        "or is already setup.\n", existname, 0, 0);
 		PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
 		        "the plugin named %s already exists, or is already setup.", existname);
@@ -2856,7 +2856,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
 											   ATTR_PLUGIN_TYPE)))
 	{
 		/* error: required attribute %s missing */
-		LDAPDebug(LDAP_DEBUG_ANY, "Error: required attribute %s is missing from entry \"%s\"\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: required attribute %s is missing from entry \"%s\"\n",
 		          ATTR_PLUGIN_TYPE, slapi_entry_get_dn_const(plugin_entry), 0);
 		PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,"required attribute %s is missing from entry",
 		             ATTR_PLUGIN_TYPE);
@@ -2870,7 +2870,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
 
 		if ( status != 0 ) {
 			/* error: unknown plugin type */
-			LDAPDebug(LDAP_DEBUG_ANY, "Error: unknown plugin type \"%s\" in entry \"%s\"\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: unknown plugin type \"%s\" in entry \"%s\"\n",
 					value, slapi_entry_get_dn_const(plugin_entry), 0);
 			PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE, "unknown plugin type \"%s\" in entry", value);
 			slapi_ch_free_string(&value);
@@ -2884,7 +2884,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
 		!(value = slapi_entry_attr_get_charptr(plugin_entry, "cn")))
 	{
 		/* error: required attribute %s missing */
-		LDAPDebug(LDAP_DEBUG_ANY, "Error: required attribute %s is missing from entry \"%s\"\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: required attribute %s is missing from entry \"%s\"\n",
 		          "cn", slapi_entry_get_dn_const(plugin_entry), 0);
 		PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE, "required attribute \"cn\" is missing from entry");
 		status = -1;
@@ -2916,7 +2916,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
 		if ((*value == '\0') || (*endptr != '\0') ||
 			(precedence < PLUGIN_MIN_PRECEDENCE) || (precedence > PLUGIN_MAX_PRECEDENCE))
 		{
-			LDAPDebug(LDAP_DEBUG_ANY, "Error: value for attribute %s must be "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: value for attribute %s must be "
 				"an integer between %d and %d\n", ATTR_PLUGIN_PRECEDENCE,
 				PLUGIN_MIN_PRECEDENCE, PLUGIN_MAX_PRECEDENCE);
 			PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE, "value for attribute %s must be "
@@ -2938,7 +2938,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
 		if (!initfunc)
 		{
 			/* error: required attribute %s missing */
-			LDAPDebug(LDAP_DEBUG_ANY, "Error: required attribute %s is missing from entry \"%s\"\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: required attribute %s is missing from entry \"%s\"\n",
 			          ATTR_PLUGIN_INITFN, slapi_entry_get_dn_const(plugin_entry), 0);
 			PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE,"required attribute %s is missing from entry.",
 			          ATTR_PLUGIN_INITFN);
@@ -2960,7 +2960,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
 												   ATTR_PLUGIN_PATH)))
 		{
 			/* error: required attribute %s missing */
-			LDAPDebug(LDAP_DEBUG_ANY, "Error: required attribute %s is missing from entry \"%s\"\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: required attribute %s is missing from entry \"%s\"\n",
 			          ATTR_PLUGIN_PATH, slapi_entry_get_dn_const(plugin_entry), 0);
 			PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "required attribute %s is missing from entry.",
 			            ATTR_PLUGIN_PATH);
@@ -3071,7 +3071,7 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
 
 	if (enabled && (*initfunc)(&pb) != 0)
 	{
-        LDAPDebug(LDAP_DEBUG_ANY, "Init function \"%s\" for \"%s\" plugin in library \"%s\" failed\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Init function \"%s\" for \"%s\" plugin in library \"%s\" failed\n",
 				  plugin->plg_initfunc, plugin->plg_name, plugin->plg_libpath);
         PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE,"Init function \"%s\" for \"%s\" plugin in "
                      "library \"%s\" failed.",plugin->plg_initfunc, plugin->plg_name, plugin->plg_libpath);
@@ -3132,12 +3132,12 @@ plugin_add(Slapi_Entry *entry, char *returntext, int locked)
     }
 
     if((rc = plugin_setup(entry, 0, 0, 1, returntext)) != LDAP_SUCCESS){
-        LDAPDebug(LDAP_DEBUG_PLUGIN, "plugin_add: plugin_setup failed for (%s)\n",slapi_entry_get_dn(entry), rc, 0);
+        LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "plugin_add: plugin_setup failed for (%s)\n",slapi_entry_get_dn(entry), rc, 0);
         goto done;
     }
 
     if((rc = plugin_start(entry, returntext)) != LDAP_SUCCESS){
-       LDAPDebug(LDAP_DEBUG_PLUGIN, "plugin_add: plugin_start failed for (%s)\n",slapi_entry_get_dn(entry), rc, 0);
+       LDAPDebug(LDAP_DEBUG_PLUGIN, LOG_DEBUG, "plugin_add: plugin_start failed for (%s)\n",slapi_entry_get_dn(entry), rc, 0);
        goto done;
     }
 
@@ -3275,7 +3275,7 @@ next:
                 for(i = 0; list && list[i]; i++){
                     if(strcasecmp(list[i], plugin_name) == 0){
                         /* We have a dependency, we can not disable this pluign */
-                        LDAPDebug(LDAP_DEBUG_ANY, "plugin_delete_check_dependency: can not disable plugin(%s) due "
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_delete_check_dependency: can not disable plugin(%s) due "
                                   "to dependency name issues with plugin (%s)\n",
                                   plugin_name, config[index].plugin->plg_name, 0);
                         rc = -1;
@@ -3331,7 +3331,7 @@ next:
             PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Plugin (%s) type (%s) is needed "
                     "by other plugins(%s), it can not be dynamically disabled/removed at this time.",
                     plugin_name, plugin_type, plugins);
-            LDAPDebug(LDAP_DEBUG_ANY, "plugin_delete_check_dependency: %s\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_delete_check_dependency: %s\n",
                     returntext, 0, 0);
 
             slapi_ch_free_string(&plugins);
@@ -3506,7 +3506,7 @@ plugin_delete(Slapi_Entry *plugin_entry, char *returntext, int locked)
 
     /* Critical server plugins can not be disabled */
     if(plugin_is_critical(plugin_entry)){
-        LDAPDebug(LDAP_DEBUG_ANY, "plugin_delete: plugin \"%s\" is critical to server operations, and can not be disabled\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_delete: plugin \"%s\" is critical to server operations, and can not be disabled\n",
                   slapi_entry_get_dn_const(plugin_entry), 0, 0);
         PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Plugin \"%s\" is critical to server operations, and can not "
                    "be disabled.\n",slapi_entry_get_dn_const(plugin_entry));
@@ -3516,7 +3516,7 @@ plugin_delete(Slapi_Entry *plugin_entry, char *returntext, int locked)
 
     if (!(value = slapi_entry_attr_get_charptr(plugin_entry, ATTR_PLUGIN_TYPE))){
         /* error: required attribute %s missing */
-        LDAPDebug(LDAP_DEBUG_ANY, "plugin_delete: required attribute %s is missing from entry \"%s\"\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_delete: required attribute %s is missing from entry \"%s\"\n",
                   ATTR_PLUGIN_TYPE, slapi_entry_get_dn_const(plugin_entry), 0);
         PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Plugin delete failed: required attribute %s "
                      "is missing from entry.",ATTR_PLUGIN_TYPE);
@@ -3533,7 +3533,7 @@ plugin_delete(Slapi_Entry *plugin_entry, char *returntext, int locked)
             rc = plugin_get_type_and_list(value, &type, &plugin_list);
             if ( rc != 0 ) {
                 /* error: unknown plugin type */
-                LDAPDebug(LDAP_DEBUG_ANY, "plugin_delete: unknown plugin type \"%s\" in entry \"%s\"\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_delete: unknown plugin type \"%s\" in entry \"%s\"\n",
                           value, slapi_entry_get_dn_const(plugin_entry), 0);
                 PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE, "Plugin delete failed: unknown plugin type "
                          "\"%s\" in entry.",value);
@@ -3560,7 +3560,7 @@ plugin_delete(Slapi_Entry *plugin_entry, char *returntext, int locked)
                      * Make sure there are no other plugins that depend on this one before removing it
                      */
                     if(plugin_delete_check_dependency(plugin, CHECK_ALL, returntext) != LDAP_SUCCESS){
-                        LDAPDebug(LDAP_DEBUG_ANY, "plugin_delete: failed to disable/delete plugin (%s)\n",
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_delete: failed to disable/delete plugin (%s)\n",
                                   plugin->plg_dn,0,0);
                         rc = -1;
                         break;
@@ -3583,7 +3583,7 @@ done:
     if(!removed && rc == 0){
         PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,"Plugin delete failed: could not find plugin "
                     "in the global list.");
-        LDAPDebug(LDAP_DEBUG_ANY, "plugin_delete: did not find plugin(%s) in the global list.\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_delete: did not find plugin(%s) in the global list.\n",
                   slapi_entry_get_dn_const(plugin_entry),0,0);
         rc = -1;
     }
@@ -3724,7 +3724,7 @@ plugin_invoke_plugin_sdn (struct slapdplugin *plugin, int operation, Slapi_PBloc
 
 	PR_ASSERT (plugin);
 	if (!pb) {
-		LDAPDebug(LDAP_DEBUG_ANY, "plugin_invoke_plugin_sdn: NULL pblock.\n", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_invoke_plugin_sdn: NULL pblock.\n", 0, 0, 0);
 		return PR_FALSE;
 	}
 
diff --git a/ldap/servers/slapd/plugin_acl.c b/ldap/servers/slapd/plugin_acl.c
index b250d29..61aa67f 100644
--- a/ldap/servers/slapd/plugin_acl.c
+++ b/ldap/servers/slapd/plugin_acl.c
@@ -194,7 +194,7 @@ plugin_call_acl_verify_syntax ( Slapi_PBlock *pb, Slapi_Entry *e, char **errbuf
 	}
 
 	if ( !plugin_called ) {
-		LDAPDebug ( LDAP_DEBUG_ANY, "The ACL plugin is not initialized. The aci syntax cannot be verified\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "The ACL plugin is not initialized. The aci syntax cannot be verified\n",0,0,0);
 	}
 	return rc;
 }
diff --git a/ldap/servers/slapd/plugin_mr.c b/ldap/servers/slapd/plugin_mr.c
index a930c3c..996dbc0 100644
--- a/ldap/servers/slapd/plugin_mr.c
+++ b/ldap/servers/slapd/plugin_mr.c
@@ -122,11 +122,11 @@ plugin_mr_find_registered (char* oid)
 	{
 	    if (!strcasecmp (oid, i->oi_oid))
 	    {
-			LDAPDebug (LDAP_DEBUG_FILTER, "plugin_mr_find_registered(%s) != NULL\n", oid, 0, 0);
+			LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "plugin_mr_find_registered(%s) != NULL\n", oid, 0, 0);
 			return i->oi_plugin;
 	    }
 	}
-    LDAPDebug (LDAP_DEBUG_FILTER, "plugin_mr_find_registered(%s) == NULL\n", oid, 0, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "plugin_mr_find_registered(%s) == NULL\n", oid, 0, 0);
     return NULL;
 }
 
@@ -134,7 +134,7 @@ static void
 plugin_mr_bind (char* oid, struct slapdplugin* plugin)
 {
 	oid_item_t* i = (oid_item_t*) slapi_ch_malloc (sizeof (oid_item_t));
-    LDAPDebug (LDAP_DEBUG_FILTER, "=> plugin_mr_bind(%s)\n", oid, 0, 0);
+    LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> plugin_mr_bind(%s)\n", oid, 0, 0);
 	init_global_mr_lock();
 	i->oi_oid = slapi_ch_strdup (oid);
 	i->oi_plugin = plugin;
@@ -142,7 +142,7 @@ plugin_mr_bind (char* oid, struct slapdplugin* plugin)
 	i->oi_next = global_mr_oids;
 	global_mr_oids = i;
 	PR_Unlock (global_mr_oids_lock);        
-	LDAPDebug (LDAP_DEBUG_FILTER, "<= plugin_mr_bind\n", 0, 0, 0);
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= plugin_mr_bind\n", 0, 0, 0);
 }
 
 int /* an LDAP error code, hopefully LDAP_SUCCESS */
@@ -529,7 +529,7 @@ default_mr_filter_create(Slapi_PBlock *pb)
 		slapi_pblock_set(pb, SLAPI_PLUGIN_DESTROY_FN, default_mr_filter_destroy);
 		rc = 0; /* success */
 	} else {
-		LDAPDebug(LDAP_DEBUG_FILTER,
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 				  "default_mr_filter_create: missing parameter: %s%s%s\n",
 				  mrOID ? "" : " oid",
 				  mrTYPE ? "" : " attribute type",
diff --git a/ldap/servers/slapd/plugin_syntax.c b/ldap/servers/slapd/plugin_syntax.c
index 76f5720..fb5a581 100644
--- a/ldap/servers/slapd/plugin_syntax.c
+++ b/ldap/servers/slapd/plugin_syntax.c
@@ -25,13 +25,13 @@ plugin_syntax_find( const char *nameoroid )
 {
 	struct slapdplugin	*pi;
 
-	/* LDAPDebug( LDAP_DEBUG_FILTER, "=> plugin_syntax_find (%s)\n", nameoroid, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> plugin_syntax_find (%s)\n", nameoroid, 0, 0 ); */
 	for ( pi = get_plugin_list(PLUGIN_LIST_SYNTAX); pi != NULL; pi = pi->plg_next ) {
 		if ( charray_inlist( pi->plg_syntax_names, (char *)nameoroid ) ) {
 			break;
 		}
 	}
-	/* LDAPDebug( LDAP_DEBUG_FILTER, "<= plugin_syntax_find %d\n", pi, 0, 0 ); */
+	/* LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= plugin_syntax_find %d\n", pi, 0, 0 ); */
 	return ( pi );
 }
 
@@ -60,7 +60,7 @@ slapi_get_global_syntax_plugins()
 char *
 plugin_syntax2oid( struct slapdplugin *pi )
 {
-	LDAPDebug(LDAP_DEBUG_ANY,
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "the function plugin_syntax2oid is deprecated - please use attr_get_syntax_oid instead\n", 0, 0, 0);
     PR_ASSERT(0);
 	return( NULL );
@@ -72,7 +72,7 @@ plugin_call_syntax_get_compare_fn(
 	value_compare_fn_type *compare_fn
 )
 {
-	LDAPDebug(LDAP_DEBUG_ANY,
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
               "the function plugin_call_syntax_get_compare_fn is deprecated - please use attr_get_value_cmp_fn instead\n", 0, 0, 0);
     PR_ASSERT(0);
 	return( 0 );
@@ -101,7 +101,7 @@ plugin_call_syntax_filter_ava_sv(
 	Slapi_PBlock	pipb;
 	IFP ava_fn = NULL;
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "=> plugin_call_syntax_filter_ava %s=%s\n", ava->ava_type,
 	    ava->ava_value.bv_val, 0 );
 
@@ -112,7 +112,7 @@ plugin_call_syntax_filter_ava_sv(
 	}
 
 	if ( ( a->a_mr_eq_plugin == NULL ) && ( a->a_mr_ord_plugin == NULL ) && ( a->a_plugin == NULL ) ) {
-		LDAPDebug( LDAP_DEBUG_FILTER,
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 		    "<= plugin_call_syntax_filter_ava no plugin for attr (%s)\n",
 		    a->a_type, 0, 0 );
 		return( LDAP_PROTOCOL_ERROR );	/* syntax unkonwn */
@@ -135,7 +135,7 @@ plugin_call_syntax_filter_ava_sv(
 		if ((a->a_mr_ord_plugin == NULL) &&
 			((a->a_plugin->plg_syntax_flags &
 			  SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING) == 0)) {
-			LDAPDebug( LDAP_DEBUG_FILTER,
+			LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 					   "<= plugin_call_syntax_filter_ava: attr (%s) has no ordering matching rule, and syntax does not define a compare function\n",
 					   a->a_type, 0, 0 );
 			rc = LDAP_PROTOCOL_ERROR;
@@ -177,19 +177,19 @@ plugin_call_syntax_filter_ava_sv(
 				rc = (*ava_fn)( &pipb, &ava->ava_value, va, ftype, retVal );
 			}
 		} else {
-			LDAPDebug( LDAP_DEBUG_FILTER,
+			LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 					   "<= plugin_call_syntax_filter_ava: attr (%s) has no ava filter function\n",
 					   a->a_type, 0, 0 );
 		}
 		break;
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY, "plugin_call_syntax_filter_ava: "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "plugin_call_syntax_filter_ava: "
 		    "unknown filter type %d\n", ftype, 0, 0 );
 		rc = LDAP_PROTOCOL_ERROR;
 		break;
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "<= plugin_call_syntax_filter_ava %d\n", rc, 0, 0 );
 	return( rc );
 }
@@ -216,7 +216,7 @@ plugin_call_syntax_filter_sub_sv(
 	IFP sub_fn = NULL;
 	int filter_normalized = 0;
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "=> plugin_call_syntax_filter_sub_sv\n", 0, 0, 0 );
 
 	if ( ( a->a_mr_sub_plugin == NULL ) && ( a->a_plugin == NULL ) ) {
@@ -224,7 +224,7 @@ plugin_call_syntax_filter_sub_sv(
 		slapi_attr_init_syntax(a);
 	}
 	if ( ( a->a_mr_sub_plugin == NULL ) && ( a->a_plugin == NULL ) ) {
-		LDAPDebug( LDAP_DEBUG_FILTER,
+		LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 				   "<= plugin_call_syntax_filter_sub_sv attribute (%s) has no substring matching rule or syntax plugin\n",
 				   a->a_type, 0, 0 );
 		return( -1 );	/* syntax unkonwn - does not match */
@@ -262,7 +262,7 @@ plugin_call_syntax_filter_sub_sv(
 		rc = -1;
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "<= plugin_call_syntax_filter_sub_sv %d\n",
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "<= plugin_call_syntax_filter_sub_sv %d\n",
 	    rc, 0, 0 );
 	return( rc );
 }
@@ -562,7 +562,7 @@ slapi_call_syntax_values2keys_sv(
 	Slapi_PBlock		pipb;
 	struct slapdplugin	*pi = vpi;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> slapi_call_syntax_values2keys\n",
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> slapi_call_syntax_values2keys\n",
 	    0, 0, 0 );
 
 	pblock_init( &pipb );
@@ -574,7 +574,7 @@ slapi_call_syntax_values2keys_sv(
 		rc = pi->plg_syntax_values2keys( &pipb, vals, ivals, ftype );
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "<= slapi_call_syntax_values2keys %d\n", rc, 0, 0 );
 	return( rc );
 }
@@ -592,7 +592,7 @@ slapi_attr_values2keys_sv_pb(
 	struct slapdplugin	*pi = NULL;
 	IFP v2k_fn = NULL;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> slapi_attr_values2keys_sv\n",
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> slapi_attr_values2keys_sv\n",
 	    0, 0, 0 );
 	if ( ( sattr->a_plugin == NULL ) ) {
 		/* could be lazy plugin initialization, get it now */
@@ -620,7 +620,7 @@ slapi_attr_values2keys_sv_pb(
 		}
 		break;
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY, "<= slapi_attr_values2keys_sv: ERROR: unsupported filter type %d\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "<= slapi_attr_values2keys_sv: ERROR: unsupported filter type %d\n",
 				   ftype, 0, 0 );
 		rc = LDAP_PROTOCOL_ERROR;
 		goto done;
@@ -635,7 +635,7 @@ slapi_attr_values2keys_sv_pb(
 	}
 
 done:
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "<= slapi_call_syntax_values2keys %d\n", rc, 0, 0 );
 	return( rc );
 }
@@ -688,7 +688,7 @@ slapi_call_syntax_values2keys_sv_pb(
 	int					rc;
 	struct slapdplugin	*pi = vpi;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "=> slapi_call_syntax_values2keys\n",
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "=> slapi_call_syntax_values2keys\n",
 	    0, 0, 0 );
 
 	slapi_pblock_set( pb, SLAPI_PLUGIN, vpi );
@@ -699,7 +699,7 @@ slapi_call_syntax_values2keys_sv_pb(
 		rc = pi->plg_syntax_values2keys( pb, vals, ivals, ftype );
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "<= slapi_call_syntax_values2keys %d\n", rc, 0, 0 );
 	return( rc );
 }
@@ -735,7 +735,7 @@ slapi_call_syntax_assertion2keys_ava_sv(
 	Slapi_PBlock		pipb;
 	struct slapdplugin	*pi = vpi;
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "=> slapi_call_syntax_assertion2keys_ava\n", 0, 0, 0 );
 
 	pblock_init( &pipb );
@@ -746,7 +746,7 @@ slapi_call_syntax_assertion2keys_ava_sv(
 		rc = pi->plg_syntax_assertion2keys_ava( &pipb, val, ivals, ftype );
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "<= slapi_call_syntax_assertion2keys_ava %d\n", rc, 0, 0 );
 	return( rc );
 }
@@ -764,7 +764,7 @@ slapi_attr_assertion2keys_ava_sv(
 	struct slapdplugin	*pi = NULL;
 	IFP a2k_fn = NULL;
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "=> slapi_attr_assertion2keys_ava_sv\n", 0, 0, 0 );
 	if ( ( sattr->a_plugin == NULL ) ) {
 		/* could be lazy plugin initialization, get it now */
@@ -784,7 +784,7 @@ slapi_attr_assertion2keys_ava_sv(
 		}
 		break;
 	default:
-		LDAPDebug( LDAP_DEBUG_ANY, "<= slapi_attr_assertion2keys_ava_sv: ERROR: unsupported filter type %d\n",
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "<= slapi_attr_assertion2keys_ava_sv: ERROR: unsupported filter type %d\n",
 				   ftype, 0, 0 );
 		rc = LDAP_PROTOCOL_ERROR;
 		goto done;
@@ -798,7 +798,7 @@ slapi_attr_assertion2keys_ava_sv(
 		rc = (*a2k_fn)( &pipb, val, ivals, ftype );
 	}
 done:
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "<= slapi_attr_assertion2keys_ava_sv %d\n", rc, 0, 0 );
 	return( rc );
 }
@@ -852,7 +852,7 @@ slapi_call_syntax_assertion2keys_sub_sv(
 	Slapi_PBlock		pipb;
 	struct slapdplugin	*pi = vpi;
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "=> slapi_call_syntax_assertion2keys_sub\n", 0, 0, 0 );
 
 	pblock_init( &pipb );
@@ -865,7 +865,7 @@ slapi_call_syntax_assertion2keys_sub_sv(
 		    final, ivals );
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "<= slapi_call_syntax_assertion2keys_sub %d\n", rc, 0, 0 );
 	return( rc );
 }
@@ -898,7 +898,7 @@ slapi_attr_assertion2keys_sub_sv_pb(
 	struct slapdplugin	*origpi = NULL;
 	IFP a2k_fn = NULL;
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "=> slapi_attr_assertion2keys_sub_sv\n", 0, 0, 0 );
 	if ( ( sattr->a_plugin == NULL ) ) {
 		/* could be lazy plugin initialization, get it now */
@@ -932,7 +932,7 @@ slapi_attr_assertion2keys_sub_sv_pb(
 		slapi_pblock_set(pb, SLAPI_PLUGIN, origpi);
 	}
 
-	LDAPDebug( LDAP_DEBUG_FILTER,
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG,
 	    "<= slapi_attr_assertion2keys_sub_sv %d\n", rc, 0, 0 );
 	return( rc );
 }
diff --git a/ldap/servers/slapd/poll_using_select.c b/ldap/servers/slapd/poll_using_select.c
index 203dce1..8c22847 100644
--- a/ldap/servers/slapd/poll_using_select.c
+++ b/ldap/servers/slapd/poll_using_select.c
@@ -40,7 +40,7 @@ poll_using_select(struct my_pollfd *filed, int nfds, int timeout)
     int a, b, retval;
 
 #ifdef DEBUG_POLL_AS_SELECT
-    LDAPDebug(LDAP_DEBUG_ANY, "poll convert nfds=%d, timeout=%d\n", nfds, timeout,0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "poll convert nfds=%d, timeout=%d\n", nfds, timeout,0);
 #endif /* DEBUG_POLL_AS_SELECT */
 
     FD_ZERO( &rd );
@@ -61,7 +61,7 @@ poll_using_select(struct my_pollfd *filed, int nfds, int timeout)
 
 #ifdef DEBUG_POLL_AS_SELECT
 	if (filed[a].events != 0) {
-		LDAPDebug(LDAP_DEBUG_ANY, "poll events = %d for fd=%d\n", filed[a].events, filed[a].fd,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "poll events = %d for fd=%d\n", filed[a].events, filed[a].fd,0);
 	}
 #endif /* DEBUG_POLL_AS_SELECT */
 
@@ -77,7 +77,7 @@ poll_using_select(struct my_pollfd *filed, int nfds, int timeout)
 
 #ifdef DEBUG_POLL_AS_SELECT
 	if( temp_events != 0 ){
-	    LDAPDebug(LDAP_DEBUG_ANY, "Unhandled poll event type=0x%x on FD(%d)\n",filed[a].events,filed[a].fd,0);
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Unhandled poll event type=0x%x on FD(%d)\n",filed[a].events,filed[a].fd,0);
 	}
 #endif /* DEBUG_POLL_AS_SELECT */
 
@@ -98,7 +98,7 @@ poll_using_select(struct my_pollfd *filed, int nfds, int timeout)
     if( retval <= 0 ) return( retval );
 
 #ifdef DEBUG_POLL_AS_SELECT
-    LDAPDebug(LDAP_DEBUG_ANY, "For\n",0,0,0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "For\n",0,0,0);
 #endif /* DEBUG_POLL_AS_SELECT */
 
     for( b=0; b<nfds;b++){
@@ -112,7 +112,7 @@ poll_using_select(struct my_pollfd *filed, int nfds, int timeout)
 
 #ifdef DEBUG_POLL_AS_SELECT
 	    if ((filed[b].events != 0) || (filed[b].revents != 0)) {
-	 	LDAPDebug(LDAP_DEBUG_ANY, "   file des=%d, events=0x%x, revents=0x%x\n", filed[b].fd, filed[b].events ,filed[b].revents);
+	 	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "   file des=%d, events=0x%x, revents=0x%x\n", filed[b].fd, filed[b].events ,filed[b].revents);
 	    }
 #endif /* DEBUG_POLL_AS_SELECT */
 	}
@@ -123,7 +123,7 @@ poll_using_select(struct my_pollfd *filed, int nfds, int timeout)
     }
 
 #ifdef DEBUG_POLL_AS_SELECT
-    LDAPDebug(LDAP_DEBUG_ANY, "poll returns %d (converted poll)\n",retval,0,0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "poll returns %d (converted poll)\n",retval,0,0);
 #endif /* DEBUG_POLL_AS_SELECT */
 
     return( retval );
diff --git a/ldap/servers/slapd/protect_db.c b/ldap/servers/slapd/protect_db.c
index 238f943..12507a1 100644
--- a/ldap/servers/slapd/protect_db.c
+++ b/ldap/servers/slapd/protect_db.c
@@ -164,7 +164,7 @@ make_sure_dir_exists(char *dir)
     if (PR_MkDir(dir, 0755) != PR_SUCCESS) {
         PRErrorCode prerr = PR_GetError();
         if (prerr != PR_FILE_EXISTS_ERROR) {
-            LDAPDebug(LDAP_DEBUG_ANY, FILE_CREATE_ERROR, dir, prerr, slapd_pr_strerror(prerr));
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, FILE_CREATE_ERROR, dir, prerr, slapd_pr_strerror(prerr));
             return 1;
         }
     }
@@ -175,10 +175,10 @@ make_sure_dir_exists(char *dir)
         pw = slapdFrontendConfig->localuserinfo;
         if (chown(dir, pw->pw_uid, -1) == -1) {
             if ((stat(dir, &stat_buffer) == 0) && (stat_buffer.st_uid != pw->pw_uid)) {
-                LDAPDebug(LDAP_DEBUG_ANY, CHOWN_WARNING, dir, 0, 0);
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, CHOWN_WARNING, dir, 0, 0);
                 return 1;
             } else {
-                LDAPDebug(LDAP_DEBUG_ANY, STAT_ERROR, dir, errno, 0);
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, STAT_ERROR, dir, errno, 0);
                 return 1;
             }
         }
@@ -203,7 +203,7 @@ add_this_process_to(char *dir_name)
     file_name[sizeof(file_name)-1] = (char)0;
     
     if ((prfd = PR_Open(file_name, PR_RDWR | PR_CREATE_FILE, 0644)) == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, FILE_CREATE_WARNING, file_name, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, FILE_CREATE_WARNING, file_name, 0, 0);
         return;
     }
     
@@ -214,7 +214,7 @@ add_this_process_to(char *dir_name)
         pw = slapdFrontendConfig->localuserinfo;
         if (chown(file_name, pw->pw_uid, -1) == -1) {
             if ((stat(file_name, &stat_buffer) == 0) && (stat_buffer.st_uid != pw->pw_uid)) {
-                LDAPDebug(LDAP_DEBUG_ANY, CHOWN_WARNING, file_name, 0, 0);
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, CHOWN_WARNING, file_name, 0, 0);
             }
         }
     }
@@ -388,10 +388,10 @@ add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
     case SLAPD_EXEMODE_SLAPD:
     if (running) {
         result = -1;
-        LDAPDebug(LDAP_DEBUG_ANY, NO_SERVER_DUE_TO_SERVER, running, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, NO_SERVER_DUE_TO_SERVER, running, 0, 0);
     } else if (importing) {
         result = -1;
-        LDAPDebug(LDAP_DEBUG_ANY, NO_SERVER_DUE_TO_IMPORT, importing, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, NO_SERVER_DUE_TO_IMPORT, importing, 0, 0);
     } else {
         add_this_process_to(server_dir);
         result = 0;
@@ -404,7 +404,7 @@ add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
          * it needs to run by itself, so no other slapd process can
          * change the database while it is running. */
         if (running || importing) {
-            LDAPDebug(LDAP_DEBUG_ANY, NO_DB2LDIFR_DUE_TO_USE, 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, NO_DB2LDIFR_DUE_TO_USE, 0, 0, 0);
             result = -1;
         } else {
             /* Even though this is really going to export code, we will 
@@ -415,7 +415,7 @@ add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
         }
     } else {
         if (importing) {
-            LDAPDebug(LDAP_DEBUG_ANY, NO_DB2LDIF_DUE_TO_IMPORT, importing, 0, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, NO_DB2LDIF_DUE_TO_IMPORT, importing, 0, 0);
             result = -1;        
         } else {
             add_this_process_to(export_dir);
@@ -425,7 +425,7 @@ add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
     break;
     case SLAPD_EXEMODE_DB2ARCHIVE:
     if (importing) {
-        LDAPDebug(LDAP_DEBUG_ANY, NO_DB2BAK_DUE_TO_IMPORT, importing, 0, 0);        
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, NO_DB2BAK_DUE_TO_IMPORT, importing, 0, 0);        
         result = -1;
     } else {
         add_this_process_to(export_dir);
@@ -435,7 +435,7 @@ add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
     case SLAPD_EXEMODE_ARCHIVE2DB:
     case SLAPD_EXEMODE_LDIF2DB:
     if (running || importing || exporting) {
-        LDAPDebug(LDAP_DEBUG_ANY, NO_IMPORT_DUE_TO_USE, 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, NO_IMPORT_DUE_TO_USE, 0, 0, 0);
         result = -1;
     } else {
         add_this_process_to(import_dir);
@@ -444,7 +444,7 @@ add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
     break;
     case SLAPD_EXEMODE_DB2INDEX:
         if (running || importing || exporting) {
-            LDAPDebug(LDAP_DEBUG_ANY, NO_DB2INDEX_DUE_TO_USE, 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, NO_DB2INDEX_DUE_TO_USE, 0, 0, 0);
             result = -1;
         } else {
             add_this_process_to(import_dir);
@@ -453,7 +453,7 @@ add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
         break;
     case SLAPD_EXEMODE_UPGRADEDB:
         if (running || importing || exporting) {
-            LDAPDebug(LDAP_DEBUG_ANY, NO_UPGRADEDB_DUE_TO_USE, 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, NO_UPGRADEDB_DUE_TO_USE, 0, 0, 0);
             result = -1;
         } else {
             add_this_process_to(import_dir);
@@ -462,7 +462,7 @@ add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
         break;
     case SLAPD_EXEMODE_UPGRADEDNFORMAT:
         if (running || importing || exporting) {
-            LDAPDebug(LDAP_DEBUG_ANY, NO_UPGRADEDNFORMAT_DUE_TO_USE, 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, NO_UPGRADEDNFORMAT_DUE_TO_USE, 0, 0, 0);
             result = -1;
         } else {
             add_this_process_to(import_dir);
@@ -471,7 +471,7 @@ add_new_slapd_process(int exec_mode, int r_flag, int skip_flag)
         break;
     case SLAPD_EXEMODE_DBTEST:
         if (running || importing || exporting) {
-            LDAPDebug(LDAP_DEBUG_ANY, NO_DBTEST_DUE_TO_USE, 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, NO_DBTEST_DUE_TO_USE, 0, 0, 0);
             result = -1;
         } else {
             add_this_process_to(import_dir);
diff --git a/ldap/servers/slapd/psearch.c b/ldap/servers/slapd/psearch.c
index e88bcb9..d2ee5c8 100644
--- a/ldap/servers/slapd/psearch.c
+++ b/ldap/servers/slapd/psearch.c
@@ -101,17 +101,17 @@ ps_init_psearch_system()
     if ( !PS_IS_INITIALIZED()) {
 	psearch_list = (PSearch_List *) slapi_ch_calloc( 1, sizeof( PSearch_List ));
 	if (( psearch_list->pl_rwlock = slapi_new_rwlock()) == NULL ) {
-	    LDAPDebug( LDAP_DEBUG_ANY, "init_psearch_list: cannot initialize lock structure. "
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "init_psearch_list: cannot initialize lock structure. "
 		    "The server is terminating.\n", 0, 0, 0 );
 	    exit( -1 );
 	}
 	if (( psearch_list->pl_cvarlock = PR_NewLock()) == NULL ) {
-	    LDAPDebug( LDAP_DEBUG_ANY, "init_psearch_list: cannot create new lock.  "
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "init_psearch_list: cannot create new lock.  "
 		    "The server is terminating.\n", 0, 0, 0 );
 	    exit( -1 );
 	}
 	if (( psearch_list->pl_cvar = PR_NewCondVar( psearch_list->pl_cvarlock )) == NULL ) {
-	    LDAPDebug( LDAP_DEBUG_ANY, "init_psearch_list: cannot create new condition variable.  "
+	    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "init_psearch_list: cannot create new condition variable.  "
 		    "The server is terminating.\n", 0, 0, 0 );
 	    exit( -1 );
 	}
@@ -182,7 +182,7 @@ ps_add( Slapi_PBlock *pb, ber_int_t changetypes, int send_entchg_controls )
        if(NULL == ps_tid){
             int prerr;
             prerr = PR_GetError(); 
-            LDAPDebug(LDAP_DEBUG_ANY,"persistent search PR_CreateThread()failed in the " 
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"persistent search PR_CreateThread()failed in the " 
                      "ps_add function: " SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
 					 prerr, slapd_pr_strerror(prerr), 0); 
    
@@ -438,7 +438,7 @@ psearch_alloc(void)
 
     ps->ps_pblock = NULL;
     if (( ps->ps_lock = PR_NewLock()) == NULL ) {
-	LDAPDebug( LDAP_DEBUG_ANY, "psearch_add: cannot create new lock.  "
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "psearch_add: cannot create new lock.  "
 		"Persistent search abandoned.\n", 0, 0, 0 );
 	slapi_ch_free((void **)&ps);
 	return( NULL );
@@ -582,7 +582,7 @@ ps_service_persistent_searches( Slapi_Entry *e, Slapi_Entry *eprev, ber_int_t ch
 							eprev ? slapi_entry_get_dn_const(eprev) : NULL,
 							&ctrl );
 					if ( rc != LDAP_SUCCESS ) {
-		   				LDAPDebug( LDAP_DEBUG_ANY, "ps_service_persistent_searches:"
+		   				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ps_service_persistent_searches:"
 						" unable to create EntryChangeNotification control for"
 						" entry \"%s\" -- control won't be sent.\n",
 						slapi_entry_get_dn_const(e), 0, 0 );
@@ -614,10 +614,10 @@ ps_service_persistent_searches( Slapi_Entry *e, Slapi_Entry *eprev, ber_int_t ch
 		ldap_control_free( ctrl );
 		/* Turn 'em loose */
 		ps_wakeup_all();
-		LDAPDebug( LDAP_DEBUG_TRACE, "ps_service_persistent_searches: enqueued entry "
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ps_service_persistent_searches: enqueued entry "
 			"\"%s\" on %d persistent search lists\n", slapi_entry_get_dn_const(e), matched, 0 );
 	} else {
-		LDAPDebug( LDAP_DEBUG_TRACE, "ps_service_persistent_searches: entry "
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ps_service_persistent_searches: entry "
 			"\"%s\" not enqueued on any persistent search lists\n", slapi_entry_get_dn_const(e), 0, 0 );
 	}
 
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index ed83ded..f040893 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -112,7 +112,7 @@ slapi_pw_find_sv(
 	char			*valpwd;
     int     		i;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> slapi_pw_find value: \"%s\"\n", slapi_value_get_string(v), 0, 0 ); /* JCM Innards */
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> slapi_pw_find value: \"%s\"\n", slapi_value_get_string(v), 0, 0 ); /* JCM Innards */
 
     for ( i = 0; vals && vals[i]; i++ )
     {
@@ -120,7 +120,7 @@ slapi_pw_find_sv(
 		if ( pwsp != NULL && 
 			(*(pwsp->pws_cmp))( (char*)slapi_value_get_string(v), valpwd ) == 0 ) /* JCM Innards*/
 		{
-			LDAPDebug( LDAP_DEBUG_TRACE,
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 			    "<= slapi_pw_find matched \"%s\" using scheme \"%s\"\n",
 			    valpwd, pwsp->pws_name, 0 );
 			free_pw_scheme( pwsp );
@@ -129,7 +129,7 @@ slapi_pw_find_sv(
 		free_pw_scheme( pwsp );
 	}
  
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_pw_find no matching password\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= slapi_pw_find no matching password\n", 0, 0, 0 );
 
     return( 1 );	/* no match */
 }
@@ -1324,7 +1324,7 @@ slapi_add_pwd_control ( Slapi_PBlock *pb, char *arg, long time) {
 	LDAPControl	new_ctrl;
 	char		buf[12];
 	
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> slapi_add_pwd_control\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> slapi_add_pwd_control\n", 0, 0, 0 );
 	
 	sprintf( buf, "%ld", time );
 	new_ctrl.ldctl_oid = arg;
@@ -1597,7 +1597,7 @@ pw_get_admin_users(passwdPolicy *pwp)
 	if (res != LDAP_SUCCESS) {
 		slapi_free_search_results_internal(pb);
 		slapi_pblock_destroy(pb);
-		LDAPDebug(LDAP_DEBUG_ANY, "pw_get_admin_users: search failed for %s: error %d - "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "pw_get_admin_users: search failed for %s: error %d - "
 		        "Password Policy Administrators can not be set\n",
 		        slapi_sdn_get_dn(sdn), res, 0);
 		return;
@@ -2077,7 +2077,7 @@ slapi_pwpolicy_make_response_control (Slapi_PBlock *pb, int seconds, int logins,
 			passwordInHistory     (8) } }
 	*/
 	
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> slapi_pwpolicy_make_response_control", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> slapi_pwpolicy_make_response_control", 0, 0, 0 );
 	if ( ( ber = ber_alloc()) == NULL )
 	{
 		return rc;
@@ -2123,7 +2123,7 @@ slapi_pwpolicy_make_response_control (Slapi_PBlock *pb, int seconds, int logins,
 		ber_bvfree(bvp);
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= slapi_pwpolicy_make_response_control (%d)", rc, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= slapi_pwpolicy_make_response_control (%d)", rc, 0, 0 );
 
 	return (rc==-1?LDAP_OPERATIONS_ERROR:LDAP_SUCCESS);
 }
diff --git a/ldap/servers/slapd/referral.c b/ldap/servers/slapd/referral.c
index 555e39a..a7e799e 100644
--- a/ldap/servers/slapd/referral.c
+++ b/ldap/servers/slapd/referral.c
@@ -46,7 +46,7 @@ g_get_global_referrals(void)
         global_referrals.ra_rwlock = slapi_new_rwlock();
       
         if (global_referrals.ra_rwlock == NULL) {
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
     		   "ref_array_init: new lock creation failed\n", 0, 0, 0);
         	exit (-1);
         }
@@ -238,7 +238,7 @@ ref_adjust( Slapi_PBlock *pb, struct berval **urls, const Slapi_DN *refsdn,
      */
 	if ( LDAPDebugLevelIsSet( LDAP_DEBUG_ARGS )) {
 	for ( i = 0; urlscopy[i] != NULL; ++i ) {
-	    LDAPDebug( LDAP_DEBUG_ARGS, "ref_adjust: \"%s\" -> \"%s\"\n",
+	    LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG, "ref_adjust: \"%s\" -> \"%s\"\n",
 		urls[i]->bv_val, urlscopy[i]->bv_val, 0 );
 	}
     }
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index 9a0b217..ad8983e 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -204,7 +204,7 @@ int send_ldap_intermediate( Slapi_PBlock *pb,  LDAPControl **ectrls,
 	int 		rc = 0;
 	int		logit = 0;
 			
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> send_ldap_intermediate\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> send_ldap_intermediate\n", 0, 0, 0 );
 	slapi_pblock_get (pb, SLAPI_OPERATION, &operation);
 	slapi_pblock_get (pb, SLAPI_CONNECTION, &connection);
 
@@ -213,7 +213,7 @@ int send_ldap_intermediate( Slapi_PBlock *pb,  LDAPControl **ectrls,
 	}
 	tag = LDAP_RES_INTERMEDIATE;
 	if ( (ber = der_alloc()) == NULL ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_alloc failed\n", 0, 0, 0 );
 		goto log_and_return;
 	}
 	/* add the intermediate message */
@@ -239,7 +239,7 @@ int send_ldap_intermediate( Slapi_PBlock *pb,  LDAPControl **ectrls,
 		rc = ber_put_seq( ber );
 	}
 	if ( rc == LBER_ERROR ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_printf failed 0\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_printf failed 0\n", 0, 0, 0 );
 		ber_free( ber, 1 /* freebuf */ );
 		goto log_and_return;
 	}
@@ -266,7 +266,7 @@ log_and_return:
 		log_result( pb, operation, rc, tag, 0 );
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= send_ldap_intermediate\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= send_ldap_intermediate\n", 0, 0, 0 );
 	return rc;
 }
 
@@ -385,7 +385,7 @@ send_ldap_result_ext(
 
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> send_ldap_result %d:%s:%s\n", err,
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> send_ldap_result %d:%s:%s\n", err,
 	    matched ? matched : "", text ? text : "" );
 
 	switch ( operation->o_tag ) {
@@ -444,7 +444,7 @@ send_ldap_result_ext(
         
 	if ( ber == NULL ) {
 	    if ( (ber = der_alloc()) == NULL ) {
-	        LDAPDebug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
+	        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_alloc failed\n", 0, 0, 0 );
 			goto log_and_return;
 	    }
 	}
@@ -598,7 +598,7 @@ send_ldap_result_ext(
 	}
 
 	if ( rc == LBER_ERROR ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_printf failed 1\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_printf failed 1\n", 0, 0, 0 );
                 if (flush_ber_element == 1) {
                     /* we alloced the ber */
                     ber_free( ber, 1 /* freebuf */ );
@@ -622,7 +622,7 @@ log_and_return:
 		log_result( pb, operation, err, tag, nentries );
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= send_ldap_result\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= send_ldap_result\n", 0, 0, 0 );
 }
 
 /*
@@ -665,7 +665,7 @@ process_read_entry_controls(Slapi_PBlock *pb, char *oid)
                 slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &e);
             } else {
                 /* Ok, read control not used for this type of operation */
-            	LDAPDebug( LDAP_DEBUG_ANY, "process_read_entry_controls: Read Entry Controls "
+            	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "process_read_entry_controls: Read Entry Controls "
             	        "can not be used for a %s operation.\n", op_to_string(op->o_tag), 0, 0);
                 rc = -1;
                 goto done;
@@ -677,14 +677,14 @@ process_read_entry_controls(Slapi_PBlock *pb, char *oid)
                 slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &e);
             } else {
                 /* Ok, read control not used for this type of operation */
-            	LDAPDebug( LDAP_DEBUG_ANY, "process_read_entry_controls: Read Entry Controls "
+            	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "process_read_entry_controls: Read Entry Controls "
                         "can not be used for a %s operation.\n", op_to_string(op->o_tag), 0, 0);
                 rc = -1;
                 goto done;
             }
         }
         if(e == NULL){
-            LDAPDebug( LDAP_DEBUG_ANY, "process_read_entry_controls: unable to retrieve entry\n",0,0,0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "process_read_entry_controls: unable to retrieve entry\n",0,0,0);
             rc = -1;
             goto done;
         }
@@ -694,7 +694,7 @@ process_read_entry_controls(Slapi_PBlock *pb, char *oid)
         if ( plugin_call_acl_plugin (pb, e, attrs, NULL, SLAPI_ACL_READ,
             ACLPLUGIN_ACCESS_READ_ON_ENTRY, NULL ) != LDAP_SUCCESS )
         {
-            LDAPDebug( LDAP_DEBUG_ACL, "process_read_entry_controls: access to entry not allowed (%s)\n",
+            LDAPDebug(LDAP_DEBUG_ACL, LOG_DEBUG, "process_read_entry_controls: access to entry not allowed (%s)\n",
                 slapi_entry_get_dn_const(e), 0, 0 );
             rc = -1;
             goto done;
@@ -734,7 +734,7 @@ process_read_entry_controls(Slapi_PBlock *pb, char *oid)
             }
             if(no_attrs && (all_attrs || attr_count)){
                 /* Can't have both no attrs and some attributes */
-                LDAPDebug( LDAP_DEBUG_ANY, "process_read_entry_controls: Error, both no attributes \"1.1\" and "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "process_read_entry_controls: Error, both no attributes \"1.1\" and "
                     "specific attributes were requeseted.\n", 0, 0, 0 );
                 rc = -1;
                 goto free;
@@ -746,7 +746,7 @@ process_read_entry_controls(Slapi_PBlock *pb, char *oid)
             }
         } else {
             /* this is a problem, malformed request control value */
-            LDAPDebug( LDAP_DEBUG_ANY, "process_read_entry_controls: invalid control value.\n",0,0,0);
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "process_read_entry_controls: invalid control value.\n",0,0,0);
             rc = -1;
             goto free;
         }
@@ -765,7 +765,7 @@ process_read_entry_controls(Slapi_PBlock *pb, char *oid)
             ber_bvfree(res_value);
         } else {
             /* failed to encode the result entry */
-            LDAPDebug( LDAP_DEBUG_ANY, "Failed to process READ ENTRY Control (%s), error encoding result entry\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to process READ ENTRY Control (%s), error encoding result entry\n",
                         oid, 0, 0 );
             rc = -1;
         }
@@ -776,7 +776,7 @@ free:
         }
         if(rc != 0){
             /* log an error */
-            LDAPDebug( LDAP_DEBUG_ANY, "Failed to process READ ENTRY Control (%s) ber decoding error\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to process READ ENTRY Control (%s) ber decoding error\n",
                         oid, 0, 0 );
         }
     }
@@ -818,7 +818,7 @@ send_ldapv3_referral(
 
 	slapi_pblock_get (pb, SLAPI_OPERATION, &operation);
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> send_ldapv3_referral\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> send_ldapv3_referral\n", 0, 0, 0 );
 	
 	if ( conn == NULL ) {
 		if ( operation->o_search_referral_handler != NULL ) {
@@ -835,7 +835,7 @@ send_ldapv3_referral(
 	}
 
 	if ( (ber = der_alloc()) == NULL ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_alloc failed\n", 0, 0, 0 );
 		send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL,
 		    "ber_alloc", 0, NULL );
 		return( -1 );
@@ -860,13 +860,13 @@ send_ldapv3_referral(
 		rc = ber_printf( ber, "s", urls[i]->bv_val );
 	}
 	if ( rc == LBER_ERROR ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_printf failed 2\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_printf failed 2\n", 0, 0, 0 );
 		send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL,
 		    "ber_printf", 0, NULL );
 		return( -1 );
 	}
 	if ( ber_printf( ber, "}}" ) == LBER_ERROR ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_printf failed 3\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_printf failed 3\n", 0, 0, 0 );
 		send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL,
 		    "ber_printf", 0, NULL );
 		return( -1 );
@@ -983,7 +983,7 @@ encode_attr_2(
 #endif
 
 	if (ber_printf(ber, "{s[", returned_type?returned_type:attribute_type) == -1) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_printf failed 4\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_printf failed 4\n", 0, 0, 0 );
 		ber_free( ber, 1 );
 		send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL,
 		                 "ber_printf type", 0, NULL);
@@ -996,7 +996,7 @@ encode_attr_2(
 		{
 			if ( ber_printf( ber, "o", v->bv.bv_val,v->bv.bv_len ) == -1 )
 			{
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				    "ber_printf failed 5\n", 0, 0, 0 );
 				ber_free( ber, 1 );
 				send_ldap_result( pb, LDAP_OPERATIONS_ERROR,
@@ -1008,7 +1008,7 @@ encode_attr_2(
 	}
 
 	if ( ber_printf( ber, "]}" ) == -1 ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_printf failed 6\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_printf failed 6\n", 0, 0, 0 );
 		ber_free( ber, 1 );
 		send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL,
 		    "ber_printf type end", 0, NULL );
@@ -1491,7 +1491,7 @@ send_ldap_search_entry_ext(
 
 	slapi_pblock_get (pb, SLAPI_OPERATION, &operation);
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "=> send_ldap_search_entry (%s)\n",
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> send_ldap_search_entry (%s)\n",
 	    e ? slapi_entry_get_dn_const(e) : "null", 0, 0 );
 
 	/* set current entry */
@@ -1502,7 +1502,7 @@ send_ldap_search_entry_ext(
 	/* call pre entry fn */
 	rc = plugin_call_plugins(pb, SLAPI_PLUGIN_PRE_ENTRY_FN);
 	if (rc) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				   "error returned by pre entry plugins for entry %s\n",
 				   e?slapi_entry_get_dn_const(e):"null", 0, 0 );
 		goto cleanup;
@@ -1531,7 +1531,7 @@ send_ldap_search_entry_ext(
 #if !defined(DISABLE_ACL_CHECK)
 	if ( e && plugin_call_acl_plugin (pb, e, attrs, NULL, 
 				    SLAPI_ACL_READ, ACLPLUGIN_ACCESS_READ_ON_ENTRY, NULL ) != LDAP_SUCCESS ) {
-		LDAPDebug( LDAP_DEBUG_ACL, "acl: access to entry not allowed\n",
+		LDAPDebug(LDAP_DEBUG_ACL, LOG_DEBUG, "acl: access to entry not allowed\n",
 		    0, 0, 0 );
 		rc = 1;
 		goto cleanup;
@@ -1544,7 +1544,7 @@ send_ldap_search_entry_ext(
 	}
 
 	if ( (ber = der_alloc()) == NULL ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_alloc failed\n", 0, 0, 0 );
 		send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL,
 		    "ber_alloc", 0, NULL );
 		rc = -1;
@@ -1555,7 +1555,7 @@ send_ldap_search_entry_ext(
 	    LDAP_RES_SEARCH_ENTRY, slapi_entry_get_dn_const(e) );
 
 	if ( rc == -1 ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_printf failed 7\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_printf failed 7\n", 0, 0, 0 );
 		send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL,
 		    "ber_printf dn", 0, NULL );
 		goto cleanup;
@@ -1594,7 +1594,7 @@ send_ldap_search_entry_ext(
 			 * and some other stuff. this is not allowed, but
 			 * what should we do? we'll allow them to keep going.
 			 */
-			LDAPDebug( LDAP_DEBUG_TRACE,
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 			    "Accepting illegal other attributes specified with "
 			    "special \"1.1\" attribute\n", 0, 0, 0 );
 		}
@@ -1673,7 +1673,7 @@ send_ldap_search_entry_ext(
 	}
 
 	if ( rc == -1 ) {
-		LDAPDebug( LDAP_DEBUG_ANY, "ber_printf failed 8\n", 0, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ber_printf failed 8\n", 0, 0, 0 );
 		send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL,
 		    "ber_printf entry end", 0, NULL );
 		goto cleanup;
@@ -1736,7 +1736,7 @@ cleanup:
 		ldap_controls_free(searchctrlp);
 	}
 	ber_free( ber, 1 );
-	LDAPDebug( LDAP_DEBUG_TRACE, "<= send_ldap_search_entry\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= send_ldap_search_entry\n", 0, 0, 0 );
 
 	return( rc );
 }
@@ -1776,7 +1776,7 @@ flush_ber(
 	}
 
 	if ((conn->c_flags & CONN_FLAG_CLOSING) || slapi_op_abandoned(pb)) {
-	    LDAPDebug(LDAP_DEBUG_CONNS, "ber_flush skipped because the "
+	    LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG, "ber_flush skipped because the "
 		      "connection was marked to be closed or abandoned\n", 0, 0, 0);
 			ber_free( ber, 1 );
 			/* One of the failure can be because the client has reset the connection ( closed )
@@ -1796,7 +1796,7 @@ flush_ber(
 			 * and the status needs to be updated to reflect it */
 			op->o_status = SLAPI_OP_STATUS_ABANDONED;
 			
-			LDAPDebug( LDAP_DEBUG_CONNS,
+			LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
 				"ber_flush failed, error %d (%s)\n",
 				oserr, slapd_system_strerror( oserr ), 0 );
 			if (op->o_flags & OP_FLAG_PS) {
@@ -1811,7 +1811,7 @@ flush_ber(
 			ber_free( ber, 1 );
 		} else {
 			PRUint64 b;
-			LDAPDebug( LDAP_DEBUG_BER,
+			LDAPDebug(LDAP_DEBUG_BER, LOG_DEBUG,
 				"flush_ber() wrote %u bytes to socket %d\n",
 				bytes, conn->c_sd, 0 );
 			LL_I2L ( b, bytes ) ;
@@ -2221,7 +2221,7 @@ encode_read_entry (Slapi_PBlock *pb, Slapi_Entry *e, char **attrs, int alluserat
             real_attrs_only = SLAPI_SEND_VATTR_FLAG_VIRTUALONLY;
         } else {
             /* we cannot service a request for virtual only and real only */
-            LDAPDebug( LDAP_DEBUG_ANY,"encode_read_entry: Error, both real and virtual attributes "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"encode_read_entry: Error, both real and virtual attributes "
                                       "only controls requested.\n", 0, 0, 0 );
             rc = -1;
             goto cleanup;
diff --git a/ldap/servers/slapd/sasl_io.c b/ldap/servers/slapd/sasl_io.c
index 12fec85..0748a63 100644
--- a/ldap/servers/slapd/sasl_io.c
+++ b/ldap/servers/slapd/sasl_io.c
@@ -80,7 +80,7 @@ debug_print_layers(PRFileDesc *fd)
         LDAPDebug2Args( LDAP_DEBUG_CONNS,
                        "debug_print_layers: fd %d sasl_io_recv = %p\n",
                         PR_FileDesc2NativeHandle(fd), sasl_io_recv );
-        LDAPDebug( LDAP_DEBUG_CONNS,
+        LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                    "debug_print_layers: fd name %s type = %d recv = %p\n",
                    PR_GetNameForIdentity(fd->identity),
                    PR_GetDescType(fd),
@@ -197,7 +197,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
     debug_print_layers(fd);
     /* first we need the length bytes */
     ret = PR_Recv(fd->lower, buffer, amount, flags, timeout);
-    LDAPDebug( LDAP_DEBUG_CONNS,
+    LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
            "sasl_io_start_packet: read sasl packet length returned %d on connection %" NSPRIu64 "\n",
            ret, c->c_connid, 0 );
     if (ret <= 0) {
@@ -207,7 +207,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
                    "sasl_io_start_packet: connection closed while reading sasl packet length on connection %" NSPRIu64 "\n",
                    c->c_connid );
         } else {
-            LDAPDebug( LDAP_DEBUG_CONNS,
+            LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                    "sasl_io_start_packet: error reading sasl packet length on connection %" NSPRIu64 " %d:%s\n",
                    c->c_connid, *err, slapd_pr_strerror(*err) );
         }
@@ -303,7 +303,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
                 PR_SetError(PR_WOULD_BLOCK_ERROR, errno);
                 return PR_FAILURE;
             } else if (ret > 0) {
-                LDAPDebug( LDAP_DEBUG_CONNS,
+                LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                         "Continued: read sasl packet length returned %d on connection %" NSPRIu64 "\n",
                         ret, c->c_connid, 0 );
                 if((ret + sp->encrypted_buffer_offset) > sp->encrypted_buffer_size){
@@ -313,7 +313,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
                 sp->encrypted_buffer_offset += ret;
             } else if (ret < 0){
                 *err = PR_GetError();
-                LDAPDebug( LDAP_DEBUG_CONNS, "sasl_io_start_packet: error reading sasl packet length on connection "
+                LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG, "sasl_io_start_packet: error reading sasl packet length on connection "
                         "%" NSPRIu64 " %d:%s\n", c->c_connid, *err, slapd_pr_strerror(*err) );
                 return ret;
             }
@@ -440,7 +440,7 @@ sasl_io_read_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt3
             LDAPDebug1Arg( LDAP_DEBUG_CONNS,
                        "sasl_io_read_packet: connection closed while reading sasl packet on connection %" NSPRIu64 "\n", c->c_connid );
         } else {
-            LDAPDebug( LDAP_DEBUG_CONNS,
+            LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                        "sasl_io_read_packet: error reading sasl packet on connection %" NSPRIu64 " %d:%s\n", c->c_connid, *err, slapd_pr_strerror(*err) );
         }
         return ret;
@@ -461,9 +461,9 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags,
 
     /* Do we have decrypted data buffered from 'before' ? */
     bytes_in_buffer = sp->decrypted_buffer_count - sp->decrypted_buffer_offset;
-    LDAPDebug( LDAP_DEBUG_CONNS,
+    LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                "sasl_io_recv for connection %" NSPRIu64 " len %d bytes_in_buffer %d\n", c->c_connid, len, bytes_in_buffer );
-    LDAPDebug( LDAP_DEBUG_CONNS,
+    LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                "sasl_io_recv for connection %" NSPRIu64 " len %d encrypted buffer count %d\n", c->c_connid, len, sp->encrypted_buffer_count );
     if (0 == bytes_in_buffer) {
         /* If there wasn't buffered decrypted data, we need to get some... */
@@ -497,7 +497,7 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags,
          * when more data arrives
          */
         if (!sasl_io_finished_packet(sp)) {
-            LDAPDebug( LDAP_DEBUG_CONNS,
+            LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                        "sasl_io_recv for connection %" NSPRIu64 " - not finished reading packet yet\n", c->c_connid, 0, 0 );
 #if defined(EWOULDBLOCK)
             errno = EWOULDBLOCK;
@@ -551,7 +551,7 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags,
                        "sasl_io_recv all decrypted data returned for connection %" NSPRIu64 "\n", c->c_connid );
         } else {
             sp->decrypted_buffer_offset += bytes_to_return;
-            LDAPDebug( LDAP_DEBUG_CONNS,
+            LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                        "sasl_io_recv returning %d bytes to caller %d bytes left to return for connection %" NSPRIu64 "\n",
                        bytes_to_return,
                        sp->decrypted_buffer_count - sp->decrypted_buffer_offset,
@@ -769,10 +769,10 @@ sasl_io_enable(Connection *c, void *data /* UNUSED */)
         sp->conn = c;
         rv = PR_PushIOLayer(c->c_prfd, PR_TOP_IO_LAYER, layer);
         if (rv) {
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                        "sasl_io_enable: error enabling sasl io on connection %" NSPRIu64 " %d:%s\n", c->c_connid, rv, slapd_pr_strerror(rv) );
         } else {
-            LDAPDebug( LDAP_DEBUG_CONNS,
+            LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                        "sasl_io_enable: enabled sasl io on connection %" NSPRIu64 " \n", c->c_connid, 0, 0 );
             debug_print_layers(c->c_prfd);
         }
@@ -790,7 +790,7 @@ sasl_io_cleanup(Connection *c, void *data /* UNUSED */)
 {
     int ret = 0;
 
-    LDAPDebug( LDAP_DEBUG_CONNS,
+    LDAPDebug(LDAP_DEBUG_CONNS, LOG_DEBUG,
                "sasl_io_cleanup for connection %" NSPRIu64 "\n", c->c_connid, 0, 0 );
 
     ret = sasl_pop_IO_layer(c->c_prfd, 0 /* do not close */);
diff --git a/ldap/servers/slapd/sasl_map.c b/ldap/servers/slapd/sasl_map.c
index 7cc07ca..6b67e1d 100644
--- a/ldap/servers/slapd/sasl_map.c
+++ b/ldap/servers/slapd/sasl_map.c
@@ -367,10 +367,10 @@ sasl_map_config_parse_entry(Slapi_Entry *entry, sasl_map_data **new_dp)
 		desc.bv_len = strlen(desc.bv_val);
 		newval[0] = &desc;
 		if (entry_replace_values(entry, "nsSaslMapPriority", newval) != 0){
-			LDAPDebug( LDAP_DEBUG_ANY, "sasl_map_config_parse_entry: failed to reset entry "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sasl_map_config_parse_entry: failed to reset entry "
 					"priority to (%d) - previous value (%s)\n", LOW_PRIORITY,  priority_str, 0);
 		} else {
-			LDAPDebug( LDAP_DEBUG_ANY, "sasl_map_config_parse_entry: resetting invalid nsSaslMapPriority "
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sasl_map_config_parse_entry: resetting invalid nsSaslMapPriority "
 					" value (%s) to the lowest priority (%d)\n",
 					priority_str, LOW_PRIORITY, 0);
 		}
@@ -402,34 +402,34 @@ sasl_map_read_config_startup(sasl_map_private *priv)
 	char **map_entry_list = NULL;
 	int ret = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "-> sasl_map_read_config_startup\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "-> sasl_map_read_config_startup\n", 0, 0, 0 );
     if((map_entry_list = getChildren(configDN))) {
 		char **map_entry = NULL;
 		Slapi_Entry *entry = NULL;
 		sasl_map_data *dp = NULL;
 
 		for (map_entry = map_entry_list; *map_entry && !ret; map_entry++) {
-			LDAPDebug( LDAP_DEBUG_CONFIG, "sasl_map_read_config_startup - proceesing [%s]\n", *map_entry, 0, 0 );
+			LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "sasl_map_read_config_startup - proceesing [%s]\n", *map_entry, 0, 0 );
  			getConfigEntry( *map_entry, &entry );
 			if ( entry == NULL ) {
 				continue;
 			}
 			ret = sasl_map_config_parse_entry(entry,&dp);
 			if (ret) {
-				    LDAPDebug( LDAP_DEBUG_ANY, "sasl_map_read_config_startup failed to parse entry\n", 0, 0, 0 );
+				    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sasl_map_read_config_startup failed to parse entry\n", 0, 0, 0 );
 			} else {
 				ret = sasl_map_insert_list_entry(priv,dp);
 				if (ret) {
-					LDAPDebug( LDAP_DEBUG_ANY, "sasl_map_read_config_startup failed to insert entry\n", 0, 0, 0 );
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sasl_map_read_config_startup failed to insert entry\n", 0, 0, 0 );
 				} else {
-					LDAPDebug( LDAP_DEBUG_CONFIG, "sasl_map_read_config_startup - processed [%s]\n", *map_entry, 0, 0 );
+					LDAPDebug(LDAP_DEBUG_CONFIG, LOG_DEBUG, "sasl_map_read_config_startup - processed [%s]\n", *map_entry, 0, 0 );
 				}
 			}
 			freeConfigEntry( &entry );
 		}
 		freeChildren( map_entry_list );
     }
-	LDAPDebug( LDAP_DEBUG_TRACE, "<- sasl_map_read_config_startup\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<- sasl_map_read_config_startup\n", 0, 0, 0 );
 	return ret;
 }
 
@@ -439,7 +439,7 @@ sasl_map_config_add(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e,
 	int ret = 0;
 	sasl_map_data *dp = NULL;
 	sasl_map_private *priv = sasl_map_get_global_priv();
-	LDAPDebug( LDAP_DEBUG_TRACE, "-> sasl_map_config_add\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "-> sasl_map_config_add\n", 0, 0, 0 );
 	ret = sasl_map_config_parse_entry(entryBefore,&dp);
 	if (!ret && dp) {
 		ret = sasl_map_insert_list_entry(priv,dp);
@@ -451,7 +451,7 @@ sasl_map_config_add(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e,
 		*returncode = LDAP_UNWILLING_TO_PERFORM;
 		ret = SLAPI_DSE_CALLBACK_ERROR;
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<- sasl_map_config_add\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<- sasl_map_config_add\n", 0, 0, 0 );
 	return ret;
 }
 
@@ -464,7 +464,7 @@ sasl_map_config_modify(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry*
 	int ret = SLAPI_DSE_CALLBACK_ERROR;
 
 	if((map_name = slapi_entry_attr_get_charptr( entryBefore, "cn" )) == NULL){
-		LDAPDebug( LDAP_DEBUG_TRACE, "sasl_map_config_modify: could not find name of map\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl_map_config_modify: could not find name of map\n",0,0,0);
 		return ret;
 	}
 	if(sasl_map_remove_list_entry(priv, map_name) == 0){
@@ -477,7 +477,7 @@ sasl_map_config_modify(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry*
 		}
 	}
 	if(ret == SLAPI_DSE_CALLBACK_ERROR){
-		LDAPDebug( LDAP_DEBUG_TRACE, "sasl_map_config_modify: failed to update map(%s)\n",map_name,0,0);
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl_map_config_modify: failed to update map(%s)\n",map_name,0,0);
 	}
 	slapi_ch_free_string(&map_name);
 
@@ -491,7 +491,7 @@ sasl_map_config_delete(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry*
 	sasl_map_private *priv = sasl_map_get_global_priv();
 	char *entry_name = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "-> sasl_map_config_delete\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "-> sasl_map_config_delete\n", 0, 0, 0 );
 	entry_name = slapi_entry_attr_get_charptr( entryBefore, "cn" );
 	if (entry_name) {
 		/* remove this entry from the list */
@@ -505,7 +505,7 @@ sasl_map_config_delete(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry*
 	} else {
 		ret = SLAPI_DSE_CALLBACK_OK;
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<- sasl_map_config_delete\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<- sasl_map_config_delete\n", 0, 0, 0 );
 	return ret;
 }
 
@@ -561,17 +561,17 @@ sasl_map_check(sasl_map_data *dp, char *sasl_user_and_realm, char **ldap_search_
 	int matched = 0;
 	const char *recomp_result = NULL;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "-> sasl_map_check\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "-> sasl_map_check\n", 0, 0, 0 );
 	/* Compiles the regex */
 	re = slapi_re_comp(dp->regular_expression, &recomp_result);
 	if (NULL == re) {
-		LDAPDebug( LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 			"sasl_map_check: slapi_re_comp failed for expression (%s): %s\n",
 			dp->regular_expression, recomp_result?recomp_result:"unknown", 0 );
 	} else {
 		/* Matches the compiled regex against sasl_user_and_realm */
 		matched = slapi_re_exec(re, sasl_user_and_realm, -1 /* no timelimit */);
-		LDAPDebug( LDAP_DEBUG_TRACE, "regex: %s, id: %s, %s\n",
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "regex: %s, id: %s, %s\n",
 			dp->regular_expression, sasl_user_and_realm,
 			matched ? "matched" : "didn't match" );
 	}
@@ -598,7 +598,7 @@ sasl_map_check(sasl_map_data *dp, char *sasl_user_and_realm, char **ldap_search_
 			rc = slapi_re_subs(re, sasl_user_and_realm, dp->template_base_dn,
 					ldap_search_base, ldap_search_base_len);
 			if (0 != rc) {
-				LDAPDebug( LDAP_DEBUG_ANY,
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 					"sasl_map_check: slapi_re_subs failed: "
 					"subject: %s, subst str: %s (%d)\n",
 					sasl_user_and_realm, dp->template_base_dn, rc);
@@ -610,7 +610,7 @@ sasl_map_check(sasl_map_data *dp, char *sasl_user_and_realm, char **ldap_search_
 					dp->template_search_filter, ldap_search_filter,
 					ldap_search_filter_len, 1);
 				if (0 != rc) {
-					LDAPDebug( LDAP_DEBUG_ANY,
+					LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 						"sasl_map_check: slapi_re_subs failed: "
 						"subject: %s, subst str: %s (%d)\n",
 						sasl_user_and_realm, dp->template_search_filter, rc);
@@ -619,7 +619,7 @@ sasl_map_check(sasl_map_data *dp, char *sasl_user_and_realm, char **ldap_search_
 				} else {
 					/* these values are internal regex representations with
 					 * lots of unprintable control chars - escape for logging */
-					LDAPDebug( LDAP_DEBUG_TRACE,
+					LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 						"mapped base dn: %s, filter: %s\n",
 						escape_string( *ldap_search_base, escape_base ),
 						escape_string( *ldap_search_filter, escape_filt ), 0 );
@@ -627,14 +627,14 @@ sasl_map_check(sasl_map_data *dp, char *sasl_user_and_realm, char **ldap_search_
 				}
 			}
 		} else {
-			LDAPDebug( LDAP_DEBUG_ANY,
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"sasl_map_check: slapi_re_exec failed: "
 				"regex: %s, subject: %s (%d)\n",
 				dp->regular_expression, sasl_user_and_realm, matched);
 		}
 	}
 	slapi_re_free(re);
-	LDAPDebug( LDAP_DEBUG_TRACE, "<- sasl_map_check\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<- sasl_map_check\n", 0, 0, 0 );
 	return ret;
 }
 
@@ -660,9 +660,9 @@ sasl_map_domap(sasl_map_data **map, char *sasl_user, char *sasl_realm, char **ld
 	char *sasl_user_and_realm = NULL;
 	int ret = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "-> sasl_map_domap\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "-> sasl_map_domap\n", 0, 0, 0 );
 	if(map == NULL){
-		LDAPDebug( LDAP_DEBUG_TRACE, "<- sasl_map_domap: Internal error, mapping is NULL\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<- sasl_map_domap: Internal error, mapping is NULL\n",0,0,0);
 		return ret;
 	}
 	*ldap_search_base = NULL;
@@ -673,7 +673,7 @@ sasl_map_domap(sasl_map_data **map, char *sasl_user, char *sasl_realm, char **ld
 		*map = priv->map_data_list;
 	while (*map) {
 		/* If one matches, then make the search params */
-		LDAPDebug( LDAP_DEBUG_TRACE, "sasl_map_domap - trying map [%s]\n", (*map)->name, 0, 0 );
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl_map_domap - trying map [%s]\n", (*map)->name, 0, 0 );
 		if((ret = sasl_map_check(*map, sasl_user_and_realm, ldap_search_base, ldap_search_filter))){
 			*map = sasl_map_next(*map);
 			break;
@@ -683,7 +683,7 @@ sasl_map_domap(sasl_map_data **map, char *sasl_user, char *sasl_realm, char **ld
 	if (sasl_user_and_realm) {
 		slapi_ch_free((void**)&sasl_user_and_realm);
 	}
-	LDAPDebug( LDAP_DEBUG_TRACE, "<- sasl_map_domap (%s)\n", (1 == ret) ? "mapped" : "not mapped", 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<- sasl_map_domap (%s)\n", (1 == ret) ? "mapped" : "not mapped", 0, 0 );
 	return ret;
 }
 
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
index 0914b97..c84fafc 100644
--- a/ldap/servers/slapd/saslbind.c
+++ b/ldap/servers/slapd/saslbind.c
@@ -150,7 +150,7 @@ static int ids_sasl_getopt(
 {
     unsigned tmplen;
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "ids_sasl_getopt: plugin=%s option=%s\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ids_sasl_getopt: plugin=%s option=%s\n",
               plugin_name ? plugin_name : "", option, 0);
 
     if (len == NULL) len = &tmplen;
@@ -195,7 +195,7 @@ static int ids_sasl_log(
     case SASL_LOG_TRACE:        /* traces of internal protocols */
     case SASL_LOG_PASS:         /* traces of internal protocols, including
                                  * passwords */
-        LDAPDebug(LDAP_DEBUG_TRACE, "sasl(%d): %s\n", level, message, 0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl(%d): %s\n", level, message, 0);
         break;
 
     case SASL_LOG_NONE:         /* don't log anything */
@@ -220,12 +220,12 @@ static void ids_sasl_user_search(
     Slapi_PBlock *pb = NULL;
     int i, ret;
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "sasl user search basedn=\"%s\" filter=\"%s\"\n", basedn, filter, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl user search basedn=\"%s\" filter=\"%s\"\n", basedn, filter, 0);
 
     /* TODO: set size and time limits */
     pb = slapi_pblock_new();
     if (!pb) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "null pblock for search_internal_pb\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "null pblock for search_internal_pb\n", 0, 0, 0);
         goto out;
     }
 
@@ -236,7 +236,7 @@ static void ids_sasl_user_search(
 
     slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
     if (ret != LDAP_SUCCESS) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "sasl user search failed basedn=\"%s\" "
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl user search failed basedn=\"%s\" "
                   "filter=\"%s\": %s\n", 
                   basedn, filter, ldap_err2string(ret));
         goto out;
@@ -244,7 +244,7 @@ static void ids_sasl_user_search(
 
     slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
     if ((entries == NULL) || (entries[0] == NULL)) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "sasl user search found no entries\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl user search found no entries\n",
                   0, 0, 0);
         goto out;
     }
@@ -255,7 +255,7 @@ static void ids_sasl_user_search(
             slapi_entry_free(*ep);
         }
         *ep = slapi_entry_dup(entries[i]);
-        LDAPDebug(LDAP_DEBUG_TRACE, "sasl user search found dn=%s\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl user search found dn=%s\n",
                   slapi_entry_get_dn(*ep), 0, 0);
     }
 
@@ -292,11 +292,11 @@ static Slapi_Entry *ids_sasl_user_to_entry(
     /* Check for wildcards in the authid and realm. If we encounter one,
      * just fail the mapping without performing a costly internal search. */
     if (user && strchr(user, '*')) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "sasl user search encountered a wildcard in "
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl user search encountered a wildcard in "
             "the authid.  Not attempting to map to entry. (authid=%s)\n", user, 0, 0);
         return NULL;
     } else if (user_realm && strchr(user_realm, '*')) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "sasl user search encountered a wildcard in "
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl user search encountered a wildcard in "
             "the realm.  Not attempting to map to entry. (realm=%s)\n", user_realm, 0, 0);
         return NULL;
     }
@@ -310,13 +310,13 @@ static Slapi_Entry *ids_sasl_user_to_entry(
                                  ctrls, attrs, attrsonly,
                                  &entry, &found);
             if (found == 1) {
-                LDAPDebug(LDAP_DEBUG_TRACE, "sasl user search found this entry: dn:%s, "
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl user search found this entry: dn:%s, "
                     "matching filter=%s\n", entry->e_sdn.dn, filter, 0);
             } else if (found == 0) {
-                LDAPDebug(LDAP_DEBUG_TRACE, "sasl user search found no entries matching "
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl user search found no entries matching "
                     "filter=%s\n", filter, 0, 0);
             } else {
-                LDAPDebug(LDAP_DEBUG_TRACE, "sasl user search found more than one entry "
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl user search found more than one entry "
                     "matching filter=%s\n", filter, 0, 0);
                 if (entry) {
                     slapi_entry_free(entry);
@@ -378,7 +378,7 @@ static int ids_sasl_canon_user(
     if (user == NULL) {
         goto fail;
     } 
-    LDAPDebug(LDAP_DEBUG_TRACE, 
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
               "ids_sasl_canon_user(user=%s, realm=%s)\n", 
               user, user_realm ? user_realm : "", 0);
 
@@ -425,11 +425,11 @@ static int ids_sasl_canon_user(
      * property determines what the bind identity will be if authentication succeeds. */
     if (strcasecmp(mech, "ANONYMOUS") == 0) {
         if (prop_set(propctx, "dn", "", -1) != 0) {
-            LDAPDebug(LDAP_DEBUG_TRACE, "prop_set(dn) failed\n", 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "prop_set(dn) failed\n", 0, 0, 0);
             goto fail;
         }
     } else if (prop_set(propctx, "dn", dn, -1) != 0) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "prop_set(dn) failed\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "prop_set(dn) failed\n", 0, 0, 0);
         goto fail;
     }
 
@@ -442,7 +442,7 @@ static int ids_sasl_canon_user(
              * Any SASL mechanism that actually needs the
              * password is going to fail.  We should print a warning
              * to aid in troubleshooting. */
-            LDAPDebug(LDAP_DEBUG_TRACE, "Warning: Detected a sasl bind attempt by an "
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "Warning: Detected a sasl bind attempt by an "
                       "entry whose password is stored in a non-cleartext format.  This "
                       "will not work for mechanisms which require a cleartext password "
                       "such as DIGEST-MD5 and CRAM-MD5.\n", 0, 0, 0);
@@ -463,13 +463,13 @@ static int ids_sasl_canon_user(
 #ifdef SASL_AUX_PASSWORD_PROP
         if (prop_set(propctx, SASL_AUX_PASSWORD_PROP, clear, -1) != 0) {
             /* Failure is benign here because some mechanisms don't support this property */
-            /*LDAPDebug(LDAP_DEBUG_TRACE, "prop_set(userpassword) failed\n", 0, 0, 0);
+            /*LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "prop_set(userpassword) failed\n", 0, 0, 0);
             goto fail */ ;
         }
 #endif /* SASL_AUX_PASSWORD_PROP */
         if (prop_set(propctx, SASL_AUX_PASSWORD, clear, -1) != 0) {
             /* Failure is benign here because some mechanisms don't support this property */
-            /*LDAPDebug(LDAP_DEBUG_TRACE, "prop_set(userpassword) failed\n", 0, 0, 0);
+            /*LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "prop_set(userpassword) failed\n", 0, 0, 0);
             goto fail */ ;
         }
     }
@@ -544,7 +544,7 @@ int ids_sasl_init(void)
     static int inited = 0;
     int result;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> ids_sasl_init\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ids_sasl_init\n", 0, 0, 0 );
 
     PR_ASSERT(inited == 0);
     if (inited != 0) {
@@ -554,7 +554,7 @@ int ids_sasl_init(void)
 
     serverfqdn = get_localhost_DNS();
 
-    LDAPDebug(LDAP_DEBUG_TRACE, "sasl service fqdn is: %s\n", 
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl service fqdn is: %s\n", 
                   serverfqdn, 0, 0);
 
     /* get component ID for internal operations */
@@ -577,14 +577,14 @@ int ids_sasl_init(void)
     result = sasl_server_init(ids_sasl_callbacks, "iDS");
 
     if (result != SASL_OK) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "failed to initialize sasl library\n", 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "failed to initialize sasl library\n", 
                   0, 0, 0);
         return result;
     }
 
     result = sasl_auxprop_add_plugin("iDS", ids_auxprop_plug_init);
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= ids_sasl_init\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ids_sasl_init\n", 0, 0, 0 );
 
     return result;
 }
@@ -599,7 +599,7 @@ void ids_sasl_server_new(Connection *conn)
     struct propctx *propctx;
     sasl_security_properties_t secprops = {0};
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> ids_sasl_server_new (%s)\n", serverfqdn, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ids_sasl_server_new (%s)\n", serverfqdn, 0, 0 );
 
     rc = sasl_server_new("ldap", 
                          serverfqdn,
@@ -611,7 +611,7 @@ void ids_sasl_server_new(Connection *conn)
                          &sasl_conn);
 
     if (rc != SASL_OK) {
-        LDAPDebug(LDAP_DEBUG_ANY, "sasl_server_new: %s\n", 
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sasl_server_new: %s\n", 
                   sasl_errstring(rc, NULL, NULL), 0, 0);
     }
 
@@ -634,14 +634,14 @@ void ids_sasl_server_new(Connection *conn)
     rc = sasl_setprop(sasl_conn, SASL_SEC_PROPS, &secprops);
 
     if (rc != SASL_OK) {
-        LDAPDebug(LDAP_DEBUG_ANY, "sasl_setprop: %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sasl_setprop: %s\n",
                   sasl_errstring(rc, NULL, NULL), 0, 0);
     }
     
     conn->c_sasl_conn = sasl_conn;
     conn->c_sasl_ssf = 0;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= ids_sasl_server_new\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ids_sasl_server_new\n", 0, 0, 0 );
 
     return;
 }
@@ -657,7 +657,7 @@ char **ids_sasl_listmech(Slapi_PBlock *pb)
     char *dupstr;
     sasl_conn_t *sasl_conn;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> ids_sasl_listmech\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ids_sasl_listmech\n", 0, 0, 0 );
 
     PR_ASSERT(pb);
 
@@ -675,7 +675,7 @@ char **ids_sasl_listmech(Slapi_PBlock *pb)
                       NULL,     /* username */
                       "", ",", "",
                       &str, NULL, NULL) == SASL_OK) {
-        LDAPDebug(LDAP_DEBUG_TRACE, "sasl library mechs: %s\n", str, 0, 0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl library mechs: %s\n", str, 0, 0);
         /* merge into result set */
         dupstr = slapi_ch_strdup(str);
         others = slapi_str2charray_ext(dupstr, ",", 0 /* don't list duplicate mechanisms */);
@@ -685,7 +685,7 @@ char **ids_sasl_listmech(Slapi_PBlock *pb)
     }
     PR_ExitMonitor(pb->pb_conn->c_mutex);
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "<= ids_sasl_listmech\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ids_sasl_listmech\n", 0, 0, 0 );
 
     return ret;
 }
@@ -705,7 +705,7 @@ ids_sasl_mech_supported(Slapi_PBlock *pb, const char *mech)
   int sasl_result = 0;
   sasl_conn_t *sasl_conn = (sasl_conn_t *)pb->pb_conn->c_sasl_conn;
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "=> ids_sasl_mech_supported\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ids_sasl_mech_supported\n", 0, 0, 0 );
 
 
   /* sasl_listmech is not thread-safe - caller must lock pb_conn */
@@ -730,7 +730,7 @@ ids_sasl_mech_supported(Slapi_PBlock *pb, const char *mech)
   charray_free(mechs);
   slapi_ch_free((void**)&dupstr);
 
-  LDAPDebug( LDAP_DEBUG_TRACE, "<= ids_sasl_mech_supported\n", 0, 0, 0 );
+  LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ids_sasl_mech_supported\n", 0, 0, 0 );
 
   return ret;
 }
@@ -760,7 +760,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
     Slapi_Entry *bind_target_entry = NULL, *referral = NULL;
     Slapi_Backend *be = NULL;
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> ids_sasl_check_bind\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ids_sasl_check_bind\n", 0, 0, 0 );
 
     PR_ASSERT(pb);
     PR_ASSERT(pb->pb_conn);
@@ -810,11 +810,11 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
          */
         sasl_getprop(sasl_conn, SASL_MECHNAME, (const void**)&activemech);
         if (activemech == NULL) {
-            LDAPDebug(LDAP_DEBUG_TRACE, "could not get active sasl mechanism\n", 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "could not get active sasl mechanism\n", 0, 0, 0);
             goto sasl_start;
         }
         if (strcasecmp(activemech, mech) != 0) {
-            LDAPDebug(LDAP_DEBUG_TRACE, "sasl mechanisms differ: active=%s current=%s\n", 0, 0, 0);
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl mechanisms differ: active=%s current=%s\n", 0, 0, 0);
             goto sasl_start;
         }
 
@@ -874,7 +874,7 @@ sasl_check_result:
             break;
         }
 
-        LDAPDebug(LDAP_DEBUG_TRACE, "sasl authenticated mech=%s user=%s\n",
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl authenticated mech=%s user=%s\n",
                   mech, username, 0);
 
         /* 
@@ -906,7 +906,7 @@ sasl_check_result:
 
         if ((sasl_getprop(sasl_conn, SASL_SSF, 
                           (const void**)&ssfp) == SASL_OK) && (*ssfp > 0)) {
-            LDAPDebug(LDAP_DEBUG_TRACE, "sasl ssf=%u\n", (unsigned)*ssfp, 0, 0);
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "sasl ssf=%u\n", (unsigned)*ssfp, 0, 0);
         } else {
             *ssfp = 0;
         }
@@ -961,7 +961,7 @@ sasl_check_result:
         if (slapi_mapping_tree_select(pb, &be, &referral, NULL, 0) != LDAP_SUCCESS) {
             send_nobackend_ldap_result( pb );
             be = NULL;
-            LDAPDebug( LDAP_DEBUG_TRACE, "<= ids_sasl_check_bind\n", 0, 0, 0 );
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<= ids_sasl_check_bind\n", 0, 0, 0 );
             return; 
         }
 
@@ -1064,7 +1064,7 @@ sasl_check_result:
         if (bind_target_entry)
             slapi_entry_free(bind_target_entry);
 
-    LDAPDebug( LDAP_DEBUG_TRACE, "=> ids_sasl_check_bind\n", 0, 0, 0 );
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "=> ids_sasl_check_bind\n", 0, 0, 0 );
 
     return;
 }
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 32a2bd6..8421244 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -745,7 +745,7 @@ slapi_entry_schema_check_ext( Slapi_PBlock *pb, Slapi_Entry *e, int repl_check )
 
   /* find the object class attribute - could error out here */
   if ( (aoc = attrlist_find( e->e_attrs, "objectclass" )) == NULL ) {
-    LDAPDebug( LDAP_DEBUG_ANY,
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 	       "Entry \"%s\" required attribute \"objectclass\" missing\n",
 	       slapi_entry_get_dn_const(e), 0, 0 );
 	if (pb) {
@@ -782,7 +782,7 @@ slapi_entry_schema_check_ext( Slapi_PBlock *pb, Slapi_Entry *e, int repl_check )
     ocname = slapi_value_get_string(v);
 
     if ( !ocname ) {
-	LDAPDebug( LDAP_DEBUG_ANY,
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 	       "Entry \"%s\" \"objectclass\" value missing\n",
 	       slapi_entry_get_dn_const(e), 0, 0 );
 	if (pb) {
@@ -820,7 +820,7 @@ slapi_entry_schema_check_ext( Slapi_PBlock *pb, Slapi_Entry *e, int repl_check )
 		}
 	  }
 
-      LDAPDebug( LDAP_DEBUG_ANY,
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 		 "Entry \"%s\" has unknown object class \"%s\"%s\n",
 		 slapi_entry_get_dn_const(e),
 		 escape_string(ocname, ebuf), extra_msg );
@@ -883,7 +883,7 @@ slapi_entry_schema_check_ext( Slapi_PBlock *pb, Slapi_Entry *e, int repl_check )
 	if ( slapi_attr_flag_is_set( a, SLAPI_ATTR_FLAG_SINGLE ) ) {
 	  if (slapi_valueset_count(&a->a_present_values) > 1)
 	    {
-          LDAPDebug( LDAP_DEBUG_ANY,
+          LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 	         "Entry \"%s\" single-valued attribute \"%s\" has multiple values\n",
 			 slapi_entry_get_dn_const(e),
 			 a->a_type, 0 );
@@ -937,7 +937,7 @@ oc_check_required( Slapi_PBlock *pb, Slapi_Entry *e, struct objclass *oc )
         /* not there => schema violation */
         if ( a == NULL ) {
             char errtext[ BUFSIZ ];
-            LDAPDebug( LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                        "Entry \"%s\" missing attribute \"%s\" required"
                        " by object class \"%s\"\n",
                        slapi_entry_get_dn_const(e),
@@ -1008,7 +1008,7 @@ oc_check_allowed_sv(Slapi_PBlock *pb, Slapi_Entry *e, const char *type, struct o
     if ( 0 != rc ) {
       char errtext[ BUFSIZ ];
       char ebuf[ BUFSIZ ];
-      LDAPDebug( LDAP_DEBUG_ANY,
+      LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
          "Entry \"%s\" -- attribute \"%s\" not allowed\n",
          slapi_entry_get_dn_const(e),
          escape_string( type, ebuf ),
@@ -1558,7 +1558,7 @@ schema_attr_enum_callback(struct asyntaxinfo *asip, void *arg)
 	vals[0] = &val;
 
 	if (!asip) {
-		LDAPDebug(LDAP_DEBUG_ANY,
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
 				"Error: no attribute types in schema_attr_enum_callback\n",
 				0, 0, 0);
 		return ATTR_SYNTAX_ENUM_NEXT;
@@ -1719,7 +1719,7 @@ schema_syntax_enum_callback(char **names, Slapi_PluginDesc *plugindesc,
 	}
 
 	if ( oid == NULL ) {	/* must have an OID */
-		LDAPDebug(LDAP_DEBUG_ANY, "Error: no OID found in"
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: no OID found in"
 				" schema_syntax_enum_callback for syntax %s\n",
 				( names == NULL ) ? "unknown" : names[0], 0, 0);
 		return 1;
@@ -1781,7 +1781,7 @@ schema_list_attributes_callback(struct asyntaxinfo *asi, void *arg)
         struct listargs *aew = (struct listargs *)arg;
 
         if (!asi) {
-                LDAPDebug(LDAP_DEBUG_ANY, "Error: no attribute types in schema_list_attributes_callback\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Error: no attribute types in schema_list_attributes_callback\n",
                                   0, 0, 0);
                 return ATTR_SYNTAX_ENUM_NEXT;
         }
@@ -2941,7 +2941,7 @@ schema_replace_attributes ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf,
 		if ( NULL == ( oldasip =
 					attr_syntax_get_by_oid( newasip->asi_oid, 0 ))) {
 			/* new attribute type */
-			LDAPDebug( LDAP_DEBUG_TRACE, "schema_replace_attributes:"
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "schema_replace_attributes:"
 					" new type %s (OID %s)\n",
 					newasip->asi_name, newasip->asi_oid, 0 );
 		} else {
@@ -2953,7 +2953,7 @@ schema_replace_attributes ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf,
 				newasip = NULL;
 			} else {
 				/* modified attribute type */
-				LDAPDebug( LDAP_DEBUG_TRACE, "schema_replace_attributes:"
+				LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "schema_replace_attributes:"
 						" replacing type %s (OID %s)\n",
 						newasip->asi_name, newasip->asi_oid, 0 );
 				/* flag for deletion */
@@ -3115,7 +3115,7 @@ schema_replace_objectclasses ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf,
 				} else {
 					/* some differences: discard old and keep the new one */
 					oc_free( &tmpocp );
-					LDAPDebug( LDAP_DEBUG_TRACE, "schema_replace_objectclasses:"
+					LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "schema_replace_objectclasses:"
 							" replacing object class %s (OID %s)\n", 
 							newocp->oc_name, newocp->oc_oid, 0 );
 					addocp = newocp;
@@ -3127,7 +3127,7 @@ schema_replace_objectclasses ( Slapi_PBlock *pb, LDAPMod *mod, char *errorbuf,
 		}
 
 		if ( NULL == addocp ) {
-			LDAPDebug( LDAP_DEBUG_TRACE, "schema_replace_objectclasses:"
+			LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "schema_replace_objectclasses:"
 					" new object class %s (OID %s)\n", 
 					newocp->oc_name, newocp->oc_oid, 0 );
 			addocp = newocp;
@@ -3382,7 +3382,7 @@ read_oc_ldif ( const char *input, struct objclass **oc, char *errorbuf,
 	
 	schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_oc, NULL,
 			"One or more values are required for the objectClasses attribute" );
-	LDAPDebug ( LDAP_DEBUG_ANY, "NULL args passed to read_oc_ldif\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "NULL args passed to read_oc_ldif\n",0,0,0);
 	return read_oc_ldif_return( LDAP_OPERATIONS_ERROR, pOcOid, psbOcName,
 			pOcSup, pOcDesc );
   }
@@ -3921,7 +3921,7 @@ read_at_ldif(const char *input, struct asyntaxinfo **asipp, char *errorbuf,
         asi_parent = attr_syntax_get_by_name(pSuperior, schema_flags);
         /* if we find no match then server won't start or add the attribute type */
         if (asi_parent == NULL) {
-            LDAPDebug (LDAP_DEBUG_PARSE,
+            LDAPDebug(LDAP_DEBUG_PARSE, LOG_DEBUG,
                 "Cannot find parent attribute type \"%s\"\n",pSuperior,
                 NULL,NULL);
             schema_create_errormsg( errorbuf, errorbufsize,
@@ -3936,7 +3936,7 @@ read_at_ldif(const char *input, struct asyntaxinfo **asipp, char *errorbuf,
             
             if (pso && (NULL == pSyntax)) {
                 pSyntax = slapi_ch_strdup(pso);
-                LDAPDebug (LDAP_DEBUG_TRACE,
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                     "Inheriting syntax %s from parent type %s\n",
                     pSyntax, pSuperior,NULL);
             } else if (NULL == pSyntax) {
@@ -4171,7 +4171,7 @@ parse_attr_str(const char *input, struct asyntaxinfo **asipp, char *errorbuf,
     if(input == NULL || '\0' == input[0]){
         schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, NULL,
             "One or more values are required for the attributeTypes attribute" );
-        LDAPDebug ( LDAP_DEBUG_ANY, "NULL args passed to parse_attr_str\n",0,0,0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "NULL args passed to parse_attr_str\n",0,0,0);
         return invalid_syntax_error;
     }
     /*
@@ -4243,7 +4243,7 @@ parse_attr_str(const char *input, struct asyntaxinfo **asipp, char *errorbuf,
         asi_parent = attr_syntax_get_by_name(atype->at_sup_oid, schema_flags);
         /* if we find no match then server won't start or add the attribute type */
         if (asi_parent == NULL) {
-            LDAPDebug (LDAP_DEBUG_ANY, "Cannot find parent attribute type \"%s\"\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Cannot find parent attribute type \"%s\"\n",
                 atype->at_sup_oid, NULL, NULL);
             schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_at, first_attr_name,
                 "Missing parent attribute syntax OID");
@@ -4261,7 +4261,7 @@ parse_attr_str(const char *input, struct asyntaxinfo **asipp, char *errorbuf,
 
             if (pso && (NULL == atype->at_syntax_oid)) {
                 atype->at_syntax_oid = slapi_ch_strdup(pso);
-                LDAPDebug (LDAP_DEBUG_TRACE,
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
                     "Inheriting syntax %s from parent type %s\n",
                     atype->at_syntax_oid, atype->at_sup_oid,NULL);
             } else if (NULL == atype->at_syntax_oid) {
@@ -4550,7 +4550,7 @@ parse_objclass_str ( const char *input, struct objclass **oc, char *errorbuf,
     if ( NULL == input || '\0' == input[0] ) {
         schema_create_errormsg( errorbuf, errorbufsize, schema_errprefix_oc, NULL,
             "One or more values are required for the objectClasses attribute" );
-        LDAPDebug ( LDAP_DEBUG_ANY, "NULL args passed to read_oc_ldif\n",0,0,0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "NULL args passed to read_oc_ldif\n",0,0,0);
         return LDAP_OPERATIONS_ERROR;
     }
     /*
@@ -4795,7 +4795,7 @@ schema_check_oc_attrs ( struct objclass *poc,
 
 	if ( errorbuf == NULL || poc == NULL || poc->oc_name == NULL) {
 		/* error */
-		LDAPDebug (LDAP_DEBUG_PARSE,  
+		LDAPDebug(LDAP_DEBUG_PARSE, LOG_DEBUG,  
 				   "Null args passed to schema_check_oc_attrs\n",
 				   NULL, NULL, NULL);
 		return -1;
@@ -4929,7 +4929,7 @@ schema_check_oid( const char *name, const char *oid, PRBool isAttribute,
 
   if ( name == NULL || oid == NULL) {
 	/* this is bad */
-	LDAPDebug (LDAP_DEBUG_ANY, "NULL passed to schema_check_oid\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "NULL passed to schema_check_oid\n",0,0,0);
 	return 0;
   }
   
@@ -5062,7 +5062,7 @@ strip_oc_options( struct objclass *poc ) {
 
   for ( i = 0; poc->oc_allowed && poc->oc_allowed[i]; i++ ) {
 	if ( (mod = stripOption( poc->oc_allowed[i] )) != NULL ){
-	  LDAPDebug (LDAP_DEBUG_ANY, 
+	  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 				 "Removed option \"%s\" from allowed attribute type "
 				 "\"%s\" in object class \"%s\".\n",
 				 mod, poc->oc_allowed[i], poc->oc_name );
@@ -5072,7 +5072,7 @@ strip_oc_options( struct objclass *poc ) {
     
   for ( i = 0; poc->oc_required && poc->oc_required[i]; i++ ) {
 	if ( (mod = stripOption( poc->oc_required[i] )) != NULL ){
-	  LDAPDebug (LDAP_DEBUG_ANY, 
+	  LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 				 "Removed option \"%s\" from required attribute type "
 				 "\"%s\" in object class \"%s\".\n",
 				 mod, poc->oc_required[i], poc->oc_name );
@@ -5476,7 +5476,7 @@ parse_xstring_list( const char *schema_value, const char *name, size_t namelen,
 
 /* for debugging
 if ( xvals == NULL || xvals[0] == NULL ) {
-    LDAPDebug( LDAP_DEBUG_ANY, "no xstring values for xstring (%s) in (%s)\n", name, schema_value, 0 );
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "no xstring values for xstring (%s) in (%s)\n", name, schema_value, 0 );
 }
 */
 
@@ -6040,7 +6040,7 @@ va_expand_one_oc( const char *dn, const Slapi_Attr *a, Slapi_ValueSet *vs, const
   
   	slapi_valueset_add_attr_value_ext(a, vs, slapi_value_new_string(sup_oc->oc_name), SLAPI_VALUE_FLAG_PASSIN);
 
-	LDAPDebug( LDAP_DEBUG_TRACE,
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,
 			"Entry \"%s\": added missing objectClass value %s\n",
 			dn, sup_oc->oc_name, 0 );
 }
diff --git a/ldap/servers/slapd/schemaparse.c b/ldap/servers/slapd/schemaparse.c
index 276e0d0..b0968ea 100644
--- a/ldap/servers/slapd/schemaparse.c
+++ b/ldap/servers/slapd/schemaparse.c
@@ -206,7 +206,7 @@ normalize_oc( void )
 	oc_lock_write();
 
 	for ( oc = g_get_global_oc_nolock(); oc != NULL; oc = oc->oc_next ) {
-	  LDAPDebug (LDAP_DEBUG_PARSE, 
+	  LDAPDebug(LDAP_DEBUG_PARSE, LOG_DEBUG, 
 				 "normalize_oc: normalizing '%s'\n", oc->oc_name, 0, 0);
 	  /* required attributes */
 	  normalize_list( oc->oc_required );
@@ -226,7 +226,7 @@ normalize_oc_nolock( void )
 	struct objclass	*oc;
 
 	for ( oc = g_get_global_oc_nolock(); oc != NULL; oc = oc->oc_next ) {
-	  LDAPDebug (LDAP_DEBUG_PARSE, 
+	  LDAPDebug(LDAP_DEBUG_PARSE, LOG_DEBUG, 
 				 "normalize_oc: normalizing '%s'\n", oc->oc_name, 0, 0);
 	  /* required attributes */
 	  normalize_list( oc->oc_required );
diff --git a/ldap/servers/slapd/search.c b/ldap/servers/slapd/search.c
index aca335e..afd5d09 100644
--- a/ldap/servers/slapd/search.c
+++ b/ldap/servers/slapd/search.c
@@ -55,7 +55,7 @@ do_search( Slapi_PBlock *pb )
 	int minssf_exclude_rootdse = 0;
 	int filter_normalized = 0;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "do_search\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_search\n", 0, 0, 0 );
 
 	slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
 	ber = operation->o_ber;
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index 1111a0e..98cae86 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -457,20 +457,20 @@ snmp_collator_create_semaphore(void)
             /* It appears that we didn't exit cleanly last time and left the semaphore
              * around.  Recreate it since we don't know what state it is in. */
             if (sem_unlink(stats_sem_name) != 0) {
-                LDAPDebug( LDAP_DEBUG_ANY, "Failed to delete old semaphore for stats file (%s). "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to delete old semaphore for stats file (%s). "
                           "Error %d (%s).\n", szStatsFile, errno, slapd_system_strerror(errno) );
                 exit(1);
             }
 
             if ((stats_sem = sem_open(stats_sem_name, O_CREAT | O_EXCL, SLAPD_DEFAULT_FILE_MODE, 1)) == SEM_FAILED) {
                 /* No dice */
-                LDAPDebug( LDAP_DEBUG_ANY, "Failed to create semaphore for stats file (%s). Error %d (%s).\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to create semaphore for stats file (%s). Error %d (%s).\n",
                          szStatsFile, errno, slapd_system_strerror(errno) );
                 exit(1);
             }
         } else {
             /* Some other problem occurred creating the semaphore. */
-            LDAPDebug( LDAP_DEBUG_ANY, "Failed to create semaphore for stats file (%s). Error %d.(%s)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Failed to create semaphore for stats file (%s). Error %d.(%s)\n",
                      szStatsFile, errno, slapd_system_strerror(errno) );
             exit(1);
         }
diff --git a/ldap/servers/slapd/ssl.c b/ldap/servers/slapd/ssl.c
index ca19983..2b35c5e 100644
--- a/ldap/servers/slapd/ssl.c
+++ b/ldap/servers/slapd/ssl.c
@@ -267,7 +267,7 @@ slapd_SSL_report(int degree, char *fmt, va_list args)
 {
     char buf[2048];
     PR_vsnprintf( buf, sizeof(buf), fmt, args );
-    LDAPDebug( LDAP_DEBUG_ANY, "SSL %s: %s\n",
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "SSL %s: %s\n",
 	       (degree == LOG_FAILURE) ? "failure" : "alert",
 	       buf, 0 );
 }
@@ -1260,15 +1260,15 @@ slapd_nss_init(int init_ssl, int config_available)
 		keydb_file_name = slapi_ch_smprintf("%s/key3.db", certdir);
 		secmoddb_file_name = slapi_ch_smprintf("%s/secmod.db", certdir);
 		if(chmod(certdb_file_name, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP )){
-			LDAPDebug(LDAP_DEBUG_ANY, "slapd_nss_init: chmod failed for file %s error (%d) %s.\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapd_nss_init: chmod failed for file %s error (%d) %s.\n",
 					certdb_file_name, errno, slapd_system_strerror(errno));
 		}
 		if(chmod(keydb_file_name, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP )){
-			LDAPDebug(LDAP_DEBUG_ANY, "slapd_nss_init: chmod failed for file %s error (%d) %s.\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapd_nss_init: chmod failed for file %s error (%d) %s.\n",
 					keydb_file_name, errno, slapd_system_strerror(errno));
 		}
 		if(chmod(secmoddb_file_name, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP )){
-			LDAPDebug(LDAP_DEBUG_ANY, "slapd_nss_init: chmod failed for file %s error (%d) %s.\n",
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapd_nss_init: chmod failed for file %s error (%d) %s.\n",
 					secmoddb_file_name, errno, slapd_system_strerror(errno));
 		}
 	}
@@ -2168,7 +2168,7 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
 #ifdef SSL_REQUIRE_CERTIFICATE    /* new feature */
             if ((err = SSL_OptionSet (pr_sock, SSL_REQUIRE_CERTIFICATE, PR_FALSE)) < 0) {
                 PRErrorCode prerr = PR_GetError();
-                LDAPDebug (LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                  "SSL_OptionSet(SSL_REQUIRE_CERTIFICATE,PR_FALSE) %d "
                  SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                  err, prerr, slapd_pr_strerror(prerr));
@@ -2178,7 +2178,7 @@ slapd_ssl_init2(PRFileDesc **fd, int startTLS)
           case SLAPD_SSLCLIENTAUTH_REQUIRED:
             if ((err = SSL_OptionSet (pr_sock, SSL_REQUEST_CERTIFICATE, PR_TRUE)) < 0) {
                 PRErrorCode prerr = PR_GetError();
-                LDAPDebug (LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                  "SSL_OptionSet(SSL_REQUEST_CERTIFICATE,PR_TRUE) %d "
                  SLAPI_COMPONENT_NAME_NSPR " error %d (%s)\n",
                  err, prerr, slapd_pr_strerror(prerr));
@@ -2454,7 +2454,7 @@ slapd_SSL_client_auth (LDAP* ld)
     slapi_ch_free_string(&pw);
     slapi_ch_free_string(&finalpersonality);
 
-    LDAPDebug (LDAP_DEBUG_TRACE, "slapd_SSL_client_auth() %i\n", rc, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "slapd_SSL_client_auth() %i\n", rc, 0, 0);
     return rc;
 }
 
diff --git a/ldap/servers/slapd/str2filter.c b/ldap/servers/slapd/str2filter.c
index 8117796..ae5a577 100644
--- a/ldap/servers/slapd/str2filter.c
+++ b/ldap/servers/slapd/str2filter.c
@@ -30,7 +30,7 @@ slapi_str2filter( char *str )
 	struct slapi_filter	*f = NULL;
 	char		*end;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "slapi_str2filter \"%s\"\n", str, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "slapi_str2filter \"%s\"\n", str, 0, 0 );
 
 	if ( str == NULL || *str == '\0' ) {
 		return( NULL );
@@ -98,7 +98,7 @@ str2list( char *str, unsigned long ftype )
 	char		*next;
 	char		save;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "str2list \"%s\"\n", str, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "str2list \"%s\"\n", str, 0, 0 );
 
 	f = (struct slapi_filter *) slapi_ch_calloc( 1, sizeof(struct slapi_filter) );
 	f->f_choice = ftype;
@@ -312,7 +312,7 @@ str2simple( char *str , int unescape_filter)
 	char		*s;
 	char		*value, savechar;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "str2simple \"%s\"\n", str, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "str2simple \"%s\"\n", str, 0, 0 );
 
 	PR_ASSERT(str);
 
@@ -433,7 +433,7 @@ str2subvals( char *val, struct slapi_filter *f, int unescape_filter )
 	int	gotstar;
 	size_t  len, outlen;
 
-	LDAPDebug( LDAP_DEBUG_FILTER, "str2subvals \"%s\"\n", val, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_FILTER, LOG_DEBUG, "str2subvals \"%s\"\n", val, 0, 0 );
 
 	gotstar = 0;
 	while ( val != NULL && *val ) {
diff --git a/ldap/servers/slapd/stubs.c b/ldap/servers/slapd/stubs.c
index cb960ac..778552a 100644
--- a/ldap/servers/slapd/stubs.c
+++ b/ldap/servers/slapd/stubs.c
@@ -29,7 +29,7 @@ void *PT_Lock( PRLock *x_mutex )
 
 int lcache_init(LDAP *ld, void *arg)
 {
-	LDAPDebug(LDAP_DEBUG_ANY, 
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, 
 		"lcache_init: Shouldn't have been called\n", 0,0,0);
 	return -1;
 }
diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c
index 405f0bf..08a6247 100644
--- a/ldap/servers/slapd/task.c
+++ b/ldap/servers/slapd/task.c
@@ -508,7 +508,7 @@ slapi_plugin_task_register_handler(const char *name, dseCallbackFn func, Slapi_P
     slapi_add_internal_pb(add_pb);
     slapi_pblock_get(add_pb, SLAPI_PLUGIN_INTOP_RESULT, &x);
     if ((x != LDAP_SUCCESS) && (x != LDAP_ALREADY_EXISTS)) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "Can't create task node '%s' (error %d)\n",
                   name, x, 0);
         ret = x;
@@ -686,14 +686,14 @@ static Slapi_Entry *get_internal_entry(Slapi_PBlock *pb, char *dn)
     slapi_search_internal_pb(pb);
     slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
     if (ret != LDAP_SUCCESS) {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't find task entry '%s'\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: can't find task entry '%s'\n",
                   dn, 0, 0);
         return NULL;
     }
 
     slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
     if ((NULL == entries) || (NULL == entries[0])) {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't find task entry '%s'\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: can't find task entry '%s'\n",
                   dn, 0, 0);
         return NULL;
     }
@@ -733,7 +733,7 @@ static void modify_internal_entry(char *dn, LDAPMod **mods)
              */
             tries++;
             if (tries == 3) {
-                LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't modify task "
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: can't modify task "
                         "entry '%s'; %s (%d)\n", dn, ldap_err2string(ret), ret);
                 pblock_done(&pb);
                 return;
@@ -815,7 +815,7 @@ static int task_modify(Slapi_PBlock *pb, Slapi_Entry *e,
             task->task_state = SLAPI_TASK_CANCELLED;
             if (task->cancel) {
                 (*task->cancel)(task);
-                LDAPDebug(LDAP_DEBUG_ANY, "Cancelling task '%s'\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Cancelling task '%s'\n",
                           fetch_attr(eAfter, "cn", "?"), 0, 0);
             }
         }
@@ -886,7 +886,7 @@ static int task_import_add(Slapi_PBlock *pb, Slapi_Entry *e,
 
         if (slapi_lookup_instance_name_by_suffixes(include, exclude,
                                                    &instances) < 0) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "ERROR: No backend instance is specified.\n", 0, 0, 0);
             *returncode = LDAP_OBJECT_CLASS_VIOLATION;
             return SLAPI_DSE_CALLBACK_ERROR;
@@ -902,12 +902,12 @@ static int task_import_add(Slapi_PBlock *pb, Slapi_Entry *e,
                 
             }
             else if (counter == 0) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "ERROR: No backend instance is specified.\n", 0, 0, 0);
                 *returncode = LDAP_OBJECT_CLASS_VIOLATION;
                 return SLAPI_DSE_CALLBACK_ERROR;
             } else {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "ERROR: Multiple backend instances are specified: "
                           "%s, %s, ...\n", instances[0], instances[1], 0);
                 *returncode = LDAP_OBJECT_CLASS_VIOLATION;
@@ -922,7 +922,7 @@ static int task_import_add(Slapi_PBlock *pb, Slapi_Entry *e,
     /* lookup the backend */
     be = slapi_be_select_by_instance_name(instance_name);
     if (be == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "can't import to nonexistent backend %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "can't import to nonexistent backend %s\n",
                   instance_name, 0, 0);
         slapi_ch_free_string(&nameFrombe_name);
         *returncode = LDAP_NO_SUCH_OBJECT;
@@ -933,14 +933,14 @@ static int task_import_add(Slapi_PBlock *pb, Slapi_Entry *e,
      * for DS 5.0 where the import/export stuff changed a lot.
      */
     if (! SLAPI_PLUGIN_IS_V3(be->be_database)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "can't perform an import with pre-V3 "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "can't perform an import with pre-V3 "
                   "backend plugin %s\n", be->be_database->plg_name, 0, 0);
         *returncode = LDAP_UNWILLING_TO_PERFORM;
         slapi_ch_free_string(&nameFrombe_name);
         return SLAPI_DSE_CALLBACK_ERROR;
     }
     if (be->be_database->plg_ldif2db == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ERROR: no ldif2db function defined for "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: no ldif2db function defined for "
                   "backend %s\n", be->be_database->plg_name, 0, 0);
         *returncode = LDAP_UNWILLING_TO_PERFORM;
         slapi_ch_free_string(&nameFrombe_name);
@@ -974,7 +974,7 @@ static int task_import_add(Slapi_PBlock *pb, Slapi_Entry *e,
     /* allocate new task now */
     task = slapi_new_task(slapi_entry_get_ndn(e));
     if (task == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "unable to allocate new task!\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to allocate new task!\n", 0, 0, 0);
         rv = LDAP_OPERATIONS_ERROR;
         goto out;
     }
@@ -1044,7 +1044,7 @@ static void task_export_thread(void *arg)
         be = slapi_be_select_by_instance_name((const char *)*inp);
         if (be == NULL) {
             /* shouldn't happen */
-            LDAPDebug(LDAP_DEBUG_ANY, "ldbm2ldif: backend '%s' is AWOL!\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ldbm2ldif: backend '%s' is AWOL!\n",
                       (const char *)*inp, 0, 0);
             continue;
         }
@@ -1085,13 +1085,13 @@ static void task_export_thread(void *arg)
         }
 
         slapi_task_log_notice(task, "Beginning export of '%s'", *inp);
-        LDAPDebug(LDAP_DEBUG_ANY, "Beginning export of '%s'\n", *inp, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Beginning export of '%s'\n", *inp, 0, 0);
 
         rv = (*pb->pb_plugin->plg_db2ldif)(pb);
         if (rv != 0) {
             slapi_task_log_notice(task, "backend '%s' export failed (%d)",
                                   *inp, rv);
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "ldbm2ldif: backend '%s' export failed (%d)\n",
                       (const char *)*inp, rv, 0);
         }
@@ -1115,10 +1115,10 @@ static void task_export_thread(void *arg)
 
     if (rv == 0) {
         slapi_task_log_notice(task, "Export finished.");
-        LDAPDebug(LDAP_DEBUG_ANY, "Export finished.\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Export finished.\n", 0, 0, 0);
     } else {
         slapi_task_log_notice(task, "Export failed.");
-        LDAPDebug(LDAP_DEBUG_ANY, "Export failed.\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Export failed.\n", 0, 0, 0);
     }
 
     slapi_task_finish(task, rv);
@@ -1199,7 +1199,7 @@ static int task_export_add(Slapi_PBlock *pb, Slapi_Entry *e,
 
         if (slapi_lookup_instance_name_by_suffixes(include, exclude,
                                                    &instance_names) < 0) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "ERROR: No backend instance is specified.\n", 0, 0, 0);
             *returncode = LDAP_OBJECT_CLASS_VIOLATION;
             rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1212,14 +1212,14 @@ static int task_export_add(Slapi_PBlock *pb, Slapi_Entry *e,
                 ;
 
             if (instance_cnt == 0) {
-                LDAPDebug(LDAP_DEBUG_ANY,
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                           "ERROR: No backend instance is specified.\n", 0, 0, 0);
                 *returncode = LDAP_OBJECT_CLASS_VIOLATION;
                 rv = SLAPI_DSE_CALLBACK_ERROR;
                 goto out;
             }
         } else {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "ERROR: No backend instance is specified.\n", 0, 0, 0);
             *returncode = LDAP_OBJECT_CLASS_VIOLATION;
             rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1280,7 +1280,7 @@ static int task_export_add(Slapi_PBlock *pb, Slapi_Entry *e,
         /* lookup the backend */
         be = slapi_be_select_by_instance_name((const char *)*inp);
         if (be == NULL) {
-            LDAPDebug(LDAP_DEBUG_ANY,
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                       "can't export to nonexistent backend %s\n", *inp, 0, 0);
             *returncode = LDAP_NO_SUCH_OBJECT;
             rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1291,14 +1291,14 @@ static int task_export_add(Slapi_PBlock *pb, Slapi_Entry *e,
          * for DS 5.0 where the import/export stuff changed a lot.
          */
         if (! SLAPI_PLUGIN_IS_V3(be->be_database)) {
-            LDAPDebug(LDAP_DEBUG_ANY, "can't perform an export with pre-V3 "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "can't perform an export with pre-V3 "
                       "backend plugin %s\n", be->be_database->plg_name, 0, 0);
             *returncode = LDAP_UNWILLING_TO_PERFORM;
             rv = SLAPI_DSE_CALLBACK_ERROR;
             goto out;
         }
         if (be->be_database->plg_db2ldif == NULL) {
-            LDAPDebug(LDAP_DEBUG_ANY, "ERROR: no db2ldif function defined for "
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: no db2ldif function defined for "
                       "backend %s\n", be->be_database->plg_name, 0, 0);
             *returncode = LDAP_UNWILLING_TO_PERFORM;
             rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1309,7 +1309,7 @@ static int task_export_add(Slapi_PBlock *pb, Slapi_Entry *e,
     /* allocate new task now */
     task = slapi_new_task(slapi_entry_get_ndn(e));
     if (task == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "unable to allocate new task!\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to allocate new task!\n", 0, 0, 0);
         *returncode = LDAP_OPERATIONS_ERROR;
         rv = SLAPI_DSE_CALLBACK_ERROR;
         goto out;
@@ -1340,7 +1340,7 @@ static int task_export_add(Slapi_PBlock *pb, Slapi_Entry *e,
                         (void *)mypb, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
                         PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
     if (thread == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "unable to create ldbm2ldif thread!\n", 0, 0, 0);
         *returncode = LDAP_OPERATIONS_ERROR;
         rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1377,18 +1377,18 @@ static void task_backup_thread(void *arg)
 
     slapi_task_log_notice(task, "Beginning backup of '%s'",
                           pb->pb_plugin->plg_name);
-    LDAPDebug(LDAP_DEBUG_ANY, "Beginning backup of '%s'\n",
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Beginning backup of '%s'\n",
               pb->pb_plugin->plg_name, 0, 0);
 
     rv = (*pb->pb_plugin->plg_db2archive)(pb);
     if (rv != 0) {
         slapi_task_log_notice(task, "Backup failed (error %d)", rv);
         slapi_task_log_status(task, "Backup failed (error %d)", rv);
-        LDAPDebug(LDAP_DEBUG_ANY, "Backup failed (error %d)\n", rv, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Backup failed (error %d)\n", rv, 0, 0);
     } else {
         slapi_task_log_notice(task, "Backup finished.");
         slapi_task_log_status(task, "Backup finished.");
-        LDAPDebug(LDAP_DEBUG_ANY, "Backup finished.\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Backup finished.\n", 0, 0, 0);
     }
 
     slapi_task_finish(task, rv);
@@ -1440,7 +1440,7 @@ static int task_backup_add(Slapi_PBlock *pb, Slapi_Entry *e,
     }
     slapi_ch_free_string(&cookie);
     if (NULL == be || NULL == be->be_database->plg_db2archive) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "ERROR: no db2archive function defined.\n", 0, 0, 0);
         *returncode = LDAP_UNWILLING_TO_PERFORM;
         rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1448,7 +1448,7 @@ static int task_backup_add(Slapi_PBlock *pb, Slapi_Entry *e,
     }
 
     if (! SLAPI_PLUGIN_IS_V3(be->be_database)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "can't perform an backup with pre-V3 "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "can't perform an backup with pre-V3 "
                   "backend plugin %s\n", be->be_database->plg_name, 0, 0);
         *returncode = LDAP_UNWILLING_TO_PERFORM;
         rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1458,7 +1458,7 @@ static int task_backup_add(Slapi_PBlock *pb, Slapi_Entry *e,
     /* allocate new task now */
     task = slapi_new_task(slapi_entry_get_ndn(e));
     if (task == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "unable to allocate new task!\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to allocate new task!\n", 0, 0, 0);
         *returncode = LDAP_OPERATIONS_ERROR;
         rv = SLAPI_DSE_CALLBACK_ERROR;
         goto out;
@@ -1480,7 +1480,7 @@ static int task_backup_add(Slapi_PBlock *pb, Slapi_Entry *e,
                              (void *)mypb, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
                              PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
     if (thread == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "unable to create backup thread!\n", 0, 0, 0);
         *returncode = LDAP_OPERATIONS_ERROR;
         rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1511,18 +1511,18 @@ static void task_restore_thread(void *arg)
 
     slapi_task_log_notice(task, "Beginning restore to '%s'",
                           pb->pb_plugin->plg_name);
-    LDAPDebug(LDAP_DEBUG_ANY, "Beginning restore to '%s'\n",
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Beginning restore to '%s'\n",
               pb->pb_plugin->plg_name, 0, 0);
 
     rv = (*pb->pb_plugin->plg_archive2db)(pb);
     if (rv != 0) {
         slapi_task_log_notice(task, "Restore failed (error %d)", rv);
         slapi_task_log_status(task, "Restore failed (error %d)", rv);
-        LDAPDebug(LDAP_DEBUG_ANY, "Restore failed (error %d)\n", rv, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Restore failed (error %d)\n", rv, 0, 0);
     } else {
         slapi_task_log_notice(task, "Restore finished.");
         slapi_task_log_status(task, "Restore finished.");
-        LDAPDebug(LDAP_DEBUG_ANY, "Restore finished.\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Restore finished.\n", 0, 0, 0);
     }
 
     slapi_task_finish(task, rv);
@@ -1578,7 +1578,7 @@ static int task_restore_add(Slapi_PBlock *pb, Slapi_Entry *e,
     }
     slapi_ch_free_string(&cookie);
     if (NULL == be || NULL == be->be_database->plg_archive2db) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "ERROR: no archive2db function defined.\n", 0, 0, 0);
         *returncode = LDAP_UNWILLING_TO_PERFORM;
         rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1589,7 +1589,7 @@ static int task_restore_add(Slapi_PBlock *pb, Slapi_Entry *e,
      * for DS 5.0 where the import/export stuff changed a lot.
      */
     if (! SLAPI_PLUGIN_IS_V3(be->be_database)) {
-        LDAPDebug(LDAP_DEBUG_ANY, "can't perform an restore with pre-V3 "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "can't perform an restore with pre-V3 "
                   "backend plugin %s\n", be->be_database->plg_name, 0, 0);
         *returncode = LDAP_UNWILLING_TO_PERFORM;
         rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1599,7 +1599,7 @@ static int task_restore_add(Slapi_PBlock *pb, Slapi_Entry *e,
     /* allocate new task now */
     task = slapi_new_task(slapi_entry_get_ndn(e));
     if (task == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "unable to allocate new task!\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to allocate new task!\n", 0, 0, 0);
         *returncode = LDAP_OPERATIONS_ERROR;
         rv = SLAPI_DSE_CALLBACK_ERROR;
         goto out;
@@ -1623,7 +1623,7 @@ static int task_restore_add(Slapi_PBlock *pb, Slapi_Entry *e,
                              (void *)mypb, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
                              PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
     if (thread == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "unable to create restore thread!\n", 0, 0, 0);
         *returncode = LDAP_OPERATIONS_ERROR;
         rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1657,7 +1657,7 @@ static void task_index_thread(void *arg)
     if (rv != 0) {
         slapi_task_log_notice(task, "Index failed (error %d)", rv);
         slapi_task_log_status(task, "Index failed (error %d)", rv);
-        LDAPDebug(LDAP_DEBUG_ANY, "Index failed (error %d)\n", rv, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Index failed (error %d)\n", rv, 0, 0);
     }
 
     slapi_task_finish(task, rv);
@@ -1696,13 +1696,13 @@ static int task_index_add(Slapi_PBlock *pb, Slapi_Entry *e,
     /* lookup the backend */
     be = slapi_be_select_by_instance_name(instance_name);
     if (be == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "can't import to nonexistent backend %s\n",
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "can't import to nonexistent backend %s\n",
                   instance_name, 0, 0);
         *returncode = LDAP_NO_SUCH_OBJECT;
         return SLAPI_DSE_CALLBACK_ERROR;
     }
     if (be->be_database->plg_db2index == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "ERROR: no db2index function defined for "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "ERROR: no db2index function defined for "
                   "backend %s\n", be->be_database->plg_name, 0, 0);
         *returncode = LDAP_UNWILLING_TO_PERFORM;
         return SLAPI_DSE_CALLBACK_ERROR;
@@ -1735,7 +1735,7 @@ static int task_index_add(Slapi_PBlock *pb, Slapi_Entry *e,
     }
 
     if (NULL == indexlist) {
-        LDAPDebug(LDAP_DEBUG_ANY, "no index is specified!\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "no index is specified!\n", 0, 0, 0);
         *returncode = LDAP_OPERATIONS_ERROR;
         rv = SLAPI_DSE_CALLBACK_OK;
         goto out;
@@ -1744,7 +1744,7 @@ static int task_index_add(Slapi_PBlock *pb, Slapi_Entry *e,
     /* allocate new task now */
     task = slapi_new_task(slapi_entry_get_ndn(e));
     if (task == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "unable to allocate new task!\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to allocate new task!\n", 0, 0, 0);
         *returncode = LDAP_OPERATIONS_ERROR;
         rv = SLAPI_DSE_CALLBACK_ERROR;
         goto out;
@@ -1768,7 +1768,7 @@ static int task_index_add(Slapi_PBlock *pb, Slapi_Entry *e,
                              (void *)mypb, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
                              PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
     if (thread == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "unable to create index thread!\n", 0, 0, 0);
         rv = SLAPI_DSE_CALLBACK_ERROR;
         slapi_ch_free((void **)&mypb->pb_instance_name);
@@ -1835,7 +1835,7 @@ task_upgradedb_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
     }
     slapi_ch_free_string(&cookie);
     if (NULL == be) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "ERROR: no upgradedb is defined.\n", 0, 0, 0);
         *returncode = LDAP_UNWILLING_TO_PERFORM;
         rv = SLAPI_DSE_CALLBACK_ERROR;
@@ -1843,7 +1843,7 @@ task_upgradedb_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
     }
     if (NULL == be->be_database->plg_upgradedb ||
         strcasecmp(database_type, be->be_database->plg_name)) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "ERROR: no upgradedb is defined in %s.\n",
                   be->be_database->plg_name, 0, 0);
         *returncode = LDAP_UNWILLING_TO_PERFORM;
@@ -1854,7 +1854,7 @@ task_upgradedb_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
     /* allocate new task now */
     task = slapi_new_task(slapi_entry_get_ndn(e));
     if (task == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "unable to allocate new task!\n", 0, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to allocate new task!\n", 0, 0, 0);
         *returncode = LDAP_OPERATIONS_ERROR;
         rv = SLAPI_DSE_CALLBACK_ERROR;
         goto out;
@@ -1931,7 +1931,7 @@ task_sysconfig_reload_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
         *returncode = LDAP_OPERATIONS_ERROR;
         PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE, "missing required attribute \"%s\".",
                      TASK_SYSCONFIG_FILE_ATTR);
-        LDAPDebug(LDAP_DEBUG_ANY, "sysconfig reload task: %s\n", returntext, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sysconfig reload task: %s\n", returntext, 0, 0);
         rc = SLAPI_DSE_CALLBACK_ERROR;
         goto done;
     }
@@ -1946,7 +1946,7 @@ task_sysconfig_reload_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
         char *end_of_line = line + sizeof(line) - 1;
 
         if(logchanges){
-            LDAPDebug(LDAP_DEBUG_ANY, "sysconfig reload task: processing file (%s)\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sysconfig reload task: processing file (%s)\n",
                       filename, 0 , 0);
         }
 
@@ -2059,12 +2059,12 @@ task_sysconfig_reload_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
                     if(setenv(env_var, env_value, 1) != 0){
                         *returncode = LDAP_OPERATIONS_ERROR;
                         PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE,"failed to set (%s)", env_var);
-                        LDAPDebug(LDAP_DEBUG_ANY, "sysconfig reload task: %s\n",returntext,0,0);
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sysconfig reload task: %s\n",returntext,0,0);
                         rc = SLAPI_DSE_CALLBACK_ERROR;
                         break;
                     }
                     if(logchanges){
-                        LDAPDebug(LDAP_DEBUG_ANY, "sysconfig reload task: set (%s) to (%s)\n",
+                        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sysconfig reload task: set (%s) to (%s)\n",
                                   env_var, env_value , 0);
                     }
                 }
@@ -2075,7 +2075,7 @@ task_sysconfig_reload_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
         *returncode = LDAP_OPERATIONS_ERROR;
         PR_snprintf (returntext, SLAPI_DSE_RETURNTEXT_SIZE,"failed to open file \"%s\" (%s)",
                 filename, strerror(errno));
-        LDAPDebug(LDAP_DEBUG_ANY, "sysconfig reload task: %s\n", returntext, 0, 0);
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "sysconfig reload task: %s\n", returntext, 0, 0);
         rc = SLAPI_DSE_CALLBACK_ERROR;
     }
 
@@ -2389,7 +2389,7 @@ task_fixup_tombstones_add(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *eAfter,
                              (void *)task_data, PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
                              PR_UNJOINABLE_THREAD, SLAPD_DEFAULT_THREAD_STACKSIZE);
     if (thread == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
                   "task_fixup_tombstones_add: unable to create index thread!\n", 0, 0, 0);
         *returncode = LDAP_OPERATIONS_ERROR;
         slapi_task_finish(task, *returncode);
@@ -2785,7 +2785,7 @@ void task_cleanup(void)
     slapi_search_internal_pb(pb);
     slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &ret);
     if (ret != LDAP_SUCCESS) {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING: entire cn=tasks tree seems to "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: entire cn=tasks tree seems to "
                   "be AWOL!\n", 0, 0, 0);
         slapi_pblock_destroy(pb);
         return;
@@ -2793,7 +2793,7 @@ void task_cleanup(void)
 
     slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
     if (NULL == entries) {
-        LDAPDebug(LDAP_DEBUG_ANY, "WARNING: entire cn=tasks tree seems to "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "WARNING: entire cn=tasks tree seems to "
                   "be AWOL!\n", 0, 0, 0);
         slapi_pblock_destroy(pb);
         return;
@@ -2836,7 +2836,7 @@ void task_init(void)
 {
     global_task_lock = PR_NewLock();
     if (global_task_lock == NULL) {
-        LDAPDebug(LDAP_DEBUG_ANY, "unable to create global tasks lock! "
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "unable to create global tasks lock! "
                   "(that's bad)\n", 0, 0, 0);
         return;
     }
@@ -2866,7 +2866,7 @@ void task_shutdown(void)
             (task->task_state != SLAPI_TASK_FINISHED)) {
             task->task_state = SLAPI_TASK_CANCELLED;
             if (task->cancel) {
-                LDAPDebug(LDAP_DEBUG_ANY, "Cancelling task '%s'\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Cancelling task '%s'\n",
                           task->task_dn, 0, 0);
                 (*task->cancel)(task);
                 found_any = 1;
diff --git a/ldap/servers/slapd/tools/mmldif.c b/ldap/servers/slapd/tools/mmldif.c
index ddfaf6c..35c594a 100644
--- a/ldap/servers/slapd/tools/mmldif.c
+++ b/ldap/servers/slapd/tools/mmldif.c
@@ -320,11 +320,11 @@ int mm_diff(stats_t *statsp)
     for (i = 0; i < ndirectories; i++) {
         pindex = i / 32;
         pmask = 1 << (i % 32);
-        LDAPDebug(LDAP_DEBUG_TRACE, "finger printing directory %d\n", i, 0, 0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "finger printing directory %d\n", i, 0, 0);
         while (TRUE) {
             stat = readrec(&edfin[i], &attrib);
             if (stat == IDDS_MM_ABSENT) {
-                LDAPDebug(LDAP_DEBUG_TRACE, "ignored: %s: %s\n", 
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ignored: %s: %s\n", 
                                  attrib->name, attrib->value, 0);
                 continue;
             }
@@ -335,7 +335,7 @@ int mm_diff(stats_t *statsp)
                 return stat;
             }
             records++;
-            LDAPDebug(LDAP_DEBUG_TRACE, "db%d: %s: %s\n", 
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "db%d: %s: %s\n", 
                              i, attrib->name, attrib->value);
             hashname(seed, attrib, hashkey.data);
             key = hashkey.key & hashmask;
@@ -348,7 +348,7 @@ int mm_diff(stats_t *statsp)
                     hashentry = hashentry->overflow;
                 if (hashentry != NULL) {
                     if (hashentry->present[pindex] & pmask) {
-                        LDAPDebug(LDAP_DEBUG_TRACE, 
+                        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
                                          "duplicate DN <%s=%s> (ignored)\n",
                                          attrib->name, attrib->value, 0);
                         if (emitchanges) {
@@ -364,14 +364,14 @@ int mm_diff(stats_t *statsp)
                         hashentry->present[pindex] |= pmask;
                         hashvalue(seed, attrib, fingerprint);
                         if (memcmp(fingerprint, hashentry->fingerprint, 16)) {
-                            LDAPDebug(LDAP_DEBUG_TRACE, 
+                            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 				      "...data modified\n", key, 0, 0);
                             hashentry->flags = MODIFIED;
                         }
                     }
                     continue;
                 }
-                LDAPDebug(LDAP_DEBUG_TRACE, "overflow in key %u\n", key, 0, 0);
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "overflow in key %u\n", key, 0, 0);
                 hashentry2 = entryalloc();
                 hashentry2->overflow = hashtable[key];
                 hashentry = hashtable[key] = hashentry2;
@@ -406,12 +406,12 @@ int mm_diff(stats_t *statsp)
         rewind(edfin[i].fp);
         edfin[i].end = FALSE;
 
-        LDAPDebug(LDAP_DEBUG_TRACE, 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 		  "loading authoritative data from directory %d\n", i, 0, 0);
         while (TRUE) {
             stat = readrec(&edfin[i], &attrib);
             if (stat == IDDS_MM_ABSENT) {
-                LDAPDebug(LDAP_DEBUG_TRACE, "ignored: %s: %s\n", 
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ignored: %s: %s\n", 
 			  attrib->name, attrib->value, 0);
                     continue;
             }
@@ -421,7 +421,7 @@ int mm_diff(stats_t *statsp)
                 free(hashtable);
                 return stat;
             }
-            LDAPDebug(LDAP_DEBUG_TRACE, "db%d: %s: %s\n", 
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "db%d: %s: %s\n", 
 		      i, attrib->name, attrib->value);
             hashname(seed, attrib, hashkey.data);
             key = hashkey.key & hashmask;
@@ -430,14 +430,14 @@ int mm_diff(stats_t *statsp)
                    memcmp(hashentry->key, hashkey.data, 16))
                 hashentry = hashentry->overflow;
             if (hashentry == NULL) {
-                LDAPDebug(LDAP_DEBUG_TRACE, "...hash entry not found\n", 0, 0, 0);
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "...hash entry not found\n", 0, 0, 0);
                     continue;
             }
             if (!(hashentry->flags & LOADED))
             {
                 hashentry->first = newrecord(attrib);
                 hashentry->flags |= LOADED;
-                LDAPDebug(LDAP_DEBUG_TRACE, " ...data loaded\n", 0, 0, 0);
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, " ...data loaded\n", 0, 0, 0);
                     hashentry->db = i;
                 continue;
             }
@@ -445,7 +445,7 @@ int mm_diff(stats_t *statsp)
                 continue;
             if (mm_get_winner(hashentry->first, attrib)) {
                 hashentry->flags |= LOADED;
-                LDAPDebug(LDAP_DEBUG_TRACE, " ...winner data loaded\n", 0, 0, 0);
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, " ...winner data loaded\n", 0, 0, 0);
                 hashentry->db = i;
                 free(hashentry->first);
                 hashentry->first = newrecord(attrib);
@@ -473,12 +473,12 @@ int mm_diff(stats_t *statsp)
         rewind(edfin[i].fp);
         edfin[i].end = FALSE;
 
-        LDAPDebug(LDAP_DEBUG_TRACE, 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, 
 		  "generating differences for directory %d\n", i, 0, 0);
         while (TRUE) {
             stat = readrec(&edfin[i], &attrib);
             if (stat == IDDS_MM_ABSENT) {
-                LDAPDebug(LDAP_DEBUG_TRACE, "ignored: %s: %s\n", 
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "ignored: %s: %s\n", 
 			  attrib->name, attrib->value, 0);
                 continue;
             }
@@ -488,7 +488,7 @@ int mm_diff(stats_t *statsp)
                 free(hashtable);
                 return stat;
             }
-            LDAPDebug(LDAP_DEBUG_TRACE, "db%d: %s: %s\n", 
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "db%d: %s: %s\n", 
 		      i, attrib->name, attrib->value);
             hashname(seed, attrib, hashkey.data);
             key = hashkey.key & hashmask;
@@ -497,7 +497,7 @@ int mm_diff(stats_t *statsp)
                    memcmp(hashentry->key, hashkey.data, 16))
                 hashentry = hashentry->overflow;
             if (hashentry == NULL) {
-                LDAPDebug(LDAP_DEBUG_TRACE, "...hash entry not found\n", 0, 0, 0);
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "...hash entry not found\n", 0, 0, 0);
                     continue;
             }
             if (hashentry->flags & IDENTITY)
@@ -507,10 +507,10 @@ int mm_diff(stats_t *statsp)
             hashvalue(seed, attrib, fingerprint);
             if (memcmp(fingerprint, hashentry->fingerprint, 16)) {
                 if (mm_is_deleted(hashentry->first, attrib, 0)) {
-                    LDAPDebug(LDAP_DEBUG_TRACE, " ...deleted\n", 0, 0, 0);
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, " ...deleted\n", 0, 0, 0);
                     adddelete(edfout[i], attrib);
                 } else {
-                    LDAPDebug(LDAP_DEBUG_TRACE, " ...modified\n", 0, 0, 0);
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, " ...modified\n", 0, 0, 0);
                     addmodified(edfout[i], attrib, hashentry->first);
                 }
             }
@@ -525,7 +525,7 @@ int mm_diff(stats_t *statsp)
  *      no action is needed here.  Otherwise we emit an add.
  *      we take this opportunity to free the memory.
  */
-    LDAPDebug(LDAP_DEBUG_TRACE, "scanning db for new entries\n", 0, 0, 0);
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "scanning db for new entries\n", 0, 0, 0);
     for (h = 0; h < 0x1000; h++) {
         for (hashentry = hashtable[h]; hashentry; hashentry = overflow) {
             if (!hashentry->flags)
@@ -539,7 +539,7 @@ int mm_diff(stats_t *statsp)
                 if (mm_is_deleted(hashentry->first, NULL, 0)) continue;
                 added++;
                 if (!emitchanges) continue;
-                LDAPDebug(LDAP_DEBUG_TRACE, " ...add new\n", 0, 0, 0);
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, " ...add new\n", 0, 0, 0);
                 addnew(edfout[i], "add", hashentry->first);
             }
 
@@ -737,7 +737,7 @@ readrec(edfFILE * edf1, attrib1_t ** attrib)
         }
         vptr = strchr(line, ':');
         if (!vptr) {
-            LDAPDebug(LDAP_DEBUG_TRACE, "%s\n invalid input line\n", 
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "%s\n invalid input line\n", 
                              line, 0, 0);
             continue;           /* invalid line, but we'll just skip it */
         }
@@ -766,7 +766,7 @@ readrec(edfFILE * edf1, attrib1_t ** attrib)
             while (*vptr == ' ') vptr++; /* skip optional spaces */
             b64 = initDec64((unsigned char *)att->value, 0x20000);
             if (Dec64(b64, (unsigned char *) vptr)) {
-                LDAPDebug(LDAP_DEBUG_TRACE, "%s\n invalid input line\n", line, 0, 0);
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "%s\n invalid input line\n", line, 0, 0);
                 continue;       /* invalid line, but we'll just skip it */
             }
             toolong = FALSE;
@@ -788,14 +788,14 @@ readrec(edfFILE * edf1, attrib1_t ** attrib)
                 rc = Dec64(b64, (unsigned char *)line);
                 if (rc == -1)
                 {
-                    LDAPDebug(LDAP_DEBUG_TRACE, "%s\n invalid input line\n", line, 0, 0);
+                    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "%s\n invalid input line\n", line, 0, 0);
                     continue;   /* invalid line, but we'll just skip it */
                 }
 
                 if (rc) {
                     if (!toolong) {
                         toolong = TRUE;
-                        LDAPDebug(LDAP_DEBUG_TRACE, "%s\n line too long\n", line, 0, 0);
+                        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "%s\n line too long\n", line, 0, 0);
                     }
                     continue;
                 }
diff --git a/ldap/servers/slapd/unbind.c b/ldap/servers/slapd/unbind.c
index c0dec9d..580dfba 100644
--- a/ldap/servers/slapd/unbind.c
+++ b/ldap/servers/slapd/unbind.c
@@ -39,7 +39,7 @@ do_unbind( Slapi_PBlock *pb )
 	int		err;
 	int ignore_criticality = 1;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "do_unbind\n", 0, 0, 0 );
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "do_unbind\n", 0, 0, 0 );
 
 	slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
 	ber = operation->o_ber;
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 0a37862..94e46ab 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -333,7 +333,7 @@ filter_stuff_func(void *arg, const char *val, PRUint32 slen)
             raw_filter.bv_val = (char *)buf;
             raw_filter.bv_len = filter_len;
             if(ldap_bv2escaped_filter_value(&raw_filter, &escaped_filter) != 0){
-                LDAPDebug(LDAP_DEBUG_TRACE, "slapi_filter_sprintf: failed to escape filter value(%s)\n",val,0,0);
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "slapi_filter_sprintf: failed to escape filter value(%s)\n",val,0,0);
                 ctx->next_arg_needs_esc_norm = 0;
                 return -1;
             } else {
@@ -345,7 +345,7 @@ filter_stuff_func(void *arg, const char *val, PRUint32 slen)
             buf = slapi_ch_calloc(sizeof(char), filter_len*3 + 1);
             val2 = (char *)do_escape_string(val, filter_len, buf, special_filter);
             if(val2 == NULL){
-                LDAPDebug(LDAP_DEBUG_TRACE, "slapi_filter_sprintf: failed to escape filter value(%s)\n",val,0,0);
+                LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "slapi_filter_sprintf: failed to escape filter value(%s)\n",val,0,0);
                 ctx->next_arg_needs_esc_norm = 0;
                 slapi_ch_free_string(&buf);
                 return -1;
@@ -473,7 +473,7 @@ slapi_escape_filter_value(char* filter_str, int len)
     raw_filter.bv_val = filter_str;
     raw_filter.bv_len = filter_len;
     if(ldap_bv2escaped_filter_value(&raw_filter, &escaped_filter) != 0){
-        LDAPDebug(LDAP_DEBUG_TRACE, "slapi_escape_filter_value: failed to escape filter value(%s)\n",filter_str,0,0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "slapi_escape_filter_value: failed to escape filter value(%s)\n",filter_str,0,0);
         return NULL;
     } else {
         return escaped_filter.bv_val;
@@ -932,7 +932,7 @@ rel2abspath_ext( char *relpath, char *cwd )
         if ( NULL == cwd ) {
             if ( getcwd( abspath, MAXPATHLEN ) == NULL ) {
                 perror( "getcwd" );
-                LDAPDebug( LDAP_DEBUG_ANY, "Cannot determine current directory\n",
+                LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Cannot determine current directory\n",
                         0, 0, 0 );
                 exit( 1 );
             }
@@ -941,7 +941,7 @@ rel2abspath_ext( char *relpath, char *cwd )
         }
     
         if ( strlen( relpath ) + strlen( abspath ) + 1  > MAXPATHLEN ) {
-            LDAPDebug( LDAP_DEBUG_ANY, "Pathname \"%s" _PSEP "%s\" too long\n",
+            LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Pathname \"%s" _PSEP "%s\" too long\n",
                     abspath, relpath, 0 );
             exit( 1 );
         }
@@ -1003,7 +1003,7 @@ void slapd_nasty(char* str, int c, int err)
 	char *msg = NULL;
 	char buffer[100];
 	PR_snprintf(buffer,sizeof(buffer), "%s BAD %d",str,c);
-	LDAPDebug(LDAP_DEBUG_ANY,"%s, err=%d %s\n",buffer,err,(msg = strerror( err )) ? msg : "");
+	LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"%s, err=%d %s\n",buffer,err,(msg = strerror( err )) ? msg : "");
 }
 
 /* ***************************************************
@@ -1648,9 +1648,9 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
         }
 
         /* Pages is the total ram on the system. */
-        LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages pages=%lu, \n", 
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_info_sys_pages pages=%lu, \n", 
             (unsigned long) *pages, 0,0);
-        LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for pages \n",0,0,0);
+        LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_info_sys_pages using pages for pages \n",0,0,0);
 
         /* Availpages is how much we *could* alloc. We should take the smallest:
          * - pages
@@ -1658,21 +1658,21 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
          * - freesize
          */
         if (rlimsize == RLIM_INFINITY) {
-            LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages pages=%lu, getrlim=RLIM_INFINITY, freesize=%lu\n",
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_info_sys_pages pages=%lu, getrlim=RLIM_INFINITY, freesize=%lu\n",
                 (unsigned long)*pages, (unsigned long)freesize, 0);
         } else {
-            LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages pages=%lu, getrlim=%lu, freesize=%lu\n",
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_info_sys_pages pages=%lu, getrlim=%lu, freesize=%lu\n",
                 (unsigned long)*pages, (unsigned long)*availpages, (unsigned long)freesize);
         }
 
         if (rlimsize != RLIM_INFINITY && rlimsize < freesize && rlimsize < *pages && rlimsize > 0) {
-            LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using getrlim for availpages \n",0,0,0);
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_info_sys_pages using getrlim for availpages \n",0,0,0);
             *availpages = rlimsize;
         } else if (freesize < *pages && freesize > 0) {
-            LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using freesize for availpages \n",0,0,0);
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_info_sys_pages using freesize for availpages \n",0,0,0);
             *availpages = freesize;
         } else {
-            LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for availpages \n",0,0,0);
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_info_sys_pages using pages for availpages \n",0,0,0);
             *availpages = *pages;
         }
 
@@ -1733,7 +1733,7 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
 #define GIGABYTE (1024*1024*1024)
         size_t one_gig_pages = GIGABYTE / *pagesize;
         if (*pages > (2 * one_gig_pages) ) {
-            LDAPDebug(LDAP_DEBUG_TRACE,"More than 2Gbytes physical memory detected. Since this is a 32-bit process, truncating memory size used for auto cache calculations to 2Gbytes\n",
+            LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"More than 2Gbytes physical memory detected. Since this is a 32-bit process, truncating memory size used for auto cache calculations to 2Gbytes\n",
                 0, 0, 0);
             *pages = (2 * one_gig_pages);
         }
@@ -1782,13 +1782,13 @@ int util_is_cachesize_sane(size_t *cachesize)
      */
 
     cachepages = *cachesize / pagesize;
-    LDAPDebug(LDAP_DEBUG_TRACE,"util_is_cachesize_sane cachesize=%lu / pagesize=%lu \n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_is_cachesize_sane cachesize=%lu / pagesize=%lu \n",
         (unsigned long)*cachesize,(unsigned long)pagesize,0);
 
 #ifdef LINUX
     /* Linux we calculate availpages correctly, so USE IT */
     issane = (int)(cachepages <= availpages);
-    LDAPDebug(LDAP_DEBUG_TRACE,"util_is_cachesize_sane cachepages=%lu <= availpages=%lu\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_is_cachesize_sane cachepages=%lu <= availpages=%lu\n",
         (unsigned long)cachepages,(unsigned long)availpages,0);
 
     if (!issane) {
@@ -1805,11 +1805,11 @@ int util_is_cachesize_sane(size_t *cachesize)
 #else
     size_t freepages = 0;
     freepages = pages - procpages;
-    LDAPDebug(LDAP_DEBUG_TRACE,"util_is_cachesize_sane pages=%lu - procpages=%lu\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_is_cachesize_sane pages=%lu - procpages=%lu\n",
         (unsigned long)pages,(unsigned long)procpages,0);
 
     issane = (int)(cachepages <= freepages);
-    LDAPDebug(LDAP_DEBUG_TRACE,"util_is_cachesize_sane cachepages=%lu <= freepages=%lu\n",
+    LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG,"util_is_cachesize_sane cachepages=%lu <= freepages=%lu\n",
         (unsigned long)cachepages,(unsigned long)freepages,0);
 
     if (!issane) {
diff --git a/ldap/servers/slapd/value.c b/ldap/servers/slapd/value.c
index 6eaa4cf..3c9ea02 100644
--- a/ldap/servers/slapd/value.c
+++ b/ldap/servers/slapd/value.c
@@ -562,7 +562,7 @@ value_size(const Slapi_Value *v)
 static void
 value_dump( const Slapi_Value *value, const char *text)
 {
-    LDAPDebug( LDAP_DEBUG_ANY, "Slapi_Value %s ptr=%lx\n", text, value, 0);
+    LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "Slapi_Value %s ptr=%lx\n", text, value, 0);
 	/* JCM - Dump value contents... */
 }
 #endif
diff --git a/ldap/servers/slapd/valueset.c b/ldap/servers/slapd/valueset.c
index 35f02c1..909c2d9 100644
--- a/ldap/servers/slapd/valueset.c
+++ b/ldap/servers/slapd/valueset.c
@@ -894,7 +894,7 @@ valueset_value_syntax_cmp( const Slapi_Attr *a, const Slapi_Value *v1, const Sla
 		 * generate the keys will be found (there exists a default plugin)
 		 * log an error and continue.
 		 */
-		LDAPDebug( LDAP_DEBUG_ANY, "valueset_value_syntax_cmp: "
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "valueset_value_syntax_cmp: "
 		    "slapi_attr_values2keys_sv failed for type %s\n",
 		    a->a_type, 0, 0 );
 	} else {
@@ -1290,7 +1290,7 @@ valueset_remove_valuearray(Slapi_ValueSet *vs, const Slapi_Attr *a, Slapi_Value
 			{
 				if((flags & SLAPI_VALUE_FLAG_IGNOREERROR) == 0)
 				{
-					LDAPDebug( LDAP_DEBUG_ARGS,"could not find value %d for attr %s\n", i-1, a->a_type, 0 );
+					LDAPDebug(LDAP_DEBUG_ARGS, LOG_DEBUG,"could not find value %d for attr %s\n", i-1, a->a_type, 0 );
 					rc= LDAP_NO_SUCH_ATTRIBUTE;
 				}
 			}
diff --git a/ldap/servers/slapd/vattr.c b/ldap/servers/slapd/vattr.c
index 577a8e7..ecc54a1 100644
--- a/ldap/servers/slapd/vattr.c
+++ b/ldap/servers/slapd/vattr.c
@@ -623,7 +623,7 @@ slapi_vattr_values_get_sp(vattr_context *c,
       if(!vattr_context_is_loop_msg_displayed(&c))
       {
         /* Print a handy error log message */
-        LDAPDebug(LDAP_DEBUG_ANY,
+        LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,
           "Detected virtual attribute loop in get on entry %s, attribute %s\n",
           slapi_entry_get_dn_const(e), type, 0);
         vattr_context_set_loop_msg_displayed(&c);
@@ -831,7 +831,7 @@ int slapi_vattr_namespace_values_get_sp(vattr_context *c,
 			/* Print a handy error log message */
 			if(!vattr_context_is_loop_msg_displayed(&c))
 			{
-				LDAPDebug(LDAP_DEBUG_ANY,"Detected virtual attribute loop in get on entry %s, attribute %s\n", slapi_entry_get_dn_const(e), type, 0);
+				LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Detected virtual attribute loop in get on entry %s, attribute %s\n", slapi_entry_get_dn_const(e), type, 0);
 				vattr_context_set_loop_msg_displayed(&c);
 			}
 			return rc;
@@ -1060,7 +1060,7 @@ int slapi_vattr_namespace_value_compare_sp(vattr_context *c,/* Entry we're inter
 	if (0 != rc) {
 		if(!vattr_context_is_loop_msg_displayed(&c)) {
 			/* Print a handy error log message */
-			LDAPDebug(LDAP_DEBUG_ANY,"Detected virtual attribute loop in compare on entry %s, attribute %s\n", slapi_entry_get_dn_const(e), type, 0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR,"Detected virtual attribute loop in compare on entry %s, attribute %s\n", slapi_entry_get_dn_const(e), type, 0);
 			vattr_context_set_loop_msg_displayed(&c);
 		}
 		return rc;
@@ -1197,7 +1197,7 @@ int slapi_vattr_list_attrs(/* Entry we're interested in */ Slapi_Entry *e,
 	vattr_type_list_context type_context = {0};
 
 	if (NULL == types || NULL == buffer_flags) {
-		LDAPDebug(LDAP_DEBUG_ANY, "slapi_vattr_list_attrs: invalid param\n", 0, 0, 0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "slapi_vattr_list_attrs: invalid param\n", 0, 0, 0);
 		return -1;
 	}
 
@@ -1946,7 +1946,7 @@ int vattr_add_attrval(objAttrValue **attrval, char *val)
 	int ret = 0;
 	objAttrValue *theVal;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> vattr_add_attrval\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> vattr_add_attrval\n",0,0,0);
 
 	/* create the attrvalue */
 	theVal = (objAttrValue*) slapi_ch_malloc(sizeof(objAttrValue));
@@ -1961,17 +1961,17 @@ int vattr_add_attrval(objAttrValue **attrval, char *val)
 		else
 		{
 			slapi_ch_free((void**)&theVal);
-			LDAPDebug( LDAP_DEBUG_ANY, "vattr_add_attrval: failed to allocate memory\n",0,0,0);
+			LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vattr_add_attrval: failed to allocate memory\n",0,0,0);
 			ret = -1;
 		}
 	}
 	else
 	{
-		LDAPDebug( LDAP_DEBUG_ANY, "vattr_add_attrval: failed to allocate memory\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_ANY, LOG_ERR, "vattr_add_attrval: failed to allocate memory\n",0,0,0);
 		ret = -1;
 	}
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- vattr_add_attrval\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- vattr_add_attrval\n",0,0,0);
 	return ret;
 }
 
@@ -1981,7 +1981,7 @@ objAttrValue *vattr_map_entry_build_schema(char *type_name)
 	objAttrValue *ret = 0;
 	struct objclass	*oc;
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "--> vattr_map_entry_build_schema\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "--> vattr_map_entry_build_schema\n",0,0,0);
 
 	/* this is the first opportunity to register
 	 * with the statechange api, our init function
@@ -2000,7 +2000,7 @@ objAttrValue *vattr_map_entry_build_schema(char *type_name)
 
 	if(!config_get_schemacheck())
 	{
-		LDAPDebug( LDAP_DEBUG_TRACE, "<-- vattr_map_entry_build_schema - schema off\n",0,0,0);
+		LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- vattr_map_entry_build_schema - schema off\n",0,0,0);
 		return 0;
 	}
 
@@ -2038,7 +2038,7 @@ objAttrValue *vattr_map_entry_build_schema(char *type_name)
 	}
     oc_unlock();
 
-	LDAPDebug( LDAP_DEBUG_TRACE, "<-- vattr_map_entry_build_schema\n",0,0,0);
+	LDAPDebug(LDAP_DEBUG_TRACE, LOG_DEBUG, "<-- vattr_map_entry_build_schema\n",0,0,0);
 	return ret;
 }
 
-- 
2.7.4

