N
Nigel King
I have a problem with the logging module.
It reports a Broken Pipe error after outputing to the log file
occasionally (5%). This does not appear to happen on Mac OSX using
current finked python (2.3.3) but does appear to occur on Python 2.3.4
running on a very old Redhat Linux xxxxx 2.2.14-5.0 #1 Tue Mar 7
21:07:39 EST 2000 i686. The actual logged error follows my signature.
Note that "files used:-" has been sent to the file.
From a previous suggestion I had the following lines in my logger setup.
import logging
import signal
import types
logger = logging.getLogger('pathprofile')
hdlr = logging.FileHandler('/var/log/pathprofile/pathprofile.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.INFO)
signal.signal(signal.SIGPIPE, signal.SIG_DFL) # for assynchronous
logging
Thanks for any enlightenment.
Nigel King
2004-09-27 08:15:24,864 INFO files used:-
2004-09-27 08:15:24,865 ERROR [Errno 32] Broken pipe
Traceback (most recent call last):
File "/home/pathprofile/public_html/PathProfile/ProcessEmail.py",
line 42, in ?
emod.processEmail(conf)
File
"/home/pathprofile/public_html/PathProfile/modules/emailmodules.py",
line 253, in processEmail
PathProfile.EvaluateProfile(fld, conf)
File
"/home/pathprofile/public_html/PathProfile/modules/PathProfile.py",
line 66, in EvaluateProfile
remoteheight= fld['remoteheight'])
File
"/home/pathprofile/public_html/PathProfile/modules/HeightFile.py", line
680, in createPathFile
filesUsed()
File
"/home/pathprofile/public_html/PathProfile/modules/HeightFile.py", line
637, in filesUsed
log.logger.info('files used:-')
File "/usr/local/lib/python2.3/logging/__init__.py", line 893, in info
apply(self._log, (INFO, msg, args), kwargs)
File "/usr/local/lib/python2.3/logging/__init__.py", line 994, in _log
self.handle(record)
File "/usr/local/lib/python2.3/logging/__init__.py", line 1004, in
handle
self.callHandlers(record)
File "/usr/local/lib/python2.3/logging/__init__.py", line 1037, in
callHandlers
hdlr.handle(record)
File "/usr/local/lib/python2.3/logging/__init__.py", line 592, in
handle
self.emit(record)
File "/usr/local/lib/python2.3/logging/__init__.py", line 684, in emit
self.handleError(record)
File "/usr/local/lib/python2.3/logging/__init__.py", line 636, in
handleError
traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)
File "/usr/local/lib/python2.3/traceback.py", line 122, in
print_exception
_print(file, 'Traceback (most recent call last):')
File "/usr/local/lib/python2.3/traceback.py", line 13, in _print
file.write(str+terminator)
IOError: [Errno 32] Broken pipe
It reports a Broken Pipe error after outputing to the log file
occasionally (5%). This does not appear to happen on Mac OSX using
current finked python (2.3.3) but does appear to occur on Python 2.3.4
running on a very old Redhat Linux xxxxx 2.2.14-5.0 #1 Tue Mar 7
21:07:39 EST 2000 i686. The actual logged error follows my signature.
Note that "files used:-" has been sent to the file.
From a previous suggestion I had the following lines in my logger setup.
import logging
import signal
import types
logger = logging.getLogger('pathprofile')
hdlr = logging.FileHandler('/var/log/pathprofile/pathprofile.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.INFO)
signal.signal(signal.SIGPIPE, signal.SIG_DFL) # for assynchronous
logging
Thanks for any enlightenment.
Nigel King
2004-09-27 08:15:24,864 INFO files used:-
2004-09-27 08:15:24,865 ERROR [Errno 32] Broken pipe
Traceback (most recent call last):
File "/home/pathprofile/public_html/PathProfile/ProcessEmail.py",
line 42, in ?
emod.processEmail(conf)
File
"/home/pathprofile/public_html/PathProfile/modules/emailmodules.py",
line 253, in processEmail
PathProfile.EvaluateProfile(fld, conf)
File
"/home/pathprofile/public_html/PathProfile/modules/PathProfile.py",
line 66, in EvaluateProfile
remoteheight= fld['remoteheight'])
File
"/home/pathprofile/public_html/PathProfile/modules/HeightFile.py", line
680, in createPathFile
filesUsed()
File
"/home/pathprofile/public_html/PathProfile/modules/HeightFile.py", line
637, in filesUsed
log.logger.info('files used:-')
File "/usr/local/lib/python2.3/logging/__init__.py", line 893, in info
apply(self._log, (INFO, msg, args), kwargs)
File "/usr/local/lib/python2.3/logging/__init__.py", line 994, in _log
self.handle(record)
File "/usr/local/lib/python2.3/logging/__init__.py", line 1004, in
handle
self.callHandlers(record)
File "/usr/local/lib/python2.3/logging/__init__.py", line 1037, in
callHandlers
hdlr.handle(record)
File "/usr/local/lib/python2.3/logging/__init__.py", line 592, in
handle
self.emit(record)
File "/usr/local/lib/python2.3/logging/__init__.py", line 684, in emit
self.handleError(record)
File "/usr/local/lib/python2.3/logging/__init__.py", line 636, in
handleError
traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)
File "/usr/local/lib/python2.3/traceback.py", line 122, in
print_exception
_print(file, 'Traceback (most recent call last):')
File "/usr/local/lib/python2.3/traceback.py", line 13, in _print
file.write(str+terminator)
IOError: [Errno 32] Broken pipe