# Use lsst prefix in logger names

XMLWordPrintable

#### Details

• Type: RFC
• Status: Implemented
• Resolution: Done
• Component/s:
• Labels:
None

#### Description

Current guidance for naming a loggerCurrent guidance for naming a logger is the following:

Logger names should generally start with the fully qualified name of the module/file containing the logger, without the leading lsst.. Some example logger names are afw.image.MaskedImage and meas.algorithms.starSelector.

Specifically we recommend that logger names do not include a fixed prefix. This goes against the advice for Python logging or using:

 logging.getLogger(__name__) 

which would include the prefix.

Dropping the prefix has the advantage that the name is 5 characters shorter and so takes up less space when the log message is emitted and is less typing if manually constructed or an override is given on the command line.

Dropping the prefix does have a number of disadvantages though:

• There is a remote possibility of namespace clashes with other packages.
• It's impossible to set the logger level globally for all our packages whilst leaving third party loggers untouched.

In particular if anyone has done --log-level=DEBUG with pipetask they will see lots of fun output from matplotlib (and that message from conda changing standard output always turns up as INFO). In particular we could change how pipetask works such that it implicitly converts a general log-level request to setting the lsst. logger and not the root logger (But that can clearly not happen immediately).

I propose we change our default recommendation to include the prefix in all new loggers (and over time switch over all loggers to using the recommended Python scheme where appropriate) including those constructed for Tasks.

#### Activity

Tim Jenness created issue -
Field Original Value New Value
 Status Proposed [ 10805 ] Adopted [ 10806 ]
 Link This issue is triggering DM-31800 [ DM-31800 ]
 Link This issue is triggering DM-31801 [ DM-31801 ]
 Link This issue is triggering DM-31802 [ DM-31802 ]
 Resolution Done [ 10000 ] Status Adopted [ 10806 ] Implemented [ 11105 ]

#### People

Assignee:
Tim Jenness
Reporter:
Tim Jenness
Watchers:
Arun Kannawadi, Jim Bosch, John Parejko, Kian-Tat Lim, Meredith Rawls, Russell Owen, Simon Krughoff, Tim Jenness, Yusra AlSayyad
0 Vote for this issue
Watchers:
9 Start watching this issue

#### Dates

Created:
Updated:
Resolved:
Planned End:

#### Jenkins Builds

No builds found.