3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-26 04:32:51 +01:00

Explicitly specify UTF-8 for the log files (#634)

For some reason, Windows defaults to cp1252, which breaks logging when some utf-8 characters get logged
This commit is contained in:
Ian Carpenter 2019-02-18 20:14:30 -05:00 committed by James Lu
parent 30387c9ed5
commit 24f85acfb8

2
log.py
View File

@ -60,7 +60,7 @@ def _make_file_logger(filename, level=None):
# Defaults to 5.
backups = logrotconf.get('backup_count', 5)
filelogger = logging.handlers.RotatingFileHandler(target, maxBytes=maxbytes, backupCount=backups)
filelogger = logging.handlers.RotatingFileHandler(target, maxBytes=maxbytes, backupCount=backups, encoding='utf-8')
filelogger.setFormatter(logformatter)
# If no log level is specified, use the same one as the console logger.