From 82ea0f9517a1b799e7457fd6afa19b9c2d75da7f Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Sat, 26 Dec 2015 12:21:47 +0000 Subject: Closes #25664: handled logger names in Unicode. --- Lib/logging/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index fa9ebe8..caf151d 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -465,7 +465,15 @@ class Formatter(object): record.message = record.getMessage() if self.usesTime(): record.asctime = self.formatTime(record, self.datefmt) - s = self._fmt % record.__dict__ + try: + s = self._fmt % record.__dict__ + except UnicodeDecodeError as e: + # Issue 25664. The logger name may be Unicode. Try again ... + try: + record.name = record.name.decode('utf-8') + s = self._fmt % record.__dict__ + except UnicodeDecodeError: + raise e if record.exc_info: # Cache the traceback text to avoid converting it multiple times # (it's constant anyway) -- cgit v0.12