Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12435

Re: Help me understand this logging config

References <bdf729a3-5f68-46fb-b6ae-27dceed5af77@18g2000yqu.googlegroups.com>
From anand jeyahar <anand.ibmgsi@gmail.com>
Date 2011-08-30 17:01 +0530
Subject Re: Help me understand this logging config
Newsgroups comp.lang.python
Message-ID <mailman.567.1314703930.27778.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,
   I took a look at the logging source code. getLogger checks for existing
loggers with the given name and if it doesn't creates one.



def getLogger(self, name):
        """
        Get a logger with the specified name (channel name), creating it
        if it doesn't yet exist. This name is a dot-separated hierarchical
        name, such as "a", "a.b", "a.b.c" or similar.

        If a PlaceHolder existed for the specified name [i.e. the logger
        didn't exist but a child of it did], replace it with the created
        logger and fix up the parent/child references which pointed to the
        placeholder to now point to the logger.
        """
        rv = None
        _acquireLock()
        try:
            if name in self.loggerDict:
                rv = self.loggerDict[name]
                if isinstance(rv, PlaceHolder):
                    ph = rv
                    rv = (self.loggerClass or _loggerClass)(name)
                    rv.manager = self
                    self.loggerDict[name] = rv
                    self._fixupChildren(ph, rv)
                    self._fixupParents(rv)
            else:
                rv = (self.loggerClass or _loggerClass)(name)
                rv.manager = self
                self.loggerDict[name] = rv
                self._fixupParents(rv)
        finally:
            _releaseLock()
        return rv

==============================================
Anand Jeyahar
https://sites.google.com/site/<https://sites.google.com/site/aangjie/home/quotes>
anandjeyahar
==============================================
The man who is really serious,
with the urge to find out what truth is,
has no style at all. He lives only in what is.
                  ~Bruce Lee

Love is a trade with lousy accounting policies.
                 ~Aang Jie<https://sites.google.com/site/aangjie/home/quotes>

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Help me understand this logging config Roy Smith <roy@panix.com> - 2011-08-29 10:53 -0700
  Re: Help me understand this logging config Peter Otten <__peter__@web.de> - 2011-08-30 11:24 +0200
    Re: Help me understand this logging config Roy Smith <roy@panix.com> - 2011-08-30 08:39 -0400
      Re: Help me understand this logging config Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2011-09-02 02:56 -0700
      Re: Help me understand this logging config Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2011-09-02 09:58 +0000
      Re: Help me understand this logging config Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2011-09-02 03:00 -0700
  Re: Help me understand this logging config anand jeyahar <anand.ibmgsi@gmail.com> - 2011-08-30 17:01 +0530

csiph-web