#!/usr/bin/env python3 import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(message)s', handlers=[logging.FileHandler("example.log"), logging.StreamHandler()]) logging.debug('This message should go to the log file and to the console')