In Python 3.3, 3.4beta2, and bleeding edge (88411:e7d922d8ee03), the following occurs >>> import logging >>> logging.basicConfig(style="{") >>> logging.error("hello") %(levelname)s:%(name)s:%(message)s Of course, I would expect ERROR:root:hello to be output instead.
I created a patch that fixes this behavior for both { and $ style formats. Previously, default format strings were not being set correctly for those styles. This patch ensures that the correct default_format string is used. There is a minor "weirdness" issue that, due to there previously being 2 different default format strings for % style formatting, some tests rely on one, and some tests rely on the other. My patch remains backwards compatible with both default styles of format strings. This patch also includes test cases for behavior with the style keyword, which was not being tested before.
On further reflection, I will implement this slightly differently. The tests I will commit as is, except for stripping newlines before the comparison (to avoid worrying about differences in line separators across different platforms). However, the correct fix IMO is to add the default format strings to the _STYLES dict values: the effect should be the same.