diff --git a/src/lib-sieve/sieve-script.c b/src/lib-sieve/sieve-script.c
index a3d73f5fcae42670d2f5de1b03357a266414453b..7718feb71e11b6292f3a668c8528229386d364a5 100644
--- a/src/lib-sieve/sieve-script.c
+++ b/src/lib-sieve/sieve-script.c
@@ -177,12 +177,10 @@ int sieve_script_open(struct sieve_script *script, enum sieve_error *error_r)
 	script->open = TRUE;
 
 	if (*script->name != '\0') {
-		sieve_script_sys_debug(script,
-			"Opened script `%s' from `%s'",
+		e_debug(script->event, "Opened script `%s' from `%s'",
 			script->name, script->location);
 	} else {
-		sieve_script_sys_debug(script,
-			"Opened nameless script from `%s'",
+		e_debug(script->event, "Opened nameless script from `%s'",
 			script->location);
 	}
 	return 0;
@@ -377,7 +375,7 @@ int sieve_script_binary_read_metadata(struct sieve_script *script,
 		return -1;
 	}
 	if (strcmp(str_c(storage_class), script->driver_name) != 0) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' reports unexpected driver name for script `%s' "
 			"(`%s' rather than `%s')",
 			sieve_binary_path(sbin), script->location,
@@ -394,7 +392,7 @@ int sieve_script_binary_read_metadata(struct sieve_script *script,
 		return -1;
 	}
 	if (script->storage->version != version) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' was compiled with "
 			"a different version of the `%s' script storage class "
 			"(compiled v%d, expected v%d; "
@@ -414,10 +412,11 @@ int sieve_script_binary_read_metadata(struct sieve_script *script,
 	}
 	i_assert(script->location != NULL);
 	if (strcmp(str_c(location), script->location) != 0) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' reports different location "
 			"for script `%s' (binary points to `%s')",
-			sieve_binary_path(sbin), script->location, str_c(location));
+			sieve_binary_path(sbin), script->location,
+			str_c(location));
 		return 0;
 	}
 
diff --git a/src/lib-sieve/storage/dict/sieve-dict-script.c b/src/lib-sieve/storage/dict/sieve-dict-script.c
index dc49dd5eff997b60ec229a173b4e6f885e6a2de2..67850f049674ae7c6ae1f0a92787017a27eb8ee5 100644
--- a/src/lib-sieve/storage/dict/sieve-dict-script.c
+++ b/src/lib-sieve/storage/dict/sieve-dict-script.c
@@ -89,7 +89,7 @@ static int sieve_dict_script_open
 				"Failed to lookup script id from path %s: %s", path, error);
 			*error_r = SIEVE_ERROR_TEMP_FAILURE;
 		} else {
-			sieve_script_sys_debug(script,
+			e_debug(script->event,
 				"Script `%s' not found at path %s", name, path);
 			sieve_script_set_error(script,
 				SIEVE_ERROR_NOT_FOUND,
@@ -163,7 +163,7 @@ static int sieve_dict_script_binary_read_metadata
 	}
 	i_assert( dscript->data_id != NULL );
 	if ( strcmp(str_c(data_id), dscript->data_id) != 0 ) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' reports different data ID for script `%s' "
 			"(`%s' rather than `%s')",
 			sieve_binary_path(sbin), sieve_script_location(script),
diff --git a/src/lib-sieve/storage/file/sieve-file-script.c b/src/lib-sieve/storage/file/sieve-file-script.c
index 8f63059d57406f4ac09265209ee382f4fd3a7416..3c4ec606484ad00ab9ed79a27e110ed28c3d6e97 100644
--- a/src/lib-sieve/storage/file/sieve-file-script.c
+++ b/src/lib-sieve/storage/file/sieve-file-script.c
@@ -67,8 +67,7 @@ static void sieve_file_script_handle_error
 			*error_r = SIEVE_ERROR_TEMP_FAILURE;
 			break;
 		}
-		sieve_script_sys_debug(script, "File `%s' not found",
-				       abspath);
+		e_debug(script->event, "File `%s' not found", abspath);
 		sieve_script_set_error(script,
 			SIEVE_ERROR_NOT_FOUND,
 			"Sieve script `%s' not found", name);
@@ -496,7 +495,7 @@ static int sieve_file_script_binary_read_metadata
 		(bstat->st_mtime == sstat->st_mtime &&
 			ST_MTIME_NSEC(*bstat) <= ST_MTIME_NSEC(*sstat)) ) {
 		if ( svinst->debug ) {
-			sieve_script_sys_debug(script,
+			e_debug(script->event,
 				"Sieve binary `%s' is not newer "
 				"than the Sieve script `%s' (%s.%lu <= %s.%lu)",
 				sieve_binary_path(sbin), sieve_script_location(script),
diff --git a/src/lib-sieve/storage/ldap/sieve-ldap-script.c b/src/lib-sieve/storage/ldap/sieve-ldap-script.c
index f59c9fcfdc5b636781dc098f5eeb4dc3efa05a6c..1c732db09a79be41eaf9325e2d7919b0b08ef283 100644
--- a/src/lib-sieve/storage/ldap/sieve-ldap-script.c
+++ b/src/lib-sieve/storage/ldap/sieve-ldap-script.c
@@ -74,8 +74,7 @@ static int sieve_ldap_script_open
 	if ( (ret=sieve_ldap_db_lookup_script(lstorage->conn,
 		script->name, &lscript->dn, &lscript->modattr)) <= 0 ) {
 		if ( ret == 0 ) {
-			sieve_script_sys_debug(script,
-				"Script entry not found");
+			e_debug(script->event, "Script entry not found");
 			sieve_script_set_error(script,
 				SIEVE_ERROR_NOT_FOUND,
 				"Sieve script not found");
@@ -105,8 +104,7 @@ static int sieve_ldap_script_get_stream
 	if ( (ret=sieve_ldap_db_read_script(
 		lstorage->conn, lscript->dn, stream_r)) <= 0 ) {
 		if ( ret == 0 ) {
-			sieve_script_sys_debug(script,
-				"Script attribute not found");
+			e_debug(script->event, "Script attribute not found");
 			sieve_script_set_error(script,
 				SIEVE_ERROR_NOT_FOUND,
 				"Sieve script not found");
@@ -136,7 +134,7 @@ static int sieve_ldap_script_binary_read_metadata
 	/* config file changed? */
 	if ( bmtime <= lstorage->set_mtime ) {
 		if ( svinst->debug ) {
-			sieve_script_sys_debug(script,
+			e_debug(script->event,
 				"Sieve binary `%s' is not newer "
 				"than the LDAP configuration `%s' (%s <= %s)",
 				sieve_binary_path(sbin), lstorage->config_file,
@@ -171,7 +169,7 @@ static int sieve_ldap_script_binary_read_metadata
 	}
 	i_assert( lscript->dn != NULL );
 	if ( strcmp(str_c(dn), lscript->dn) != 0 ) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' reports different LDAP DN for script `%s' "
 			"(`%s' rather than `%s')",
 			sieve_binary_path(sbin), sieve_script_location(script),
@@ -188,7 +186,7 @@ static int sieve_ldap_script_binary_read_metadata
 		return -1;
 	}
 	if ( strcmp(str_c(modattr), lscript->modattr) != 0 ) {
-		sieve_script_sys_debug(script,
+		e_debug(script->event,
 			"Binary `%s' reports different modified attribute content "
 			"for script `%s' (`%s' rather than `%s')",
 			sieve_binary_path(sbin), sieve_script_location(script),