import re
import logging
logger = logging.getLogger("logger") #logger名loggerを取得
logger.setLevel(logging.DEBUG) #loggerとしてはDEBUGで
logging.basicConfig(level=logging.DEBUG,
filename=re.sub("\..*$","",__file__)+".log",
format="%(asctime)s %(levelname)-7s %(message)s")
logging.debug("debug log")