[Rivet-svn] r1975 - trunk/bin

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Oct 30 18:09:51 GMT 2009


Author: buckley
Date: Fri Oct 30 18:09:51 2009
New Revision: 1975

Log:
Using a logging configuration recipe that works on the default Pythons installed with SLC4 and SLC5

Modified:
   trunk/bin/aida2flat
   trunk/bin/chisquared
   trunk/bin/chop_bins
   trunk/bin/compare-histos
   trunk/bin/rivet

Modified: trunk/bin/aida2flat
==============================================================================
--- trunk/bin/aida2flat	Fri Oct 30 18:04:32 2009	(r1974)
+++ trunk/bin/aida2flat	Fri Oct 30 18:09:51 2009	(r1975)
@@ -64,9 +64,13 @@
     try:
         logging.basicConfig(level=opts.LOGLEVEL, format="%(message)s")
     except:
-        logging.getLogger().setLevel(opts.LOGLEVEL)
-        h = logging.StreamHandler()
-        h.setFormatter(logging.Formatter("%(message)s"))
+        pass
+    h = logging.StreamHandler()
+    h.setFormatter(logging.Formatter("%(message)s"))
+    logging.getLogger().setLevel(opts.LOGLEVEL)
+    if logging.getLogger().handlers:
+        logging.getLogger().handlers[0] = h
+    else:
         logging.getLogger().addHandler(h)
 
 

Modified: trunk/bin/chisquared
==============================================================================
--- trunk/bin/chisquared	Fri Oct 30 18:04:32 2009	(r1974)
+++ trunk/bin/chisquared	Fri Oct 30 18:09:51 2009	(r1975)
@@ -248,9 +248,13 @@
     try:
         logging.basicConfig(level=opts.LOGLEVEL, format="%(message)s")
     except:
-        logging.getLogger().setLevel(opts.LOGLEVEL)
-        h = logging.StreamHandler()
-        h.setFormatter(logging.Formatter("%(message)s"))
+        pass
+    h = logging.StreamHandler()
+    h.setFormatter(logging.Formatter("%(message)s"))
+    logging.getLogger().setLevel(opts.LOGLEVEL)
+    if logging.getLogger().handlers:
+        logging.getLogger().handlers[0] = h
+    else:
         logging.getLogger().addHandler(h)
 
 

Modified: trunk/bin/chop_bins
==============================================================================
--- trunk/bin/chop_bins	Fri Oct 30 18:04:32 2009	(r1974)
+++ trunk/bin/chop_bins	Fri Oct 30 18:09:51 2009	(r1975)
@@ -79,16 +79,21 @@
             LOGLEVEL=logging.INFO)
     opts, args = parser.parse_args()
 
+
     ## Configure logging
     try:
-        logging.basicConfig(level=opts.LOGLEVEL,
-                format="%(levelname)s: %(message)s")
+        logging.basicConfig(level=opts.LOGLEVEL, format="%(message)s")
     except:
-        logging.getLogger().setLevel(opts.LOGLEVEL)
-        h = logging.StreamHandler()
-        h.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
+        pass
+    h = logging.StreamHandler()
+    h.setFormatter(logging.Formatter("%(message)s"))
+    logging.getLogger().setLevel(opts.LOGLEVEL)
+    if logging.getLogger().handlers:
+        logging.getLogger().handlers[0] = h
+    else:
         logging.getLogger().addHandler(h)
 
+
     if len(args) == 0:
         sys.stderr.write("Must specify at least one AIDA histogram file!\n")
         sys.exit(1)

Modified: trunk/bin/compare-histos
==============================================================================
--- trunk/bin/compare-histos	Fri Oct 30 18:04:32 2009	(r1974)
+++ trunk/bin/compare-histos	Fri Oct 30 18:09:51 2009	(r1975)
@@ -111,11 +111,19 @@
                       action="store_const", default=logging.INFO, const=logging.DEBUG)
     opts, args = parser.parse_args()
 
+
     ## Configure logging
     try:
         logging.basicConfig(level=opts.LOGLEVEL, format="%(message)s")
     except:
-        logging.getLogger().setLevel(opts.LOGLEVEL)
+        pass
+    h = logging.StreamHandler()
+    h.setFormatter(logging.Formatter("%(message)s"))
+    logging.getLogger().setLevel(opts.LOGLEVEL)
+    if logging.getLogger().handlers:
+        logging.getLogger().handlers[0] = h
+    else:
+        logging.getLogger().addHandler(h)
 
 
     ## Line styles

Modified: trunk/bin/rivet
==============================================================================
--- trunk/bin/rivet	Fri Oct 30 18:04:32 2009	(r1974)
+++ trunk/bin/rivet	Fri Oct 30 18:09:51 2009	(r1975)
@@ -115,9 +115,13 @@
 try:
     logging.basicConfig(level=opts.LOGLEVEL, format="%(message)s")
 except:
-    logging.getLogger().setLevel(opts.LOGLEVEL)
-    h = logging.StreamHandler()
-    h.setFormatter(logging.Formatter("%(message)s"))
+    pass
+h = logging.StreamHandler()
+h.setFormatter(logging.Formatter("%(message)s"))
+logging.getLogger().setLevel(opts.LOGLEVEL)
+if logging.getLogger().handlers:
+    logging.getLogger().handlers[0] = h
+else:
     logging.getLogger().addHandler(h)
 
 


More information about the Rivet-svn mailing list