I have some old python modules which are generating messages from the new python 2.1 warning framework. I can easily fix these modules, however it has exposed a problem in Zope...... The warning framework tries to write to sys.stderr, and my Zope is dying from an exception because stderr has been closed. I think it makes sense that Zope should replace sys.stderr with an object that sends messages to zLog, however zLog itself sometimes wites to sys.stderr. Any thoughts on the right way to fix this? Toby Dickenson tdickenson@geminidataloggers.com
Toby Dickenson wrote:
I have some old python modules which are generating messages from the new python 2.1 warning framework. I can easily fix these modules, however it has exposed a problem in Zope......
The warning framework tries to write to sys.stderr, and my Zope is dying from an exception because stderr has been closed.
I bumped into this with Python 1.5.2, and a print statement in the Threading module. This was causing me problems using Xron. The solution was to use this at the end of the start script:
/some/path/logs/zope_stdout.log 2>&1
I keep a separate script called start_debug that doesn't do this, and adds -D to the z2.py switches.
I think it makes sense that Zope should replace sys.stderr with an object that sends messages to zLog, however zLog itself sometimes wites to sys.stderr.
I guess it would be nice to specify switches to z2.py to say that stderr should go to ZLog, and ZLog's stderr messages should get appended to a specified file. -- Steve Alexander Software Engineer Cat-Box limited
On Wed, 26 Sep 2001, Toby Dickenson wrote:
I have some old python modules which are generating messages from the new python 2.1 warning framework. I can easily fix these modules, however it has exposed a problem in Zope......
The warning framework tries to write to sys.stderr, and my Zope is dying from an exception because stderr has been closed.
I think it makes sense that Zope should replace sys.stderr with an object that sends messages to zLog, however zLog itself sometimes wites to sys.stderr.
Any thoughts on the right way to fix this?
AFAIK, setting the STUPID_LOG_FILE envar in the start script will provide stdout/stderr to Zope. Stefan
Stefan H. Holek writes:
AFAIK, setting the STUPID_LOG_FILE envar in the start script will provide stdout/stderr to Zope. "stderr" but not "stdout"....
Long time ago, I switched to "STUPID_LOG_FILE=...".
From this time on, I never again saw a write to "stderr" appear outside the log file.
As someone else pointed out, all remaining outputs can be redirected to a file. Under Unix, it would be "... > xxx 2>&1" Dieter
Toby Dickenson writes:
I think it makes sense that Zope should replace sys.stderr with an object that sends messages to zLog, however zLog itself sometimes wites to sys.stderr. "zLog" writes to stderr only when there is no log file defined....
Dieter
participants (4)
-
Dieter Maurer -
Stefan H. Holek -
Steve Alexander -
Toby Dickenson