e0b805b
diff -up cyrus-imapd-2.4.12/imap/global.c.debugopt cyrus-imapd-2.4.12/imap/global.c
e0b805b
--- cyrus-imapd-2.4.12/imap/global.c.debugopt	2011-10-04 21:53:03.000000000 +0200
e0b805b
+++ cyrus-imapd-2.4.12/imap/global.c	2011-11-22 14:24:28.272416643 +0100
e0b805b
@@ -157,6 +157,10 @@ int cyrus_init(const char *alt_config, c
e0b805b
 	/* don't free the openlog() string! */
e0b805b
     }
e0b805b
 
e0b805b
+    /* allow debug logging */
e0b805b
+    if (!config_debug)
e0b805b
+	setlogmask(~LOG_MASK(LOG_DEBUG));
e0b805b
+
e0b805b
     /* Look up default partition */
e0b805b
     config_defpartition = config_getstring(IMAPOPT_DEFAULTPARTITION);
e0b805b
     for (p = (char *)config_defpartition; p && *p; p++) {
e0b805b
diff -up cyrus-imapd-2.4.12/imap/tls.c.debugopt cyrus-imapd-2.4.12/imap/tls.c
e0b805b
--- cyrus-imapd-2.4.12/imap/tls.c.debugopt	2011-10-04 21:53:03.000000000 +0200
e0b805b
+++ cyrus-imapd-2.4.12/imap/tls.c	2011-11-22 14:24:28.272416643 +0100
e0b805b
@@ -255,9 +255,9 @@ static DH *load_dh_param(const char *key
e0b805b
 
e0b805b
     if (ret == NULL) {
e0b805b
 	ret = get_dh1024();
e0b805b
-	syslog(LOG_NOTICE, "imapd:Loading hard-coded DH parameters");
e0b805b
+	syslog(LOG_DEBUG, "imapd:Loading hard-coded DH parameters");
e0b805b
     } else {
e0b805b
-	syslog(LOG_NOTICE, "imapd:Loading DH parameters from file");
e0b805b
+	syslog(LOG_DEBUG, "imapd:Loading DH parameters from file");
e0b805b
     }
e0b805b
 
e0b805b
     if (bio != NULL) BIO_free(bio);
e0b805b
diff -up cyrus-imapd-2.4.12/lib/imapoptions.debugopt cyrus-imapd-2.4.12/lib/imapoptions
e0b805b
--- cyrus-imapd-2.4.12/lib/imapoptions.debugopt	2011-11-22 14:24:28.265416615 +0100
e0b805b
+++ cyrus-imapd-2.4.12/lib/imapoptions	2011-11-22 14:24:28.273416647 +0100
e0b805b
@@ -388,6 +388,9 @@ Blank lines and lines beginning with ``#
e0b805b
    hashing done on configuration directories.  This is recommended if
e0b805b
    one partition has a very bushy mailbox tree. */
e0b805b
 
e0b805b
+{ "debug", 0, SWITCH }
e0b805b
+/* If enabled, allow syslog() to pass LOG_DEBUG messages. */
e0b805b
+
e0b805b
 # Commented out - there's no such thing as "hostname_mechs", but we need
e0b805b
 # this for the man page
e0b805b
 # { "hostname_mechs", NULL, STRING }
e0b805b
diff -up cyrus-imapd-2.4.12/lib/libconfig.c.debugopt cyrus-imapd-2.4.12/lib/libconfig.c
e0b805b
--- cyrus-imapd-2.4.12/lib/libconfig.c.debugopt	2011-10-04 21:53:03.000000000 +0200
e0b805b
+++ cyrus-imapd-2.4.12/lib/libconfig.c	2011-11-22 14:24:28.274416650 +0100
e0b805b
@@ -84,6 +84,7 @@ int config_auditlog;
e0b805b
 unsigned config_maxword;
e0b805b
 unsigned config_maxquoted;
e0b805b
 int config_qosmarking;
e0b805b
+int config_debug;
e0b805b
 
e0b805b
 /* declared in each binary that uses libconfig */
e0b805b
 extern const int config_need_data;
e0b805b
@@ -350,6 +351,9 @@ void config_read(const char *alt_config)
e0b805b
 
e0b805b
     ival = config_getenum(IMAPOPT_QOSMARKING);
e0b805b
     config_qosmarking = qos[ival];
e0b805b
+
e0b805b
+    /* allow debug logging */
e0b805b
+    config_debug = config_getswitch(IMAPOPT_DEBUG);
e0b805b
 }
e0b805b
 
e0b805b
 #define GROWSIZE 4096
e0b805b
diff -up cyrus-imapd-2.4.12/lib/libconfig.h.debugopt cyrus-imapd-2.4.12/lib/libconfig.h
e0b805b
--- cyrus-imapd-2.4.12/lib/libconfig.h.debugopt	2011-10-04 21:53:03.000000000 +0200
e0b805b
+++ cyrus-imapd-2.4.12/lib/libconfig.h	2011-11-22 14:24:28.274416650 +0100
e0b805b
@@ -82,6 +82,7 @@ extern int config_auditlog;
e0b805b
 extern unsigned config_maxquoted;
e0b805b
 extern unsigned config_maxword;
e0b805b
 extern int config_qosmarking;
e0b805b
+extern int config_debug;
e0b805b
 
e0b805b
 /* config requirement flags */
e0b805b
 #define CONFIG_NEED_PARTITION_DATA (1<<0)
e0b805b
diff -up cyrus-imapd-2.4.12/master/master.c.debugopt cyrus-imapd-2.4.12/master/master.c
e0b805b
--- cyrus-imapd-2.4.12/master/master.c.debugopt	2011-10-04 21:53:03.000000000 +0200
e0b805b
+++ cyrus-imapd-2.4.12/master/master.c	2011-11-22 14:30:47.243975974 +0100
e0b805b
@@ -1984,7 +1984,7 @@ int main(int argc, char **argv)
e0b805b
 	if(pidlock_fd != -1) close(pidlock_fd);
e0b805b
     }
