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


Groups > comp.lang.python > #20625

Re: HTTP logging

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <arnodel@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.018
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'skip': 0.04; 'subclass': 0.09; 'received:209.85.214.174': 0.13; '[errno': 0.16; 'received:10.60': 0.16; 'subject:logging': 0.16; 'try/except': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'header:In- Reply-To:1': 0.22; 'cc:2**0': 0.26; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'server': 0.30; 'there': 0.33; 'jason': 0.34; 'connection': 0.36; 'received:209.85.214': 0.36; 'http': 0.37; 'received:google.com': 0.37; 'happens': 0.38; 'received:209.85': 0.38; 'except': 0.39; 'received:209': 0.39; 'header:Received:6': 0.61; 'http:': 0.84
Received-SPF pass (google.com: domain of arnodel@gmail.com designates 10.60.1.4 as permitted sender) client-ip=10.60.1.4;
Authentication-Results mr.google.com; spf=pass (google.com: domain of arnodel@gmail.com designates 10.60.1.4 as permitted sender) smtp.mail=arnodel@gmail.com; dkim=pass header.i=arnodel@gmail.com
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=+oaR6DEX64dhK/LXIgGsR4yWoTN9z0SfvGPhYNVqw8I=; b=Lk73RYxxCWNnHMsA7g/IPyIbeHor3JuyI7KbYMDa0hUzr6AHu6gBh+OSGSKjP0EfZE PUrphQxFV/fGbU3UxmeJdMCNkifYodtZRBBJSTg0DXS0M0UZgNmu8SbMiLubtPEldD9V 7zy4jbrFO9d4GOZptu/6gJ2gbDsCRCME4ioo8=
MIME-Version 1.0
In-Reply-To <CANy1k1g1P-1hiC-=Ht5rLp2a6BvM=ZOk2NYL1e9u_BRcZCrSNA@mail.gmail.com>
References <CANy1k1g1P-1hiC-=Ht5rLp2a6BvM=ZOk2NYL1e9u_BRcZCrSNA@mail.gmail.com>
Date Mon, 20 Feb 2012 16:16:42 +0000
Subject Re: HTTP logging
From Arnaud Delobelle <arnodel@gmail.com>
To Jason Friedman <jason@powerpull.net>
Content-Type text/plain; charset=UTF-8
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.13.1329754605.3037.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1329754605 news.xs4all.nl 6941 [2001:888:2000:d::a6]:55467
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20625

Show key headers only | View raw


On 20 February 2012 16:03, Jason Friedman <jason@powerpull.net> wrote:
> I am logging to HTTP:
>
> logger.addHandler(logging.handlers.HTTPHandler(host, url))
>
> Works great, except if my HTTP server happens to be unavailable:
>
> socket.error: [Errno 111] Connection refused
>
> Other than wrapping all my logger.log() calls in try/except blocks, is
> there a way to skip logging to the HTTPhandler if the HTTP server is
> unavailable?

Here's one: subclass HTTPHandler :)

-- 
Arnaud

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


Thread

Re: HTTP logging Arnaud Delobelle <arnodel@gmail.com> - 2012-02-20 16:16 +0000

csiph-web