[New-bugs-announce] [issue22482] logging: fileConfig doesn't support formatter styles

Dom Zippilli report at bugs.python.org
Wed Sep 24 17:59:18 CEST 2014

New submission from Dom Zippilli:

In the logging module's config.py, see the _create_formatters(cp) method used by the fileConfig() method. Note that it pulls "format" and "datefmt" and submits these in the formatter constructor:

f = c(fs, dfs)

However, the Formatter constructor has a third argument for formatting style:

def __init__(self, fmt=None, datefmt=None, style='%')

Since the argument is not passed, ConfigParser-format logging configs must use %-style logging format masks. We'd prefer to use curlies.

Note that the code for the dictionary configurator does this correctly:

            fmt = config.get('format', None)
            dfmt = config.get('datefmt', None)
            style = config.get('style', '%')
            result = logging.Formatter(fmt, dfmt, style)

messages: 227460
nosy: domzippilli
priority: normal
severity: normal
status: open
title: logging: fileConfig doesn't support formatter styles
type: enhancement
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list