错误信息
2017-12-02 18:50:05,771 - root - INFO - 测试测试
--- Logging error ---
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/logging/__init__.py", line 994, in emit
stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 40-43: ordinal not in range(128)
Call stack:
File "/Users/fengyiwei/PycharmProjects/untitled/crawlercbc.py", line 251, in
root_logger.info("%s" % ('测试测试'))
Message: '测试测试'
Arguments: ()
代码
logging.config.fileConfig('logging.config')
root_logger = logging.getLogger('root')
root_logger.info("%s" % ('测试测试'))
配置文件logging.config
[loggers]
keys=root,main
[handlers]
keys=consoleHandler,fileHandler
[formatter