e0b805b
 
e0b805b
-    syslog(LOG_NOTICE, "process started");
e0b805b
+    syslog(LOG_DEBUG, "process started");
e0b805b
 
e0b805b
 #if defined(HAVE_UCDSNMP) || defined(HAVE_NETSNMP)
e0b805b
     /* initialize SNMP agent */
e0b805b
@@ -2041,7 +2041,7 @@ int main(int argc, char **argv)
e0b805b
     init_janitor();
e0b805b
     
e0b805b
     /* ok, we're going to start spawning like mad now */
e0b805b
-    syslog(LOG_NOTICE, "ready for work");
e0b805b
+    syslog(LOG_DEBUG, "ready for work");
e0b805b
 
e0b805b
     now = time(NULL);
e0b805b
     for (;;) {
e0b805b
diff -up cyrus-imapd-2.4.12/master/masterconf.c.debugopt cyrus-imapd-2.4.12/master/masterconf.c
e0b805b
--- cyrus-imapd-2.4.12/master/masterconf.c.debugopt	2011-10-04 21:53:03.000000000 +0200
e0b805b
+++ cyrus-imapd-2.4.12/master/masterconf.c	2011-11-22 14:24:28.276416658 +0100
e0b805b
@@ -99,6 +99,10 @@ int masterconf_init(const char *ident, c
e0b805b
         /* don't free the openlog() string! */
e0b805b
     }
e0b805b
 
e0b805b
+    /* drop debug messages locally */
e0b805b
+    if (!config_debug)
e0b805b
+	setlogmask(~LOG_MASK(LOG_DEBUG));
e0b805b
+
e0b805b
     return 0;
e0b805b
 }
e0b805b