Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #38629
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jcasale@activenetwerx.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'class,': 0.07; 'formatting': 0.07; 'override': 0.07; '__init__': 0.09; 'handlers': 0.09; 'methods,': 0.09; 'received:172.18.0': 0.16; 'specified.': 0.16; 'subject:Logging': 0.16; 'subject:class': 0.16; 'instance': 0.17; 'appropriate': 0.20; 'define': 0.20; 'to:name:python-list@python.org': 0.20; 'object.': 0.22; 'work.': 0.23; 'tried': 0.25; 'thanks!': 0.26; 'logging': 0.27; 'fine': 0.28; 'file': 0.32; 'adjust': 0.33; 'to:addr:python-list': 0.33; 'there': 0.35; 'add': 0.36; 'but': 0.36; "didn't": 0.36; 'does': 0.37; 'object': 0.38; 'skip:l 20': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'most': 0.61; 'received:unknown': 0.63; 'within': 0.64; 'few.': 0.93 |
| X-Cloudmark-SP-Filtered | true |
| X-Cloudmark-SP-Result | v=1.1 cv=KbdnvV9g8TRf6O+NCh6TOyF5LS0weEPBhaAycnKeCs0= c=1 sm=1 a=CRTDazI5n6YA:10 a=7PYXob_7ZXMA:10 a=BLceEmwcHowA:10 a=8nJEP1OIZ-IA:10 a=xqWC_Br6kY4A:10 a=oNw28mxuUhXRB3mVwYQ4Ag==:17 a=ZdCO1qe3w5B5K02WI80A:9 a=wPNLvfGTeEIA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 |
| From | "Joseph L. Casale" <jcasale@activenetwerx.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Subject | Logging within a class |
| Thread-Topic | Logging within a class |
| Thread-Index | AQHOB/XXYuV0u/Qa5Eq9aXDUdXj5Rw== |
| Date | Mon, 11 Feb 2013 01:26:52 +0000 |
| Accept-Language | en-US |
| Content-Language | en-US |
| X-MS-Has-Attach | |
| X-MS-TNEF-Correlator | |
| x-originating-ip | [172.18.0.200] |
| Content-Type | text/plain; charset="iso-8859-1" |
| Content-Transfer-Encoding | quoted-printable |
| MIME-Version | 1.0 |
| 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.1615.1360546087.2939.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1360546087 news.xs4all.nl 6881 [2001:888:2000:d::a6]:33529 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:38629 |
Show key headers only | View raw
Within __init__ I setup a log with self.log = logging.getLogger('foo') then add a
console and filehandler which requires the formatting to be specified. There a few
methods I setup a local log object by calling getChild against the global log object.
This works fine until I need to adjust the formatter for a few. With this style, I need
to redefine the handlers, so basically setup logging again.
I tried to get around this by using basicConfig and simply re-specifying format inside
the few methods, but it didn't work.
How does one accomplish this most elegantly so I can define one log instance with
the appropriate general console and file handlers in my class, then simply override
the formatter for both handlers they use in a couple methods?
Thanks!
jlc
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Logging within a class "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-02-11 01:26 +0000
csiph-web