[Zope-Checkins] CVS: ZODB3/ZEO - runsvr.py:1.29

Fred L. Drake, Jr. fred@zope.com
Fri, 10 Jan 2003 13:38:06 -0500


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv4976

Modified Files:
	runsvr.py 
Log Message:
Add support for getting the logging from the configuration file.


=== ZODB3/ZEO/runsvr.py 1.28 => 1.29 ===
--- ZODB3/ZEO/runsvr.py:1.28	Thu Jan  9 17:12:02 2003
+++ ZODB3/ZEO/runsvr.py	Fri Jan 10 13:38:02 2003
@@ -265,25 +265,17 @@
         self.invalidation_queue_size = self.rootconf.zeo.invalidation_queue_size
 
     def load_logconf(self):
-        # Get logging options from conf, unless overridden by environment
-        # XXX This still needs to be supported in the config schema.
-        reinit = 0
-        if os.getenv("EVENT_LOG_FILE") is None:
-            if os.getenv("STUPID_LOG_FILE") is None:
-                path = None # self.logconf.get("path")
-                if path is not None:
-                    os.environ["EVENT_LOG_FILE"] = path
-                    os.environ["STUPID_LOG_FILE"] = path
-                    reinit = 1
-        if os.getenv("EVENT_LOG_SEVERITY") is None:
-            if os.getenv("STUPID_LOG_SEVERITY") is None:
-                level = None # self.logconf.get("level")
-                if level is not None:
-                    os.environ["EVENT_LOG_SEVERITY"] = level
-                    os.environ["STUPID_LOG_SEVERITY"] = level
-                    reinit = 1
-        if reinit:
+        if self.rootconf.logger is not None:
+            zLOG.set_initializer(self.log_initializer)
             zLOG.initialize()
+
+    def log_initializer(self):
+        from zLOG import EventLogger
+        logger = self.rootconf.logger()
+        for handler in logger.handlers:
+            if hasattr(handler, "reopen"):
+                handler.reopen()
+        EventLogger.event_logger.logger = logger
 
     def load_storages(self):
         # Get the storage specifications