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.

classification
Title: Add '%(asctime)s' into default BASIC_FORMAT in logging module
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Leon H., eric.smith, vinay.sajip
Priority: normal Keywords:

Created on 2018-07-02 10:04 by Leon H., last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg320864 - (view) Author: Leon H. (Leon H.) Date: 2018-07-02 10:04
Current BASIC_FORMAT:
BASIC_FORMAT = "%(levelname)s:%(name)s:%(message)s"

The first thing people do is set the format to '%(asctime)s:%(levelname)s:%(name)s:%(message)s' or like after importing logging module.

Could we put the '%(asctime)s' into the default BASIC_FORMAT setting and save everyone's time?
msg320866 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-07-02 10:17
Unfortunately, I don't see how we can do this without breaking code that assumes the default log format doesn't have the timestamp in it.

In particular, I'm thinking of external log file parsers.
msg320869 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2018-07-02 10:55
> The first thing people do is set the format to '%(asctime)s:%(levelname)s:%(name)s:%(message)s' or like after importing logging module.

"People" - you don't claim to speak for *everyone*, right?

basicConfig() takes a format= keyword argument that you can use to specify your required format string. Since you have to call basicConfig() anyway, it seems little hardship to specify the format you want in your call.

Closing as "not a bug", which here is to be interpreted as "not an enhancement that's needed".
History
Date User Action Args
2022-04-11 14:59:02adminsetgithub: 78201
2018-07-02 10:55:47vinay.sajipsetstatus: open -> closed
resolution: not a bug
messages: + msg320869

stage: resolved
2018-07-02 10:17:32eric.smithsetnosy: + vinay.sajip, eric.smith
messages: + msg320866
2018-07-02 10:04:44Leon H.create