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


Groups > comp.lang.python > #35724

Re: Confused about logger config from within Python (3)

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; '__name__': 0.07; 'root,': 0.07; 'handler.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; "'__main__':": 0.16; 'received:80.91.229.3': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-dialin.net': 0.16; 'similarly,': 0.16; 'wrote:': 0.17; 'url:dev': 0.17; '>>>': 0.18; 'import': 0.21; 'header:User-Agent:1': 0.26; 'logging': 0.27; 'andrew': 0.27; 'easiest': 0.27; 'header:X-Complaints-To:1': 0.28; 'run': 0.28; 'url:python': 0.32; 'docs': 0.33; 'skip:l 40': 0.33; 'to:addr:python-list': 0.33; 'skip:l 30': 0.35; 'received:org': 0.36; 'url:org': 0.36; 'skip:g 30': 0.36; 'subject: (': 0.36; 'subject:: ': 0.38; 'skip:l 20': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'world': 0.63
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: Confused about logger config from within Python (3)
Date Sat, 29 Dec 2012 01:56:46 +0100
Organization None
References <a51d0c8a-adc9-4d8e-b3cc-affd7c6aad95@googlegroups.com> <3149c22d-ae6d-43b4-8f88-3cc5fa91094c@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p5084a836.dip.t-dialin.net
User-Agent KNode/4.7.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1413.1356742618.29569.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1356742618 news.xs4all.nl 6948 [2001:888:2000:d::a6]:55179
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35724

Show key headers only | View raw


andrew cooke wrote:

> similarly, if i run the following, i see only "done":
> 
>   from logging import DEBUG, root, getLogger
> 
>   if __name__ == '__main__':
>       root.setLevel(DEBUG)
>       getLogger(__name__).debug("hello world")
>       print('done')

You need a handler. The easiest way to get one is logging.basicConfig().

>>> import logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> logging.getLogger().debug("goodbye, cruel world")
DEBUG:root:goodbye, cruel world

Other revolutionary ideas: read the docs 
<http://docs.python.org/dev/howto/logging.html#logging-basic-tutorial> ;)

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


Thread

Confused about logger config from within Python (3) andrew cooke <andrew@acooke.org> - 2012-12-28 11:57 -0800
  Re: Confused about logger config from within Python (3) andrew cooke <andrew@acooke.org> - 2012-12-28 16:41 -0800
    Re: Confused about logger config from within Python (3) Peter Otten <__peter__@web.de> - 2012-12-29 01:56 +0100
      Re: Confused about logger config from within Python (3) andrew cooke <andrew@acooke.org> - 2012-12-28 18:29 -0800
        Re: Confused about logger config from within Python (3) Dave Angel <d@davea.name> - 2012-12-28 22:02 -0500
      Re: Confused about logger config from within Python (3) andrew cooke <andrew@acooke.org> - 2012-12-28 18:29 -0800
    Re: Confused about logger config from within Python (3) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-29 05:05 +0000
      Re: Confused about logger config from within Python (3) Roy Smith <roy@panix.com> - 2012-12-29 08:48 -0500
        Re: Confused about logger config from within Python (3) Terry Reedy <tjreedy@udel.edu> - 2012-12-29 19:18 -0500
          Re: Confused about logger config from within Python (3) Roy Smith <roy@panix.com> - 2012-12-29 20:08 -0500
  Re: Confused about logger config from within Python (3) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-29 04:31 +0000

csiph-web