handlers.SocketHandler and exceptions

writeson doug.farrell at gmail.com
Thu Jan 17 14:47:57 CET 2008


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 the logging module to use
my class. In my logging configuration 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 the logging module to include mydirectory in
its search path for modules.

So that's where I'm stuck now.

Again, thanks for your response,
Doug



More information about the Python-list mailing list