[cyrus-imapd] reduce noisy logging, add option to turn on LOG_DEBUG syslog messages again (thanks Philip Prindevil

Michal Hlavinka mhlavink at fedoraproject.org
Tue Nov 22 13:48:13 UTC 2011


commit e0b805b4c7227e718ba82174d6190daa73f6940e
Author: Michal Hlavinka <mhlavink at redhat.com>
Date:   Tue Nov 22 14:48:07 2011 +0100

    reduce noisy logging, add option to turn on LOG_DEBUG syslog
    messages again (thanks Philip	Prindeville) (#754940)

 cyrus-imapd-2.4.12-debugopt.patch |  109 +++++++++++++++++++++++++++++++++++++
 cyrus-imapd.spec                  |   10 +++-
 2 files changed, 118 insertions(+), 1 deletions(-)
---
diff --git a/cyrus-imapd-2.4.12-debugopt.patch b/cyrus-imapd-2.4.12-debugopt.patch
new file mode 100644
index 0000000..170a994
--- /dev/null
+++ b/cyrus-imapd-2.4.12-debugopt.patch
@@ -0,0 +1,109 @@
+diff -up cyrus-imapd-2.4.12/imap/global.c.debugopt cyrus-imapd-2.4.12/imap/global.c
+--- cyrus-imapd-2.4.12/imap/global.c.debugopt	2011-10-04 21:53:03.000000000 +0200
++++ cyrus-imapd-2.4.12/imap/global.c	2011-11-22 14:24:28.272416643 +0100
+@@ -157,6 +157,10 @@ int cyrus_init(const char *alt_config, c
+ 	/* don't free the openlog() string! */
+     }
+ 
++    /* allow debug logging */
++    if (!config_debug)
++	setlogmask(~LOG_MASK(LOG_DEBUG));
++
+     /* Look up default partition */
+     config_defpartition = config_getstring(IMAPOPT_DEFAULTPARTITION);
+     for (p = (char *)config_defpartition; p && *p; p++) {
+diff -up cyrus-imapd-2.4.12/imap/tls.c.debugopt cyrus-imapd-2.4.12/imap/tls.c
+--- cyrus-imapd-2.4.12/imap/tls.c.debugopt	2011-10-04 21:53:03.000000000 +0200
++++ cyrus-imapd-2.4.12/imap/tls.c	2011-11-22 14:24:28.272416643 +0100
+@@ -255,9 +255,9 @@ static DH *load_dh_param(const char *key
+ 
+     if (ret == NULL) {
+ 	ret = get_dh1024();
+-	syslog(LOG_NOTICE, "imapd:Loading hard-coded DH parameters");
++	syslog(LOG_DEBUG, "imapd:Loading hard-coded DH parameters");
+     } else {
+-	syslog(LOG_NOTICE, "imapd:Loading DH parameters from file");
++	syslog(LOG_DEBUG, "imapd:Loading DH parameters from file");
+     }
+ 
+     if (bio != NULL) BIO_free(bio);
+diff -up cyrus-imapd-2.4.12/lib/imapoptions.debugopt cyrus-imapd-2.4.12/lib/imapoptions
+--- cyrus-imapd-2.4.12/lib/imapoptions.debugopt	2011-11-22 14:24:28.265416615 +0100
++++ cyrus-imapd-2.4.12/lib/imapoptions	2011-11-22 14:24:28.273416647 +0100
+@@ -388,6 +388,9 @@ Blank lines and lines beginning with ``#
+    hashing done on configuration directories.  This is recommended if
+    one partition has a very bushy mailbox tree. */
+ 
++{ "debug", 0, SWITCH }
++/* If enabled, allow syslog() to pass LOG_DEBUG messages. */
++
+ # Commented out - there's no such thing as "hostname_mechs", but we need
+ # this for the man page
+ # { "hostname_mechs", NULL, STRING }
+diff -up cyrus-imapd-2.4.12/lib/libconfig.c.debugopt cyrus-imapd-2.4.12/lib/libconfig.c
+--- cyrus-imapd-2.4.12/lib/libconfig.c.debugopt	2011-10-04 21:53:03.000000000 +0200
++++ cyrus-imapd-2.4.12/lib/libconfig.c	2011-11-22 14:24:28.274416650 +0100
+@@ -84,6 +84,7 @@ int config_auditlog;
+ unsigned config_maxword;
+ unsigned config_maxquoted;
+ int config_qosmarking;
++int config_debug;
+ 
+ /* declared in each binary that uses libconfig */
+ extern const int config_need_data;
+@@ -350,6 +351,9 @@ void config_read(const char *alt_config)
+ 
+     ival = config_getenum(IMAPOPT_QOSMARKING);
+     config_qosmarking = qos[ival];
++
++    /* allow debug logging */
++    config_debug = config_getswitch(IMAPOPT_DEBUG);
+ }
+ 
+ #define GROWSIZE 4096
+diff -up cyrus-imapd-2.4.12/lib/libconfig.h.debugopt cyrus-imapd-2.4.12/lib/libconfig.h
+--- cyrus-imapd-2.4.12/lib/libconfig.h.debugopt	2011-10-04 21:53:03.000000000 +0200
++++ cyrus-imapd-2.4.12/lib/libconfig.h	2011-11-22 14:24:28.274416650 +0100
+@@ -82,6 +82,7 @@ extern int config_auditlog;
+ extern unsigned config_maxquoted;
+ extern unsigned config_maxword;
+ extern int config_qosmarking;
++extern int config_debug;
+ 
+ /* config requirement flags */
+ #define CONFIG_NEED_PARTITION_DATA (1<<0)
+diff -up cyrus-imapd-2.4.12/master/master.c.debugopt cyrus-imapd-2.4.12/master/master.c
+--- cyrus-imapd-2.4.12/master/master.c.debugopt	2011-10-04 21:53:03.000000000 +0200
++++ cyrus-imapd-2.4.12/master/master.c	2011-11-22 14:30:47.243975974 +0100
+@@ -1984,7 +1984,7 @@ int main(int argc, char **argv)
+ 	if(pidlock_fd != -1) close(pidlock_fd);
+     }
+ 
+-    syslog(LOG_NOTICE, "process started");
++    syslog(LOG_DEBUG, "process started");
+ 
+ #if defined(HAVE_UCDSNMP) || defined(HAVE_NETSNMP)
+     /* initialize SNMP agent */
+@@ -2041,7 +2041,7 @@ int main(int argc, char **argv)
+     init_janitor();
+     
+     /* ok, we're going to start spawning like mad now */
+-    syslog(LOG_NOTICE, "ready for work");
++    syslog(LOG_DEBUG, "ready for work");
+ 
+     now = time(NULL);
+     for (;;) {
+diff -up cyrus-imapd-2.4.12/master/masterconf.c.debugopt cyrus-imapd-2.4.12/master/masterconf.c
+--- cyrus-imapd-2.4.12/master/masterconf.c.debugopt	2011-10-04 21:53:03.000000000 +0200
++++ cyrus-imapd-2.4.12/master/masterconf.c	2011-11-22 14:24:28.276416658 +0100
+@@ -99,6 +99,10 @@ int masterconf_init(const char *ident, c
+         /* don't free the openlog() string! */
+     }
+ 
++    /* drop debug messages locally */
++    if (!config_debug)
++	setlogmask(~LOG_MASK(LOG_DEBUG));
++
+     return 0;
+ }
+ 
diff --git a/cyrus-imapd.spec b/cyrus-imapd.spec
index a9a2517..cc47bf3 100644
--- a/cyrus-imapd.spec
+++ b/cyrus-imapd.spec
@@ -1,6 +1,6 @@
 Name: cyrus-imapd
 Version: 2.4.12
-Release: 3%{?dist}
+Release: 4%{?dist}
 
 %define ssl_pem_file %{_sysconfdir}/pki/%{name}/%{name}.pem
 
@@ -42,6 +42,9 @@ Patch6: cyrus-imapd-2.3.12p2-current-db.patch
 # temporary workaround, rhbz#553011, https://bugzilla.andrew.cmu.edu/show_bug.cgi?id=3206
 Patch7: cyrus-imapd-2.3.16-nodenny.patch
 
+# for c-i <= 2.4.12
+Patch8: cyrus-imapd-2.4.12-debugopt.patch
+
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 BuildRequires: autoconf
@@ -118,6 +121,7 @@ one running the server.
 %patch3 -p1 -b .flock
 %patch4 -p1 -b .authid_normalize
 %patch6 -p1 -b .libdb
+%patch8 -p1 -b .debugopt
 
 install -m 644 %{SOURCE4} %{SOURCE5} %{SOURCE11} doc/
 
@@ -477,6 +481,10 @@ fi
 %{_mandir}/man1/*
 
 %changelog
+* Tue Nov 22 2011 Michal Hlavinka <mhlavink at redhat.com> - 2.4.12-4
+- reduce noisy logging, add option to turn on LOG_DEBUG syslog 
+  messages again (thanks Philip	Prindeville) (#754940)
+
 * Mon Oct 24 2011 Michal Hlavinka <mhlavink at redhat.com> - 2.4.12-3
 - add login and digest-md5 as part of default auth mechanisms (#748278)
 


More information about the scm-commits mailing list