[py-dev] Logging over execnet?

William McVey wam at cisco.com
Thu Apr 23 23:10:24 CEST 2009


On Wed, 2009-04-22 at 10:54 -0400, William McVey wrote:
> I'm using py.execnet with the SshGateway and I'd like to fire off
> logging messages that get sent over the ssh connection. I was wondering
> if someone has already coded up a logging handler for this.

After a bit of frustration, I have remote logging over an execnet
channel working, with no changes to the py.execnet code itself to
support this. I had to resort to a nasty trick in order to get the
channel to send and receive the logging.LogRecord objects. I think this
could be made a lot cleaner if py.execnet were tweaked to allow defining
a dictionary of namespaces to use when deserializing objects coming over
a channel. If there is any interest in this by the py lib maintainers,
I'll go ahead and fork the code using bitbucket, add this capability in
(probably as a new method on the channel object) and issue a pull
notification.

Anyway, attached is a simple demo script that shows the ExecNetHandler
logging handler in action. I'd love to hear feedback on this. 

  -- William
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_log_execnet.py
Type: text/x-python
Size: 1913 bytes
Desc: not available
Url : http://codespeak.net/pipermail/py-dev/attachments/20090423/8f5cc6d3/attachment.py 


More information about the py-dev mailing list