Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

0.8.2
+++++

* Always use UTF-8 for log file encoding (#247)

0.8.1
+++++

Expand Down
5 changes: 4 additions & 1 deletion knack/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# without --debug flag.
cli_logger_names = [CLI_LOGGER_NAME]

LOG_FILE_ENCODING = 'utf-8'


class CliLogLevel(IntEnum):
CRITICAL = 0
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup, find_packages

VERSION = '0.8.1'
VERSION = '0.8.2'

DEPENDENCIES = [
'argcomplete',
Expand Down