Log message for revision 40819:
  Made sure logging is configured. Read $INSTANCE_HOME/log.ini if it exists.
  

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/ZopeLite.py
  U   
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
  U   
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/ztc_common.py

-=-
Modified: 
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/ZopeLite.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/ZopeLite.py   
2005-12-16 18:22:04 UTC (rev 40818)
+++ Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/ZopeLite.py   
2005-12-16 18:40:14 UTC (rev 40819)
@@ -58,8 +58,9 @@
 
 def _configure_logging():
     # Initialize the logging module
-    if not sys.modules.has_key('logging'):
-        import logging
+    import logging
+    root = logging.getLogger()
+    if not root.handlers:
         logging.basicConfig()
 
 def _configure_debug_mode():

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
===================================================================
--- 
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt   
    2005-12-16 18:22:04 UTC (rev 40818)
+++ 
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt   
    2005-12-16 18:40:14 UTC (rev 40819)
@@ -5,6 +5,7 @@
 - installProduct() now becomes a noop if ZopeTestCase did not apply its
   patches.
 - Made the functional doc tests set the cookie related headers.
+- Made sure logging is configured. Read $INSTANCE_HOME/log.ini if it exists.
 
 0.9.8 (Zope 2.8 edition)
 - Renamed 'doctest' package to 'zopedoctest' because of name-shadowing

Modified: 
Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/ztc_common.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/ztc_common.py 
2005-12-16 18:22:04 UTC (rev 40818)
+++ Zope/branches/Zope-2_8-branch/lib/python/Testing/ZopeTestCase/ztc_common.py 
2005-12-16 18:40:14 UTC (rev 40819)
@@ -17,7 +17,7 @@
   execfile(os.path.join(os.path.dirname(Testing.__file__),
            'ZopeTestCase', 'ztc_common.py'))
 
-$Id: ztc_common.py,v 1.14 2004/05/27 15:06:24 shh42 Exp $
+$Id$
 """
 
 # Overwrites the default framework() method to expose the
@@ -62,11 +62,13 @@
             return
         if self.zeo_instance_home:
             self.setup_zeo_instance_home()
+            self.setup_logging()
         else:
             if self.instance_home:
                 self.setup_instance_home()
             else:
                 self.detect_and_setup_instance_home()
+            self.setup_logging()
             self.setup_custom_zodb()
     
     def setup_zeo_instance_home(self):
@@ -128,6 +130,13 @@
                 os.environ['INSTANCE_HOME'] = INSTANCE_HOME = self.cwd
                 self.setconfig(instancehome=self.cwd)
 
+    def setup_logging(self):
+        '''If $INSTANCE_HOME/log.ini exists, load it.'''
+        logini = os.path.join(self.getconfig('instancehome'), 'log.ini')
+        if os.path.exists(logini):
+            import logging.config
+            logging.config.fileConfig(logini)
+
     def add_instance(self, p):
         '''Adds an INSTANCE_HOME directory to Products.__path__ and 
sys.path.'''
         import Products

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to