Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'ram': 0.05; 'see:': 0.07; 'prefix': 0.09; 'presume': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'library': 0.13; '>how': 0.16; '>there': 0.16; 'bieber': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'inspect,': 0.16; 'message-id:@4ax.com': 0.16; 'received:wlfraed': 0.16; 'stderr.': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'url:home': 0.21; 'dec': 0.22; 'received:166': 0.23; 'way?': 0.23; 'module': 0.26; 'lee': 0.28; '(the': 0.30; 'does': 0.32; 'header:X-Complaints- To:1': 0.33; 'named': 0.33; 'it?': 0.33; 'done': 0.34; 'to:addr :python-list': 0.34; 'probably': 0.34; 'setting': 0.34; 'file': 0.36; 'charset:us-ascii': 0.37; 'but': 0.37; 'reference': 0.37; 'using': 0.38; 'received:org': 0.38; 'to:addr:python.org': 0.40; '2011': 0.61; 'destination': 0.67; 'dennis': 0.73; '-0800': 0.84; 'subject: )': 0.84; 'subject:( ': 0.84; 'subject:skip:l 10': 0.84; 'supplying': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: logging.getLogger( __name__ ) Date: Thu, 29 Dec 2011 00:00:26 -0500 References: <2ccfda7d-ac94-4c51-bf64-513bc69f04d6@f1g2000yqi.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: mobile-166-147-101-117.mycingular.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325135110 news.xs4all.nl 6852 [2001:888:2000:d::a6]:47614 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18158 On Wed, 28 Dec 2011 18:35:39 -0800 (PST), Ram 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/