Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'received:134': 0.05; 'root': 0.05; 'unittest': 0.09; 'def': 0.12; 'logger': 0.16; 'missing?': 0.16; 'wrote:': 0.18; 'import': 0.22; 'header:User- Agent:1': 0.23; 'logging': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'code': 0.31; 'assert': 0.31; 'class': 0.32; 'supposed': 0.32; 'url:python': 0.33; 'url:org': 0.36; 'should': 0.36; 'two': 0.37; 'challenging': 0.38; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'skip:u 10': 0.60; 'skip:t 30': 0.61; 'email addr:gmail.com': 0.63; 'different': 0.65 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqoEAJGfClWGuA9G/2dsb2JhbABcg1hagw3DB4V1AoIVAQEBAQEBhQwBAQEDASNVEQsYAgIFFgsCAgkDAgECAQ82EwYCAogXAwkIDbFClkUNRYRrAQEBBwEBAQEaBIEhiXaCRII0FoJSgUUFlDeEM4FMhnSHDoYmIoNvbgGCQgEBAQ Date: Thu, 19 Mar 2015 11:09:42 +0100 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.5.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Root logger sanity References: <5277e05b-c333-4e25-80ba-bb9cd378ca84@googlegroups.com> In-Reply-To: <5277e05b-c333-4e25-80ba-bb9cd378ca84@googlegroups.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1426759854 news.xs4all.nl 2839 [2001:888:2000:d::a6]:56149 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87738 On 03/19/2015 10:35 AM, martin.spamer@gmail.com wrote: > The following code is challenging my sanity, in my understanding of the documentation this should pass, given that getLogger is supposed to return the root logger and the root logger should be called 'root'. Where do you get the idea that the root logger should be called 'root'? AFAIU the documentation the root logger is nameless. So logging.getLogger() will return the root logger while logging.getLogger('root') will return the logger named 'root' which are two different loggers. > > https://docs.python.org/2/library/logging.html#logger-objects > > What am I missing? > > > from unittest import TestCase > import logging > > class LoggingSanityTest(TestCase): > > def test_root_logging_sanity(self): > assert logging.getLogger() == logging.getLogger('root')