[issue24060] Clearify necessities for logging with timestamps

New submission from Karl Richter: 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. ---------- assignee: docs@python components: Documentation messages: 242024 nosy: docs@python, krichter priority: normal severity: normal status: open title: Clearify necessities for logging with timestamps versions: Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24060> _______________________________________

Changes by Ned Deily <nad@acm.org>: ---------- nosy: +vinay.sajip _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24060> _______________________________________

R. David Murray added the comment: 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. ---------- nosy: +r.david.murray _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24060> _______________________________________

Vinay Sajip added the comment: 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. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24060> _______________________________________

R. David Murray added the comment: Sounds good to me. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24060> _______________________________________

Roundup Robot added the comment: 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 ---------- nosy: +python-dev resolution: -> fixed stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24060> _______________________________________
participants (5)
-
Karl Richter
-
Ned Deily
-
R. David Murray
-
Roundup Robot
-
Vinay Sajip