Log monitor encoding fix (#729)

Fixed log monitor encoding bug.
This commit is contained in:
SSpalding
2021-05-12 16:15:18 -07:00
committed by GitHub
parent 50abafbab1
commit 67c3801d73
2 changed files with 12 additions and 2 deletions
@@ -44,7 +44,7 @@ def check_exact_match(line, expected_line):
# Look for either start of line or whitespace, then the expected_line, then either end of the line or whitespace.
# This way we don't partial match inside of a string. So for example, 'foo' matches 'foo bar' but not 'foobar'
regex_pattern = re.compile("(^|\\s){}($|\\s)".format(re.escape(expected_line)))
regex_pattern = re.compile("(^|\\s){}($|\\s)".format(re.escape(expected_line)), re.UNICODE)
if regex_pattern.search(line) is not None:
return expected_line
@@ -125,7 +125,7 @@ class LogMonitor(object):
self.py_log = ""
try:
logger.debug("Monitoring log file in '{}' ".format(self.log_file_path))
with open(self.log_file_path, mode='r') as log:
with open(self.log_file_path, mode='r', encoding='utf-8') as log:
logger.info(
"Monitoring log file '{}' for '{}' seconds".format(self.log_file_path, timeout))