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


Groups > comp.lang.python > #18158

Re: logging.getLogger( __name__ )

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: logging.getLogger( __name__ )
Date 2011-12-29 00:00 -0500
References <2ccfda7d-ac94-4c51-bf64-513bc69f04d6@f1g2000yqi.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.4210.1325135110.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, 28 Dec 2011 18:35:39 -0800 (PST), Ram <mobilebackup77@gmail.com>
wrote:

>
>How does this line work? How do I get my logger to point to a file to
>be named as /tmp/modulename.log : I can do this using inspect, but
>there probably is a better way?
>
	Uhm... by defining a file-handler and supplying the name to it? 

	All you've done with (I presume an assignment):

	myLogger = logging.getLogger(__name__)

is to create a "logger" which will prefix log messages with the module
name. The default destination is probably still stderr.

	See:
See 15.7.14.2 in the library reference manual for defining filehandlers;
15.7.1.1 for a sample using basic configuration and setting a default
file (the file will be common to all loggers I believe).
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


Thread

logging.getLogger( __name__ ) Ram <mobilebackup77@gmail.com> - 2011-12-28 18:35 -0800
  Re: logging.getLogger( __name__ ) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-12-29 00:00 -0500
  Re: logging.getLogger( __name__ ) Ben Finney <ben+python@benfinney.id.au> - 2011-12-29 23:53 +1100

csiph-web