This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: logging: fileConfig doesn't support formatter styles
Type: enhancement Stage:
Components: Versions: Python 3.4
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: domzippilli, vinay.sajip
Priority: normal Keywords:

Created on 2014-09-24 15:59 by domzippilli, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg227460 - (view) Author: Dom Zippilli (domzippilli) Date: 2014-09-24 15:59
In the logging module's, 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)
msg227478 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2014-09-24 18:08
While fileConfig() is not deprecated, I'm not planning to enhance it, as the newer dictConfig() API offers better functionality overall. With dictConfig(), you do have support for alternative formatting styles.
Date User Action Args
2022-04-11 14:58:08adminsetgithub: 66672
2014-10-06 09:15:55vinay.sajipsetstatus: open -> closed
resolution: wont fix
2014-09-24 18:08:56vinay.sajipsetmessages: + msg227478
2014-09-24 16:16:06berker.peksagsetnosy: + vinay.sajip
2014-09-24 15:59:18domzippillicreate