[issue30520] loggers can't be pickled

Vinay Sajip report at bugs.python.org
Thu Jun 1 03:14:07 EDT 2017


Vinay Sajip added the comment:

I am not sure it is a good idea to support pickling of loggers, as they are singletons and generally aren't supposed to be instantiated other than by calling logging.getLogger(name). What's the use case for pickling them, giving that (as you say) just the name could be used? In general, it's not needed to have loggers as part of an object instance, so I don't quite see where the need to pickle comes from.

One could implement __getstate__() to just return the name, but there is no corresponding obvious implementation of __setstate__() because loggers aren't meant to be instantiated via unpickling.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30520>
_______________________________________


More information about the Python-bugs-list mailing list