import logging logging.basicConfig(filename = os.path.join(os.getcwd(), 'log.txt'), level = logging.DEBUG) logging.debug('this is a message')
http://blog.csdn.net/jgood/article/details/4340740