Question by someone coming from C...

Christian Heimes lists at
Wed Jun 11 00:43:57 CEST 2008

John Krukoff wrote:
> Since you probably want access to these from many different places in
> your code, I find the simplest way is to create a logging module of your
> own (not called logging, obviously) and instantiate all of your loggers
> in that namespace, then import that one module as needed.

No, don't do that. Simple do

import logging
log = logging.getLogger("some_name")

The logging module takes care of the rest. The logging.getLogger()
function creates a new logger *only* when the name hasn't been used yet.


More information about the Python-list mailing list