]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Update default logging for cgrulesengd
authorPeter Schiffer <pschiffe@redhat.com>
Tue, 2 Apr 2013 08:57:07 +0000 (10:57 +0200)
committerIvana Hutarova Varekova <varekova@redhat.com>
Tue, 2 Apr 2013 08:57:07 +0000 (10:57 +0200)
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 <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
doc/man/cgrulesengd.8
src/daemon/cgrulesengd.c

index 9566c233f0898249567e2081ed5015438d1687b7..2e89c5b0fdcbeb12d4e3b1a4c522bdcbb9902fe0 100644 (file)
@@ -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>
index bfca3b20d7a4cee7a173cb3e8a10d67218ff4c42..367b89850b9777ed0048856c8e4e7ac1d4a8ccf8 100644 (file)
@@ -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();