from logging import getLogger, FileHandler, DEBUG
logger = getLogger(__name__)
handler = FileHandler("debug.log")
handler.setLevel(DEBUG)
logger.setLevel(DEBUG)
logger.addHandler(handler)
logger.propagate = False

logger.debug('debug test')