Fernando M. Maresca wrote:
On Mon, Feb 16, 2009 at 05:07:45AM -0800, Garrett Cooper wrote:
You can actually set sys.std[err|out] to your ?file? descriptor of
choice in python ....
Yes, but I'm trying to use *TimedRotating*FileHandler, which makes the
fd of the logfile change in every rotation of the logfile. So the direct
approach of std[out|err] redirection to the logfile fd obtained from
the logger instance is unusable (it works fine with a simple file
handler).
Right, so you stick something in as stderr/stdout that talks to the
logfile. That is, something like:
import sys
class MyFakeStdout(object):
def flush(self):
pass
def write(self, text):
<code to actually do the logging>
sys.stderr = sys.stdout = MyFakeStdout()
--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list