Issue 20242: logging style parameter does not work correctly (original) (raw)

Created on 2014-01-13 18:41 by kespindler, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Issue20242.patch kespindler,2014-01-13 18:48 review
Messages (5)
msg208035 - (view) Author: (kespindler) Date: 2014-01-13 18:41
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.
msg208038 - (view) Author: (kespindler) Date: 2014-01-13 18:48
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.
msg208048 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2014-01-13 21:20
Thanks for this. The patch looks good, and I expect to implement it shortly.
msg208049 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2014-01-13 21:54
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.
msg208050 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-13 22:01
New changeset e7fcf0d8008f by Vinay Sajip in branch '3.3': Issue #20242: Fixed basicConfig() format strings for the alternative formatting styles. http://hg.python.org/cpython/rev/e7fcf0d8008f New changeset c1605d24fb35 by Vinay Sajip in branch 'default': Closes #20242: Merged fix from 3.3. http://hg.python.org/cpython/rev/c1605d24fb35
History
Date User Action Args
2022-04-11 14:57:56 admin set github: 64441
2014-01-13 22:01:29 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: resolved
2014-01-13 21:54:55 vinay.sajip set messages: +
2014-01-13 21:20:30 vinay.sajip set assignee: vinay.sajipmessages: +
2014-01-13 19:09:45 ned.deily set nosy: + vinay.sajip
2014-01-13 18:48:07 kespindler set files: + Issue20242.patchkeywords: + patchmessages: +
2014-01-13 18:41:50 kespindler create