Python Logging

Import logging configuration for libraries and application dev

Posted by Rob on August 21, 2017

Getting Started

Here is a quick snippet of setting up logging, which is a very useful thing to have when writing Libraries.

Setting up logging

The docs for logging module are overwhelming, so to break this down a little easier, I wanted to give you a quick start example so that you can be on your way.

If you’re writing a library, do this:

import logging
logger = logging.getLogger('mylibrary')

def do_stuff():
   logger.debug('doing stuff')

If you’re writing an application, start your main with this:

import logging

It’s not much, but this is a fast way to get you the information you need!

Any questions? Don’t hesitate to write to me at or leave your comments in the disqus box below!