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.

Author Nathaniel Manista
Recipients Nathaniel Manista, docs@python
Date 2018-09-05.20:39:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1536179966.39.0.56676864532.issue34590@psf.upfronthosting.co.za>
In-reply-to
Content
https://docs.python.org/3.8/howto/logging.html#configuring-logging-for-a-library is a bit too short and doesn't answer some questions that I have as a library author about the best ways to use logging in a library.

Should I make use of a single logger object in my library, multiple loggers in a tree, or multiple unrelated loggers? Since I have just one public module, I'm tempted to say that I should just use one logger object.

Should I present as part of my public API the name of the logger object(s) used? Probably - the documentation starts with "When developing a library which uses logging, you should take care to document how the library uses logging - for example, the names of loggers used.". But should I also include the logger objects in my API? If an application wants to reach my logger, why should they use "logging.getLogger(<name that I shared with them>)" rather than "my_library.LOGGER"?

Should I use my library's fully-qualified name as the name of its logger? This seems like a great idea because it's unlikely to bring up any new conflicts. Is it a best practice? Is there any better practice?

The "Configuring Logging for a Library" text could answer these questions, and maybe it should, but... I really think a toy library example that library authors could follow would also help a great deal.
History
Date User Action Args
2018-09-05 20:39:26Nathaniel Manistasetrecipients: + Nathaniel Manista, docs@python
2018-09-05 20:39:26Nathaniel Manistasetmessageid: <1536179966.39.0.56676864532.issue34590@psf.upfronthosting.co.za>
2018-09-05 20:39:26Nathaniel Manistalinkissue34590 messages
2018-09-05 20:39:26Nathaniel Manistacreate