title: Logging to both thread-specific and shared log files in Python
body: <p>I want to implement per-thread logging in a multithreaded Python application using Python's <code>logging</code> module. I have appended a unique ID to the logger name in the main module (which creates threads):</p>
  <pre><code>mylogger = logging.getLogger(str(someInt) + __name__)
  </code></pre>
  <p>This module uses multiple modules which also support logging, but have their loggers initialized like:</p>
  <pre><code>mylogger = logging.getLogger(__name__)
  </code></pre>
  <p>Since the callee class doesn't see the logger of caller, the logs of caller are thread-specific but that of callee go in one global file, according to its path.</p>
  <p>What can we do to avoid changing passing <code>str(someInt)</code> to each of the other modules and use them unchanged, but still log to thread-specific files?</p>