 <p>Expanding on @Brendan's answer.</p> <p>Your logger currently outputs to the console using a <a href="https://docs.python.org/2/library/logging.handlers.html#streamhandler" rel="nofollow noreferrer"><code>StreamHandler</code></a>.</p> <p>By adding a <a href="https://docs.python.org/2/library/logging.handlers.html#filehandler" rel="nofollow noreferrer"><code>FileHandler</code></a>, you can log to a file.</p> <p>Each handler instance can be customized to have its own format and logging level.</p> <p>If you want to log using the same format, you will have to set the format on the new FileHandler as well.</p> <pre><code>fh = logging.FileHandler(r'/path/to/log.txt') fh.setFormatter(formatter) logger.addHandler(fh) </code></pre> <p>Read more: <a href="https://docs.python.org/2/howto/logging-cookbook.html" rel="nofollow noreferrer">Python logging cookbook</a></p>