diff -r e7d922d8ee03 Lib/logging/__init__.py --- a/Lib/logging/__init__.py Sat Jan 11 13:15:39 2014 +0200 +++ b/Lib/logging/__init__.py Mon Jan 13 10:42:27 2014 -0800 @@ -366,7 +366,7 @@ return self._fmt % record.__dict__ class StrFormatStyle(PercentStyle): - default_format = '{message}' + default_format = '{levelname}:{name}:{message}' asctime_format = '{asctime}' asctime_search = '{asctime' @@ -375,7 +375,7 @@ class StringTemplateStyle(PercentStyle): - default_format = '${message}' + default_format = '${levelname}:${name}:${message}' asctime_format = '${asctime}' asctime_search = '${asctime}' @@ -1718,9 +1718,11 @@ stream = kwargs.get("stream") h = StreamHandler(stream) handlers = [h] - fs = kwargs.get("format", BASIC_FORMAT) + fs = kwargs.get("format", None) dfs = kwargs.get("datefmt", None) style = kwargs.get("style", '%') + if fs is None and style == "%": + fs = BASIC_FORMAT fmt = Formatter(fs, dfs, style) for h in handlers: if h.formatter is None: diff -r e7d922d8ee03 Lib/test/test_logging.py --- a/Lib/test/test_logging.py Sat Jan 11 13:15:39 2014 +0200 +++ b/Lib/test/test_logging.py Mon Jan 13 10:42:27 2014 -0800 @@ -3517,6 +3517,22 @@ # level is not explicitly set self.assertEqual(logging.root.level, self.original_logging_level) + def test_strformatstyle(self): + with captured_stdout() as output: + logging.basicConfig(stream=sys.stdout, style="{") + logging.error("Log an error") + sys.stdout.seek(0) + self.assertEqual(output.getvalue(), + "ERROR:root:Log an error\n") + + def test_stringtemplatestyle(self): + with captured_stdout() as output: + logging.basicConfig(stream=sys.stdout, style="$") + logging.error("Log an error") + sys.stdout.seek(0) + self.assertEqual(output.getvalue(), + "ERROR:root:Log an error\n") + def test_filename(self): def cleanup(h1, h2, fn):