title: How to pickle loggers?
body: <p>Working on a project that requires that I am able to pickle the container object at any point, since we expect it to fail on external conditions quite frequently and be able to fully pick up where we left off.</p>
  
  <p>I'm using the python logging library quite extensively, and all of my classes start by setting up a logger like:</p>
  
  <pre><code>class foo:
     def __init__(self):
         self.logger = logging.getLogger("package.foo")
  </code></pre>
  
  <p>Since I'm pickling a container class, it has several layers of classes within it, each with their own logger instance.</p>
  
  <p>Now, for some reason, these loggers are breaking Pickle. I'm getting the following error, which goes away if I delete self.logger from all the classes:</p>
  
  <pre><code>Can't pickle 'lock' object: &lt;thread.lock object at ... &gt;
  </code></pre>
  
  <p>So my question is whether or not there is some way to remove the lock objects from all the loggers without having to recurse through my whole object tree deleting loggers which I will have to recreate on unpickle.</p>