]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Specify that the encoding of file handler is utf-8. 2506/head
authorgarenchan <1412950785@qq.com>
Thu, 20 Sep 2018 03:36:37 +0000 (11:36 +0800)
committergarenchan <1412950785@qq.com>
Sat, 29 Sep 2018 00:31:12 +0000 (08:31 +0800)
Fix issue #2503.

tornado/log.py

index 5948d43bab0b964b3e152bb90f2f3bd8aca0234e..1bb6f9571c2fa04aaf2dc2d371fde4955e640b35 100644 (file)
@@ -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