Vinay Sajip <vinay_sa...@yahoo.co.uk> added the comment:

Loggers are singletons, so the pickling operation just pickles the name. 
Unpickling just leads to getting the pickled name and calling getLogger(name), 
which will return the same object that was pickled (I'd forgotten about 
issue30520).

I suggest as a workaround that a context manager approach could be used to save 
and restore part of the logging configuration around various operations (at 
least levels and handlers), as outlined here:

https://docs.python.org/3/howto/logging-cookbook.html#using-a-context-manager-for-selective-logging

This would avoid the need for making copies just to save and restore state.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34999>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to