"writeson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > On our Linux systems at work I've written a Twisted logging server > that receives log messages from multiple servers/processes to post > them to a log file, essentially serializing all the process log > messages. This works well, that is until I tried this test code: > > try: > t = 10 / 0 > except Exception, e: > log.exception("divide by zero") > > where log is the logger instance retreived from a call to getLogger(). > The problem is the handlers.SocketHandler tries to cPickle.dump() the > log record, which in this case contains an exc_info tuple, the last > item of which is a Traceback object. The pickling fails with an > "unpickleable error" and that's that. > > Does anyone have any ideas how to handle this situation? I'd hate to > have to give up using the log.exception(...) call as it's useful to > get strack trace information in the log file. > > Thanks in advance, > Doug Farrell
Check out the traceback module. It can translate the traceback into a variety of formats (such as a string) that can be pickled. --Mark -- http://mail.python.org/mailman/listinfo/python-list