Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#17900 closed Bug (fixed)

Logging Primer misrepresents the StreamHandler

Reported by: c4m3lo Owned by: nobody
Component: Documentation Version: 1.4-beta-1
Severity: Normal Keywords:
Cc: lemaire.adrien@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The Django Logging Primer says that logging.StreamHandler outputs to stdout. This is at odds with the Python documentation for the class, which says that it goes to sys.stderr.

Change History (6)

comment:1 follow-up: Changed 3 years ago by Fandekasp

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Effectively, the doc says:

Returns a new instance of the StreamHandler class. If stream is specified, the instance will use it for
logging output; otherwise, sys.stderr will be used.

But django always specifies a stream to handler, thus logging.StreamHandler outputs to stdout.
You can have a look at django.utils.dictconfig.py DictConfigurator.configure_handler() , from line 491 to 501.

comment:2 Changed 3 years ago by Fandekasp

  • Cc lemaire.adrien@… added

comment:3 in reply to: ↑ 1 Changed 3 years ago by claudep

  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Triage Stage changed from Unreviewed to Accepted

Replying to Fandekasp:

But django always specifies a stream to handler, thus logging.StreamHandler outputs to stdout.
You can have a look at django.utils.dictconfig.py DictConfigurator.configure_handler() , from line 491 to 501.

Sorry, but that is not true. By default, no kwargs are provided to the handler class constructor, so the default is stderr. The docs have to be fixed.

comment:4 Changed 3 years ago by claudep

  • Resolution set to fixed
  • Status changed from reopened to closed

In [17741]:

Fixed #17900 -- StreamHandler output defaults to stderr. Thanks c4m3lo for the report.

comment:5 Changed 3 years ago by Fandekasp

ah sorry for my mistake

comment:6 Changed 3 years ago by claudep

In [17742]:

[1.3.X] Fixed #17900 -- StreamHandler output defaults to stderr. Thanks c4m3lo for the report.

Backport of r17741 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top