cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: fabbione@sourceware.org <fabbione@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] Cluster Project branch, master, updated. cluster-2.99.04-42-g0d722b3
Date: 20 Jun 2008 07:40:41 -0000	[thread overview]
Message-ID: <20080620074041.24733.qmail@sourceware.org> (raw)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=0d722b3eb28b383f489525d118da70cb0a87ec7a

The branch, master has been updated
       via  0d722b3eb28b383f489525d118da70cb0a87ec7a (commit)
      from  5b0cc0dd3285d92c137c9166e333497cda2505e3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0d722b3eb28b383f489525d118da70cb0a87ec7a
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date:   Fri Jun 20 09:39:59 2008 +0200

    [CCS] Convert ccs logsys config to the ais format
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>

-----------------------------------------------------------------------

Summary of changes:
 ccs/daemon/ccsd.c |    1 +
 ccs/daemon/misc.c |   98 ++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 8 deletions(-)

diff --git a/ccs/daemon/ccsd.c b/ccs/daemon/ccsd.c
index 65d8e1e..ae6854c 100644
--- a/ccs/daemon/ccsd.c
+++ b/ccs/daemon/ccsd.c
@@ -65,6 +65,7 @@ int main(int argc, char *argv[]){
   if(getenv("CCS_DEBUGLOG"))
     debug = 1;
 
+  /* enable debug as early as possible */
   if(debug)
     logsys_config_priority_set (LOG_LEVEL_DEBUG);
 
diff --git a/ccs/daemon/misc.c b/ccs/daemon/misc.c
index 3527632..5ba999f 100644
--- a/ccs/daemon/misc.c
+++ b/ccs/daemon/misc.c
@@ -151,8 +151,8 @@ fail:
  * Returns: -1 on failure. NULL on success.
  */
 int set_ccs_logging(xmlDocPtr ldoc){
-  int facility = SYSLOGFACILITY, loglevel = LOG_LEVEL_INFO;
-  char *res = NULL;
+  int facility = SYSLOGFACILITY, loglevel = LOG_LEVEL_INFO, global_debug = 0;
+  char *res = NULL, *error = NULL;
   xmlXPathContextPtr ctx = NULL;
   unsigned int logmode;
 
@@ -164,11 +164,63 @@ int set_ccs_logging(xmlDocPtr ldoc){
     return -1;
   }
 
-  res = do_simple_xml_query(ctx, "/cluster/ccs/@log_facility");
+  logmode = logsys_config_mode_get();
+
+  res = do_simple_xml_query(ctx, "/cluster/logging/@to_stderr");
+  if(res) {
+    if(!strcmp(res, "yes")) {
+      logmode |= LOG_MODE_OUTPUT_STDERR;
+    } else
+    if(!strcmp(res, "no")) {
+      logmode &= ~LOG_MODE_OUTPUT_STDERR;
+    } else
+      log_printf(LOG_ERR, "to_stderr: unknown value\n");
+    free(res);
+    res=NULL;
+  }
+
+  res = do_simple_xml_query(ctx, "/cluster/logging/@to_syslog");
+  if(res) {
+    if(!strcmp(res, "yes")) {
+      logmode |= LOG_MODE_OUTPUT_SYSLOG_THREADED;
+    } else
+    if(!strcmp(res, "no")) {
+      logmode &= ~LOG_MODE_OUTPUT_SYSLOG_THREADED;
+    } else
+      log_printf(LOG_ERR, "to_syslog: unknown value\n");
+    free(res);
+    res=NULL;
+  }
+
+  res = do_simple_xml_query(ctx, "/cluster/logging/@to_file");
+  if(res) {
+    if(!strcmp(res, "yes")) {
+      logmode |= LOG_MODE_OUTPUT_FILE;
+    } else
+    if(!strcmp(res, "no")) {
+      logmode &= ~LOG_MODE_OUTPUT_FILE;
+    } else
+      log_printf(LOG_ERR, "to_file: unknown value\n");
+    free(res);
+    res=NULL;
+  }
+
+  res = do_simple_xml_query(ctx, "/cluster/logging/@filename");
+  if(res) {
+    if(logsys_config_file_set(&error, res))
+      log_printf(LOG_ERR, "filename: unable to open %s for logging\n", res);
+    free(res);
+    res=NULL;
+  } else
+      log_printf(LOG_DEBUG, "filename: use default built-in log file: %s\n", LOGDIR "/ccs.log");
+
+  res = do_simple_xml_query(ctx, "/cluster/logging/@syslog_facility");
   if(res) {
     facility = logsys_facility_id_get (res);
-    if (facility < 0)
+    if (facility < 0) {
+      log_printf(LOG_ERR, "syslog_facility: unknown value\n");
       facility = SYSLOGFACILITY;
+    }
 
     logsys_config_facility_set ("CCS", facility);
     log_printf(LOG_DEBUG, "log_facility: %s (%d).\n", res, facility);
@@ -176,7 +228,39 @@ int set_ccs_logging(xmlDocPtr ldoc){
     res=NULL;
   }
 
-  res = do_simple_xml_query(ctx, "/cluster/ccs/@log_level");
+  res = do_simple_xml_query(ctx, "/cluster/logging/@debug");
+  if(res) {
+    if(!strcmp(res, "on")) {
+      global_debug = 1;
+    } else
+    if(!strcmp(res, "off")) {
+      global_debug = 0;
+    } else
+      log_printf(LOG_ERR, "debug: unknown value\n");
+    free(res);
+    res=NULL;
+  }
+
+  /* subsytem config */
+
+  res = do_simple_xml_query(ctx, "/cluster/logging/logger_subsys[@subsys=\"CCS\"]/@debug");
+  if(res) {
+    if(!strcmp(res, "on")) {
+      debug = 1;
+    } else
+    if(!strcmp(res, "off") && !debug) { /* debug from cmdline/envvars override config */
+      debug = 0;
+    } else
+      log_printf(LOG_ERR, "debug: unknown value\n");
+    free(res);
+    res=NULL;
+  } else
+    debug = global_debug; /* global debug overrides subsystem only if latter is not specified */
+
+  if(debug)
+    logsys_config_priority_set (LOG_LEVEL_DEBUG);
+
+  res = do_simple_xml_query(ctx, "/cluster/logging/logger_subsys[@subsys=\"CCS\"]/@syslog_level");
   if(res) {
     loglevel = logsys_priority_id_get (res);
     if (loglevel < 0)
@@ -185,7 +269,7 @@ int set_ccs_logging(xmlDocPtr ldoc){
     if (!debug)
       logsys_config_priority_set (loglevel);
 
-    log_printf(LOG_DEBUG, "log_level: %s (%d).\n", res, loglevel);
+    log_printf(LOG_DEBUG, "syslog_level: %s (%d).\n", res, loglevel);
     free(res);
     res=NULL;
   }
@@ -194,8 +278,6 @@ int set_ccs_logging(xmlDocPtr ldoc){
     xmlXPathFreeContext(ctx);
   }
 
-  logmode = logsys_config_mode_get();
-
   if(logmode & LOG_MODE_BUFFER_BEFORE_CONFIG) {
     log_printf(LOG_DEBUG, "CCS logsys config enabled from set_ccs_logging\n");
     logmode &= ~LOG_MODE_BUFFER_BEFORE_CONFIG;


hooks/post-receive
--
Cluster Project



                 reply	other threads:[~2008-06-20  7:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080620074041.24733.qmail@sourceware.org \
    --to=fabbione@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).