Cgrulesengd is using different default logging level than the library. Currently
it's set to WARNING, which is not consistend with the rest of the library. This
patch sets the default logging level to ERROR.

This patch also unifies logging levels with default logging system used in
libcg, be removing LOG_NOTICE and replacing it with LOG_INFO.

Signed-off-by: Peter Schiffer <pschi...@redhat.com>
---
 doc/man/cgrulesengd.8    |    9 ++++-----
 src/daemon/cgrulesengd.c |   28 ++++++++++++++--------------
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/doc/man/cgrulesengd.8 b/doc/man/cgrulesengd.8
index 9566c23..2e89c5b 100644
--- a/doc/man/cgrulesengd.8
+++ b/doc/man/cgrulesengd.8
@@ -38,18 +38,17 @@ and '\fB-s\fR' are used together, the logs are sent to both 
destinations.
 Don't fork the daemon, stay in the foreground.
 .TP
 .B -v|--verbose
-Display more log messages. This option can be used twice to enable more 
verbose log
-messages.
+Display more log messages. This option can be used three times to enable more
+verbose log messages.
 .TP
 .B -q|--quiet
-Display less log messages. This option can be used twice to enable even less 
log
-messages and to only log errors.
+Display less log messages.
 .TP
 .B -Q|--nolog
 Disable logging.
 .TP
 .B -d|--debug
-Equivalent to '-nvvf -', i.e. don't fork the daemon, display all log messages 
and
+Equivalent to '-nvvvf -', i.e. don't fork the daemon, display all log messages 
and
 write them to the standard output.
 .TP
 .B -u <user>|--socket-user=<user>
diff --git a/src/daemon/cgrulesengd.c b/src/daemon/cgrulesengd.c
index bfca3b2..367b898 100644
--- a/src/daemon/cgrulesengd.c
+++ b/src/daemon/cgrulesengd.c
@@ -795,7 +795,7 @@ close_and_exit:
  * Start logging. Opens syslog and/or log file and sets log level.
  *     @param logp Path of the log file, NULL if no log file was specified
  *     @param logf Syslog facility, NULL if no facility was specified
- *     @param logv Log verbosity, 2 is the default, 0 = no logging, 4 = 
everything
+ *     @param logv Log verbosity, 1 is the default, 0 = no logging, 4 = 
everything
  */
 static void cgre_start_log(const char *logp, int logf, int logv)
 {
@@ -804,11 +804,11 @@ static void cgre_start_log(const char *logp, int logf, 
int logv)
 
        /* Log levels */
        int loglevels[] = {
-               LOG_EMERG,              /* -qq */
-               LOG_ERR,                /* -q */
-               LOG_NOTICE,             /* default */
-               LOG_INFO,               /* -v */
-               LOG_DEBUG               /* -vv */
+               LOG_EMERG,              /* -q */
+               LOG_ERR,                /* default */
+               LOG_WARNING,    /* -v */
+               LOG_INFO,               /* -vv */
+               LOG_DEBUG               /* -vvv */
        };
 
        /* Set default logging destination if nothing was specified */
@@ -862,7 +862,7 @@ static void cgre_start_log(const char *logp, int logf, int 
logv)
  *     @param logp Path of the log file, NULL if no log file was specified
  *     @param logf Syslog facility, 0 if no facility was specified
  *     @param daemon False to turn off daemon mode (no fork, leave FDs open)
- *     @param logv Log verbosity, 2 is the default, 0 = no logging, 5 = 
everything
+ *     @param logv Log verbosity, 1 is the default, 0 = no logging, 5 = 
everything
  *     @return 0 on success, > 0 on error
  */
 int cgre_start_daemon(const char *logp, const int logf,
@@ -936,7 +936,7 @@ void cgre_flash_rules(int signum)
        /* Current time */
        time_t tm = time(0);
 
-       flog(LOG_NOTICE, "Reloading rules configuration\n");
+       flog(LOG_INFO, "Reloading rules configuration\n");
        flog(LOG_DEBUG, "Current time: %s\n", ctime(&tm));
 
        /* Ask libcgroup to reload the rules table. */
@@ -962,8 +962,8 @@ void cgre_flash_templates(int signum)
        /* Current time */
        time_t tm = time(0);
 
-       flog(LOG_NOTICE, "Reloading templates configuration.");
-       flog(LOG_DEBUG, "Current time: %s", ctime(&tm));
+       flog(LOG_INFO, "Reloading templates configuration.\n");
+       flog(LOG_DEBUG, "Current time: %s\n", ctime(&tm));
 
        /* Ask libcgroup to reload the templates table. */
        cgroup_reload_cached_templates(CGCONFIG_CONF_FILE);
@@ -979,7 +979,7 @@ void cgre_catch_term(int signum)
        /* Current time */
        time_t tm = time(0);
 
-       flog(LOG_NOTICE, "Stopped CGroup Rules Engine Daemon at %s\n",
+       flog(LOG_INFO, "Stopped CGroup Rules Engine Daemon at %s\n",
                        ctime(&tm));
 
        /* Close the log file, if we opened one */
@@ -1039,7 +1039,7 @@ int main(int argc, char *argv[])
        int facility = 0;
 
        /* Verbose level */
-       int verbosity = 2;
+       int verbosity = 1;
 
        /* For catching signals */
        struct sigaction sa;
@@ -1226,7 +1226,7 @@ int main(int argc, char *argv[])
        ret = sigaction(SIGUSR1, &sa, NULL);
        if (ret) {
                flog(LOG_ERR, "Failed to set up signal handler for SIGUSR1."\
-                       " Error: %s", strerror(errno));
+                       " Error: %s\n", strerror(errno));
                goto finished;
        }
 
@@ -1253,7 +1253,7 @@ int main(int argc, char *argv[])
        if (ret)
                flog(LOG_WARNING, "Failed to initialize running tasks.\n");
 
-       flog(LOG_NOTICE, "Started the CGroup Rules Engine Daemon.\n");
+       flog(LOG_INFO, "Started the CGroup Rules Engine Daemon.\n");
 
        /* We loop endlesly in this function, unless we encounter an error. */
        ret =  cgre_create_netlink_socket_process_msg();


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to