r5422 - in trunk/cumin: bin etc python/cumin

tmckay at fedoraproject.org tmckay at fedoraproject.org
Wed Jun 20 18:15:39 UTC 2012


Author: tmckay
Date: 2012-06-20 18:15:37 +0000 (Wed, 20 Jun 2012)
New Revision: 5422

Modified:
   trunk/cumin/bin/cumin-data
   trunk/cumin/bin/cumin-report
   trunk/cumin/bin/cumin-web
   trunk/cumin/etc/cumin.conf
   trunk/cumin/python/cumin/config.py
Log:
Allow absolute or relative paths for log-file values.  For relative paths,
the base will be $CUMIN_HOME/log/ if defined or else /usr/share/cumin/log/.


Modified: trunk/cumin/bin/cumin-data
===================================================================
--- trunk/cumin/bin/cumin-data	2012-06-20 14:54:11 UTC (rev 5421)
+++ trunk/cumin/bin/cumin-data	2012-06-20 18:15:37 UTC (rev 5422)
@@ -173,6 +173,8 @@
         # Use the config values as defaults for unspecified options
         apply_defaults(values, opts)
 
+        # If log_file is a relative path, base it from $CUMIN_HOME/log
+        opts.log_file = config.expand_log_file(opts.log_file)
         setup_operational_logging(opts, 
                                   values.log_max_mb,
                                   values.log_max_archives)

Modified: trunk/cumin/bin/cumin-report
===================================================================
--- trunk/cumin/bin/cumin-report	2012-06-20 14:54:11 UTC (rev 5421)
+++ trunk/cumin/bin/cumin-report	2012-06-20 18:15:37 UTC (rev 5422)
@@ -143,6 +143,8 @@
         # Use the config values as defaults for unspecified options
         apply_defaults(values, opts)
 
+        # If log_file is a relative path, base it from $CUMIN_HOME/log
+        opts.log_file = config.expand_log_file(opts.log_file)
         setup_operational_logging(opts, 
                                   values.log_max_mb,
                                   values.log_max_archives)

Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web	2012-06-20 14:54:11 UTC (rev 5421)
+++ trunk/cumin/bin/cumin-web	2012-06-20 18:15:37 UTC (rev 5422)
@@ -184,6 +184,8 @@
         # Use the config values as defaults for unspecified options
         apply_defaults(values, opts)
 
+        # If log_file is a relative path, base it from $CUMIN_HOME/log
+        opts.log_file = config.expand_log_file(opts.log_file)
         setup_operational_logging(opts, 
                                   values.log_max_mb,
                                   values.log_max_archives)

Modified: trunk/cumin/etc/cumin.conf
===================================================================
--- trunk/cumin/etc/cumin.conf	2012-06-20 14:54:11 UTC (rev 5421)
+++ trunk/cumin/etc/cumin.conf	2012-06-20 18:15:37 UTC (rev 5422)
@@ -2,6 +2,10 @@
 # Explanatory comments for some options are included
 # at the end of the file.
 
+# Values for log-file parameters may be absolute or
+# relative paths.  See the comments under the [web]
+# section at the end of the file for more information.
+
 # If a configuration section does not set a value for 
 # a particular parameter, the parameter is searched for 
 # in the [common] section.  This allows values to be set
@@ -102,7 +106,7 @@
 # ****************************************************
 
 [web]
-# log-file: $CUMIN_HOME/log/web.log
+# log-file: /usr/share/cumin/log/web.log
 # host: localhost ('0.0.0.0' binds to all local interfaces)
 # port: 45672
 # server-cert:
@@ -123,7 +127,7 @@
 # A value of 0 will cause the messages to never timeout
 
 [data]
-# log-file: $CUMIN_HOME/log/data.log
+# log-file: /usr/share/cumin/log/data.log
 # expire-enabled: True
 # expire-interval: 3600
 # expire-threshold: 86400
@@ -145,7 +149,7 @@
 #exclude-classes: com.redhat.grid:*
 
 [data.grid]
-# log-file: $CUMIN_HOME/log/data.grid.log
+# log-file: /usr/share/cumin/log/data.grid.log
 # expire-enabled: True
 expire-interval: 900
 # expire-threshold: 86400
@@ -156,7 +160,7 @@
  com.redhat.grid:JobServer, com.redhat.grid:Submitter, com.redhat.grid:Scheduler
 
 [data.grid-slots]
-# log-file: $CUMIN_HOME/log/data.grid-slots.log
+# log-file: /usr/share/cumin/log/data.grid-slots.log
 expire-enabled: False
 # expire-interval: 3600
 # expire-threshold: 86400
@@ -166,7 +170,7 @@
 # exclude-classes: [none]
 
 [data.grid-submissions]
-# log-file: $CUMIN_HOME/log/data.grid-submissions.log
+# log-file: /usr/share/cumin/log/data.grid-submissions.log
 expire-enabled: False
 # expire-interval: 3600
 # expire-threshold: 86400
@@ -177,7 +181,7 @@
 # exclude-classes: [none]
 
 [data.sesame]
-# log-file: $CUMIN_HOME/log/data.sesame.log
+# log-file: /usr/share/cumin/log/data.sesame.log
 expire-enabled: False
 # expire-interval: 3600
 # expire-threshold: 86400
@@ -187,7 +191,7 @@
 # exclude-classes: [none]
 
 [data.other]
-# log-file: $CUMIN_HOME/log/data.messaging.log
+# log-file: /usr/share/cumin/log/data.other.log
 expire-enabled: False
 # expire-interval: 3600
 # expire-threshold: 86400
@@ -199,7 +203,7 @@
 [report]
 # include-classes: [all]
 # exclude-classes: [none]
-# log-file: $CUMIN_HOME/log/report.log
+# log-file: /usr/share/cumin/log/report.log
 # expire-enabled: True
 expire-interval: 1d
 expire-threshold: 90d
@@ -282,6 +286,12 @@
 
 ## [web]
 
+## log-file:
+## If the value starts with "/" it is an absolute path for the
+## log file.  Otherwise, the value will be a relative path.
+## For a relative path, the base path will be $CUMIN_HOME/log/.
+## If $CUMIN_HOME is not defined, the base will be /usr/share/cumin/log/.
+
 ## server-cert:
 ## This is a server certificate file in PEM format.
 ## If server-cert and server-key are both set and valid,
@@ -344,6 +354,9 @@
 
 ## [data]
 
+## log-file:
+## See notes under the [web] section
+
 ## expire-enabled: True
 ## Whether or not the instance runs a thread which periodically expires samples.
 ## Running the expire thread from more than one instance is okay but unnecessary

Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py	2012-06-20 14:54:11 UTC (rev 5421)
+++ trunk/cumin/python/cumin/config.py	2012-06-20 18:15:37 UTC (rev 5422)
@@ -33,6 +33,13 @@
             return os.path.join(self.home, "log", "." + section_name + ".init")
         return ""
 
+    def expand_log_file(self, log_file):
+        # If log_file begins with a / it's absolute and we
+        # leave it alone.  If not, it's relative to $CUMIN_HOME/log
+        if not log_file or log_file.startswith("/"):
+            return log_file
+        return os.path.join(self.home, "log", log_file)
+
     def parse(self):
         paths = list()
 



More information about the cumin-developers mailing list