[Zope-Checkins] CVS: Zope - test.py:1.8
Fred L. Drake, Jr.
fred at zope.com
Tue Apr 13 10:26:13 EDT 2004
Update of /cvs-repository/Zope
In directory cvs.zope.org:/tmp/cvs-serv12380
Modified Files:
test.py
Log Message:
zLOG is the past; logging is the future. Configure the right thing.
=== Zope/test.py 1.7 => 1.8 ===
--- Zope/test.py:1.7 Thu Mar 18 08:27:49 2004
+++ Zope/test.py Tue Apr 13 10:26:12 2004
@@ -606,26 +606,12 @@
os.path.walk(os.curdir, remove_stale_bytecode, None)
global pathinit
-
- # Get the log.ini file from the current directory instead of possibly
- # buried in the build directory. XXX This isn't perfect because if
- # log.ini specifies a log file, it'll be relative to the build directory.
- # Hmm...
- logini = os.path.abspath('log.ini')
+
+ configure_logging()
# Initialize the path and cwd
pathinit = PathInit(build, libdir)
- # Initialize the logging module.
- import logging.config
- logging.basicConfig()
- level = os.getenv("LOGGING")
- if level:
- level = int(level)
- else:
- level = logging.CRITICAL
- logging.root.setLevel(level)
-
files = find_tests(module_filter)
files.sort()
@@ -648,6 +634,26 @@
track.update()
else:
runner(files, test_filter, debug)
+
+
+def configure_logging():
+ """Initialize the logging module."""
+ import logging.config
+
+ # Get the log.ini file from the current directory instead of possibly
+ # buried in the build directory. XXX This isn't perfect because if
+ # log.ini specifies a log file, it'll be relative to the build directory.
+ # Hmm...
+ logini = os.path.abspath("log.ini")
+
+ if os.path.exists(logini):
+ logging.config.fileConfig(logini)
+ else:
+ logging.basicConfig()
+
+ if os.environ.has_key("LOGGING"):
+ level = int(os.environ["LOGGING"])
+ logging.getLogger().setLevel(level)
def process_args(argv=None):
More information about the Zope-Checkins
mailing list