[issue14031] logging module cannot format str.format log messages

2014-01-17 Thread kespindler
kespindler added the comment: Those new examples look good. I appreciate your revisiting the issue. On Wed, Jan 15, 2014 at 7:12 AM, Vinay Sajip wrote: > > Vinay Sajip added the comment: > > Cookbook updated. See changesets 7c4f0c3dedaf and 0056aaf42bf7 for more > information - docs.python.org

[issue14031] logging module cannot format str.format log messages

2014-01-15 Thread Vinay Sajip
Vinay Sajip added the comment: Cookbook updated. See changesets 7c4f0c3dedaf and 0056aaf42bf7 for more information - docs.python.org should update within a day. -- ___ Python tracker __

[issue14031] logging module cannot format str.format log messages

2014-01-13 Thread Vinay Sajip
Vinay Sajip added the comment: > The problem with leaving the behavior as is is that currently the > style keyword is effectively useless and grossly misleading to users. If you are referring to the style keyword in basicConfig, it merely sets the style of the Formatter used. That can certainly

[issue14031] logging module cannot format str.format log messages

2014-01-13 Thread kespindler
kespindler added the comment: I definitely do recognize that important case. I think the proper solution, however, to that is make a very clear warning in the documentation that changing the style might affect the logging of 3rd party tools. Those users would probably have to use the % style form

[issue14031] logging module cannot format str.format log messages

2014-01-13 Thread R. David Murray
R. David Murray added the comment: The reason is simple: in the general case you do not control all of the statements that produce log messages. Some of them come from 3rd party library code. Perhaps the documentation needs to be clarified on this point, and document the technique mentioned

[issue14031] logging module cannot format str.format log messages

2014-01-13 Thread kespindler
kespindler added the comment: I came across this issue while fixing issue20242. This issue (14031) still exists and is a major source of annoyance and confusion, and I suggest re-opening it. Specifying the "{" style, while still being forced to use % formatting in log statements is backward a

[issue14031] logging module cannot format str.format log messages

2012-02-16 Thread Vinay Sajip
Vinay Sajip added the comment: Use instead the approach described in this post: http://plumberjack.blogspot.com/2010/10/supporting-alternative-formatting.html -- resolution: -> out of date status: open -> closed ___ Python tracker

[issue14031] logging module cannot format str.format log messages

2012-02-16 Thread Guido Kollerie
Guido Kollerie added the comment: I see, could this be made to work if I explicitly request a logger instead?: logger = logging.getLogger('my_logger', style='{') logger.info('User {} logged in', username) Maybe even for the root logger: root_logger = logging.getLogger(style='{')

[issue14031] logging module cannot format str.format log messages

2012-02-16 Thread R. David Murray
R. David Murray added the comment: That can't work. The logging messages may come from libraries written by someone else, using % formatting. The style has to be set at the individual logger level. -- nosy: +r.david.murray, vinay.sajip ___ Python

[issue14031] logging module cannot format str.format log messages

2012-02-16 Thread Guido Kollerie
New submission from Guido Kollerie : When logging messages with variable data one typically writes: username = 'Guido' logging.info('User %s logged in', username) However Python 3 has support str.format (PEP 3101). If one has adopted str.format for formatting strings in Python 3 code o