Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18154 > unrolled thread
| Started by | Ram <mobilebackup77@gmail.com> |
|---|---|
| First post | 2011-12-28 18:35 -0800 |
| Last post | 2011-12-29 23:53 +1100 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
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
| From | Ram <mobilebackup77@gmail.com> |
|---|---|
| Date | 2011-12-28 18:35 -0800 |
| Subject | logging.getLogger( __name__ ) |
| Message-ID | <2ccfda7d-ac94-4c51-bf64-513bc69f04d6@f1g2000yqi.googlegroups.com> |
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? Thanks, --Ram
[toc] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2011-12-29 00:00 -0500 |
| Message-ID | <mailman.4210.1325135110.27778.python-list@python.org> |
| In reply to | #18154 |
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/
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2011-12-29 23:53 +1100 |
| Message-ID | <87zkeb35fi.fsf@benfinney.id.au> |
| In reply to | #18154 |
Ram <mobilebackup77@gmail.com> writes: > How does this line work? What line? Please present some code in an example that we can run. Make the example as small as possible so it's clear what you are asking about. -- \ “See, in my line of work you gotta keep repeating things over | `\ and over and over again, for the truth to sink in; to kinda | _o__) catapult the propaganda.” —George W. Bush, 2005-05 | Ben Finney
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web