dovecot: Added debug logging.

dovecot at dovecot.org dovecot at dovecot.org
Sun Jul 15 22:32:15 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/6074e9e6059d
changeset: 6024:6074e9e6059d
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jul 15 22:30:14 2007 +0300
description:
Added debug logging.

diffstat:

1 file changed, 23 insertions(+), 3 deletions(-)
src/plugins/trash/trash-plugin.c |   26 +++++++++++++++++++++++---

diffs (60 lines):

diff -r 56879cc53cec -r 6074e9e6059d src/plugins/trash/trash-plugin.c
--- a/src/plugins/trash/trash-plugin.c	Sun Jul 15 15:30:00 2007 +0300
+++ b/src/plugins/trash/trash-plugin.c	Sun Jul 15 22:30:14 2007 +0300
@@ -188,8 +188,15 @@ __err:
 		mailbox_close(&trash->box);
 	}
 
-	if (size_expunged < size_needed)
+	if (size_expunged < size_needed) {
+		if (getenv("DEBUG") != NULL) {
+			i_info("trash plugin: Failed to remove enough messages "
+			       "(needed %llu bytes, expunged only %llu bytes)",
+			       (unsigned long long)size_needed,
+			       (unsigned long long)size_expunged);
+		}
 		return FALSE;
+	}
 
 	ctx->bytes_used = ctx->bytes_used > (int64_t)size_expunged ?
 		ctx->bytes_used - size_expunged : 0;
@@ -206,8 +213,13 @@ trash_quota_test_alloc(struct quota_tran
 
 	for (i = 0; ; i++) {
 		ret = trash_next_quota_test_alloc(ctx, size, too_large_r);
-		if (ret != 0 || *too_large_r)
+		if (ret != 0 || *too_large_r) {
+			if (getenv("DEBUG") != NULL && *too_large_r) {
+				i_info("trash plugin: Mail is larger than "
+				       "quota, won't even try to handle");
+			}
 			return ret;
+		}
 
 		if (i == MAX_RETRY_COUNT) {
 			/* trash_try_clean_mails() should have returned 0 if
@@ -261,6 +273,11 @@ static int read_configuration(const char
 		trash->name = p_strdup(config_pool, name+1);
 		trash->priority = atoi(t_strdup_until(line, name));
 		trash->search_arg.type = SEARCH_ALL;
+
+		if (getenv("DEBUG") != NULL) {
+			i_info("trash plugin: Added '%s' with priority %d",
+			       trash->name, trash->priority);
+		}
 	}
 	i_stream_destroy(&input);
 	(void)close(fd);
@@ -275,8 +292,11 @@ void trash_plugin_init(void)
 	const char *env;
 
 	env = getenv("TRASH");
-	if (env == NULL)
+	if (env == NULL) {
+		if (getenv("DEBUG") != NULL)
+			i_info("trash plugin: No trash setting, disabled");
 		return;
+	}
 
 	if (quota_set == NULL) {
 		i_error("trash plugin: quota plugin not initialized");


More information about the dovecot-cvs mailing list