[Twisted-Python] (no subject)

Andrew Dalke dalke at dalkescientific.com
Wed Apr 2 16:48:46 MST 2003


Itamar Shtull-Trauring:
 > I'm pretty sure startLogging is called at some point on import? Or how
 > is the default logging set up?

The twiddling of warnings is done during import, and the
logfile is set to NullFile.  The code looks like this (including
the indentation level)

import warnings
warnings.showwarning = showwarning
   ....
# Prevent logfile from being erased on reload.  This only works in 
cpython.
try:
     logfile
except NameError:
     logfile = NullFile()
     logerr = sys.stderr


The patch I submitted changes matters so that twiddling
doesn't occur until startLogging is called.

Also, Itamar said:
 > twisted.python.log is old and crufty. If anyone feels like updating it
 > (requirements include different channels that can be logged to 
different
 > files), feel free. If you do discuss it on the list first, to make 
sure
 > everyone has voiced their requirements.

Python 2.3 has a generalized logging framework.
   http://python.org/dev/doc/devel/lib/module-logging.html
] New in version 2.3.  This module defines functions and classes
] which implement a flexible error logging system for applications.


					Andrew
					dalke at dalkescientific.com





More information about the Twisted-Python mailing list