On Jan 17, 1:47 pm, writeson <[EMAIL PROTECTED]> wrote: > Mark, > > > > > Check out the traceback module. It can translate the traceback into a > > variety of formats (such as a string) that can be pickled. > > > --Mark > > Thanks for the reply. I was looking at the traceback module and > thinking along the same lines you are. The problem I'm having with > that is how to modify the behavior of the SocketHandler code so it > would call the traceback module functions. The point at which the > handlers.SocketHandler code fails is in the method makePickle(), and > I'm not sure how to overload/override that method. I tried creating my > own class: > > class MySocketHandler(handlers.SocketHandler): > def makePickle(self, record): > # perform new code that transforms a Traceback object into a > string > > but so far I haven't figured out how to get theloggingmodule to use > my class. In myloggingconfiguration file I tried something like > this: > > [handler_local_server] > class=mydirectory.MySocketHandler > level=DEBUG > formatter=general > args=("localhost", handlers.DEFAULT_TCP_LOGGING_PORT + 1) > > but I can't seem to get theloggingmodule to include mydirectory in > its search path for modules. > > So that's where I'm stuck now. > > Again, thanks for your response, > Doug
What version of Python are you running? Recent versions should have a fix for this. Here's the makePickle method of SocketHandler: def makePickle(self, record): """ Pickles the record in binary format with a length prefix, and returns it ready for transmission across the socket. """ ei = record.exc_info if ei: dummy = self.format(record) # just to get traceback text into record.exc_text record.exc_info = None # to avoid Unpickleable error s = cPickle.dumps(record.__dict__, 1) if ei: record.exc_info = ei # for next handler slen = struct.pack(">L", len(s)) return slen + s Notice the code to avoid the Unpickleable error. Best regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list