Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68388
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!news.osn.de!diablo2.news.osn.de!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.021 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; '16,': 0.03; 'handler': 0.05; 'think,': 0.07; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'handler,': 0.16; 'handlers.': 0.16; 'inability': 0.16; 'somewhere.': 0.16; 'subject:Clearing': 0.16; 'suggestion.': 0.16; "tim's": 0.16; 'wrote:': 0.18; 'written': 0.21; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'tim': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; '>>>>': 0.31; "i'd": 0.34; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'tasks': 0.38; 'pm,': 0.38; 'little': 0.38; 'sure': 0.39; 'remove': 0.60; 'read': 0.60; 'reaching': 0.61; 'reach': 0.63; 'mar': 0.68; 'implications': 0.84; 'safer': 0.84; 'viable': 0.84; 'to:none': 0.92; 'dirty': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=7VYjfdX6nR4y6EUyto+o6IqYC4iY7cGhT+dHkoUOmcg=; b=Ssko9XrzHUYGaImg4sL01KkfN42nt/Otct3OeH9ny0bgFJaQ3uKbA+PSaU+aHB2LeR BP/JMJxv70TCsUaXliHW2wGwqkU+rEbIJ6fmaBE9k6KnTVVlY5sVRL6797WO7gfAK3cu d1Ss/8i1gWVBhU8mOAHqGXIsO9Yd4wHM18Xo1WFinCgp1B8uNUV2NYgqWuHtHo9ECCgQ OcBNyhlzcTDF/sQ2sjMEiPVZAMLTuiaLMt/2n20EV4VtI6YQaniGvzhD/mmekK5/qfCR Ri0FA9OGlNOE+8f1qW+SJXz0kj/GGMjLMpnistVuqOreIBRe/G2DzpXWgD6APEIe40mP Ib8Q== |
| MIME-Version | 1.0 |
| X-Received | by 10.66.232.7 with SMTP id tk7mr19301675pac.94.1394960577628; Sun, 16 Mar 2014 02:02:57 -0700 (PDT) |
| In-Reply-To | <gd.usenet-B1805D.09394016032014@dwarf.main.lan> |
| References | <mailman.8159.1394938715.18130.python-list@python.org> <gd.usenet-B1805D.09394016032014@dwarf.main.lan> |
| Date | Sun, 16 Mar 2014 20:02:57 +1100 |
| Subject | Re: Clearing out handlers in logging? |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.8163.1394960581.18130.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1394960581 news.xs4all.nl 2892 [2001:888:2000:d::a6]:38480 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:68388 |
Show key headers only | View raw
On Sun, Mar 16, 2014 at 7:39 PM, Gunther Dietrich <gd.usenet@spamfence.net> wrote: >>but it feels a little dirty to reach into logging.root.handlers since >>there are other methods for adding/removing handlers. However, as >>best I can tell, to remove a handler, you already need to have it >>saved somewhere. > > What about this: > >>>> for handler in log.handlers: > ... log.removeHandler(handler) > > I think, that's just one of the tasks that removeHandler() was written > for. I'm sure Tim was aware of the removeHandler function. But this is still reaching into log.handlers - although IMO it's safer to reach in and read than to reach in and mutate. So without the implications of Tim's inability to read docs, this is a viable suggestion. I'd prefer this over the original "del log.handlers[:]". ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Clearing out handlers in logging? Tim Chase <python.list@tim.thechases.com> - 2014-03-15 21:58 -0500
Re: Clearing out handlers in logging? Gunther Dietrich <gd.usenet@spamfence.net> - 2014-03-16 09:39 +0100
Re: Clearing out handlers in logging? Chris Angelico <rosuav@gmail.com> - 2014-03-16 20:02 +1100
Re: Clearing out handlers in logging? Peter Otten <__peter__@web.de> - 2014-03-16 10:18 +0100
Re: Clearing out handlers in logging? Chris Angelico <rosuav@gmail.com> - 2014-03-16 20:35 +1100
Re: Clearing out handlers in logging? Tim Chase <python.list@tim.thechases.com> - 2014-03-16 07:57 -0500
Re: Clearing out handlers in logging? Gunther Dietrich <gd.usenet@spamfence.net> - 2014-03-16 19:29 +0100
Re: Clearing out handlers in logging? Tim Chase <python.list@tim.thechases.com> - 2014-03-16 13:50 -0500
csiph-web