Logging in Python

aha aquil.abdullah at gmail.com
Tue Feb 10 18:50:27 CET 2009

Hello All,

I have an application where logging may need to be configured in
multiple places.  I've used the Python Logging Framework for sometime,
but I'm still not sure how to test if logging has configured.  For
example, I have modules A, B, and C.

Below is some pseudo code...

class A(object):
  def __init__(self):

  # Configure logging
  # global logger

import moduleA
from myconfig import MyConfig
class B(object):
  def __init__(self):
    # self.config = MyConfig()
    # if logging has started [HOW DO YOU DO THIS?]
    #   self.logger = logging.getLogger("moduleB")
    # else
    #   self.logger = moduleA.startLogging(self.config)
    # moduleA.startLogging

Where I need help is determining if a logger has already been
configured.  Any advice?


More information about the Python-list mailing list