From: garenchan <1412950785@qq.com> Date: Thu, 20 Sep 2018 03:36:37 +0000 (+0800) Subject: Specify that the encoding of file handler is utf-8. X-Git-Tag: v6.0.0b1~25^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc3f5f31fe980c1cc54d47513d83fa8d9e94fd87;p=thirdparty%2Ftornado.git Specify that the encoding of file handler is utf-8. Fix issue #2503. --- diff --git a/tornado/log.py b/tornado/log.py index 5948d43ba..1bb6f9571 100644 --- a/tornado/log.py +++ b/tornado/log.py @@ -220,13 +220,15 @@ def enable_pretty_logging(options: Any=None, channel = logging.handlers.RotatingFileHandler( filename=options.log_file_prefix, maxBytes=options.log_file_max_size, - backupCount=options.log_file_num_backups) # type: logging.Handler + backupCount=options.log_file_num_backups, + encoding="utf-8") # type: logging.Handler elif rotate_mode == 'time': channel = logging.handlers.TimedRotatingFileHandler( filename=options.log_file_prefix, when=options.log_rotate_when, interval=options.log_rotate_interval, - backupCount=options.log_file_num_backups) + backupCount=options.log_file_num_backups, + encoding="utf-8") else: error_message = 'The value of log_rotate_mode option should be ' +\ '"size" or "time", not "%s".' % rotate_mode