#!-*-coding:utf-8 -*- import os import logging root = "c:\\AppData\\say365" if not os.path.exists(root): os.makedirs(root) xlog = logging.getLogger('[XscanService]') handler = logging.FileHandler(os.path.join(root, "service.log")) formatter = logging.Formatter('%(asctime)s [%(name)s:%(lineno)d] [%(module)s:%(funcName)s] [%(levelname)s]- %(message)s') handler.setFormatter(formatter) xlog.addHandler(handler) xlog.setLevel(logging.INFO)