[Zope3-checkins] CVS: Zope3 - log.ini:1.1 test.py:1.25

Guido van Rossum guido@python.org
Thu, 19 Dec 2002 15:50:50 -0500


Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv29929

Modified Files:
	test.py 
Added Files:
	log.ini 
Log Message:
Configure logging from log.ini

=== Added File Zope3/log.ini ===
[logger_root]
level=CRITICAL
handlers=normal

[handler_normal]
class=FileHandler
level=NOTSET
formatter=common
args=('/dev/tty', 'a')
filename=/dev/tty
mode=a

[formatter_common]
format=------
       %(asctime)s %(message)s
datefmt=%Y-%m-%dT%H:%M:%S

[loggers]
keys=root

[handlers]
keys=normal

[formatters]
keys=common


=== Zope3/test.py 1.24 => 1.25 ===
--- Zope3/test.py:1.24	Thu Dec 19 14:33:02 2002
+++ Zope3/test.py	Thu Dec 19 15:50:19 2002
@@ -399,10 +399,12 @@
     setup_path()
 
     # Initialize the logging module.
-    # XXX Should allow command line control.
-    import logging
+    import logging.config
     logging.basicConfig()
     logging.root.setLevel(logging.CRITICAL)
+    # If log.ini exists, use it
+    if os.path.exists("log.ini"):
+        logging.config.fileConfig("log.ini")
 
     files = find_tests(module_filter)
     files.sort()