diff --git a/HISTORY.rst b/HISTORY.rst index ac1128a..1083009 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,11 @@ Release History =============== +0.8.2 ++++++ + +* Always use UTF-8 for log file encoding (#247) + 0.8.1 +++++ diff --git a/knack/log.py b/knack/log.py index adf75ae..5c0aec9 100644 --- a/knack/log.py +++ b/knack/log.py @@ -16,6 +16,8 @@ # without --debug flag. cli_logger_names = [CLI_LOGGER_NAME] +LOG_FILE_ENCODING = 'utf-8' + class CliLogLevel(IntEnum): CRITICAL = 0 @@ -163,7 +165,8 @@ def _init_logfile_handlers(self, root_logger, cli_loggers): ensure_dir(self.log_dir) log_file_path = os.path.join(self.log_dir, self.logfile_name) from logging.handlers import RotatingFileHandler - logfile_handler = RotatingFileHandler(log_file_path, maxBytes=10 * 1024 * 1024, backupCount=5) + logfile_handler = RotatingFileHandler(log_file_path, maxBytes=10 * 1024 * 1024, backupCount=5, + encoding=LOG_FILE_ENCODING) lfmt = logging.Formatter('%(process)d : %(asctime)s : %(levelname)s : %(name)s : %(message)s') logfile_handler.setFormatter(lfmt) logfile_handler.setLevel(logging.DEBUG) diff --git a/setup.py b/setup.py index fab43f1..606956b 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ from codecs import open from setuptools import setup, find_packages -VERSION = '0.8.1' +VERSION = '0.8.2' DEPENDENCIES = [ 'argcomplete',