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: Clearify necessities for logging with timestamps
Type: Stage: resolved
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, krichter, python-dev, r.david.murray, vinay.sajip
Priority: normal Keywords:

Created on 2015-04-25 21:17 by krichter, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg242024 - (view) Author: Karl Richter (krichter) Date: 2015-04-25 21:17
The `Formatter` section of the `logging` module at https://docs.python.org/2/library/logging.html#formatter-objects reads like it's sufficient to create an instance of `Formatter` with default arguments (and set it as formatter of the `Handler` of a `Logger`) to have add timestamps to logging output.
msg242278 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-04-30 17:49
Not to my eyes.  It clearly says that if no formatting string is specified, the default is used, and that formatTime is used only if the message string contains asctime.  Up to Vinay whether he thinks it is worth adding something like "which does not include a reference to the date/time" after the mention of using the default message if fmt is not supplied.
msg242288 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2015-04-30 20:57
Perhaps I'll just change it to say 

... the default value of '%(message)s' is used, which just includes the message in the logging call. To have additional items of information in the formatted output (such as a timestamp), see other placeholder variables ...

and then link to the "LogRecord Attributes" section.
msg242368 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-05-02 02:08
Sounds good to me.
msg242386 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-05-02 08:47
New changeset 5ce760e2cc59 by Vinay Sajip in branch '2.7':
Issue #24060: Made logging.Formatter documentation a little clearer.
https://hg.python.org/cpython/rev/5ce760e2cc59

New changeset 88c141233d1e by Vinay Sajip in branch '3.4':
Issue #24060: Made logging.Formatter documentation a little clearer.
https://hg.python.org/cpython/rev/88c141233d1e

New changeset 1c72e9c1b3b4 by Vinay Sajip in branch 'default':
Closes #24060: Merged documentation update from 3.4.
https://hg.python.org/cpython/rev/1c72e9c1b3b4
History
Date User Action Args
2022-04-11 14:58:16adminsetgithub: 68248
2015-05-02 08:47:46python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg242386

resolution: fixed
stage: resolved
2015-05-02 02:08:49r.david.murraysetmessages: + msg242368
2015-04-30 20:57:27vinay.sajipsetmessages: + msg242288
2015-04-30 17:49:30r.david.murraysetnosy: + r.david.murray
messages: + msg242278
2015-04-25 22:32:49ned.deilysetnosy: + vinay.sajip
2015-04-25 21:17:04krichtercreate