import logging import logging.handlers config = { 'filename': '/tmp/interpolatoryawesome.log', 'level': logging.DEBUG, 'size' : 1024000, 'backupCount': 10, } logger = logging.getLogger('interp') logger.setLevel(config['level']) my_format = logging.Formatter('%(asctime)s %(levelname)s (%(process)d) %(filename)s %(funcName)s:%(lineno)d %(message)s') handler = logging.handlers.RotatingFileHandler( config['filename'], maxBytes = config['size'] * 1024, backupCount = config['backupCount']) handler.setFormatter(my_format) logger.addHandler(handler)