Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.093 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.00; 'skip': 0.04; '[errno': 0.16; 'subject:logging': 0.16; 'try/except': 0.16; 'sender:addr:gmail.com': 0.24; 'message-id:@mail.gmail.com': 0.29; 'server': 0.30; 'there': 0.33; 'to:addr:python-list': 0.35; 'received:209.85.160': 0.36; 'connection': 0.36; 'http': 0.37; 'to:name:python-list': 0.37; 'received:google.com': 0.37; 'happens': 0.38; 'received:209.85': 0.38; 'received:209.85.160.46': 0.39; 'received:mail- pw0-f46.google.com': 0.39; 'except': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.40; 'header:Received:6': 0.61; 'http:': 0.84 Received-SPF: pass (google.com: domain of jsf80238@gmail.com designates 10.68.218.228 as permitted sender) client-ip=10.68.218.228; Authentication-Results: mr.google.com; spf=pass (google.com: domain of jsf80238@gmail.com designates 10.68.218.228 as permitted sender) smtp.mail=jsf80238@gmail.com; dkim=pass header.i=jsf80238@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=4tBCgYTIobVSOkd8aunHAjhyCoLwrpeYCvJqyuOYhOQ=; b=H/XVlgKIM+gzDjCvtL/+NNT+NM0WGAevIZ4lC98Q69WkrevDUNCwTflT+SxnU7QK9S nZM7Y2p5PeamsylZhdLmXxshT0MSSflSUVk5YWohq7wcAz65fB3iS/rgcaaiGarjDp9A uxewZSE1YziP6Tz1i9sVXtstDycUIgMRenmbY= MIME-Version: 1.0 Sender: jsf80238@gmail.com Date: Mon, 20 Feb 2012 16:03:25 +0000 X-Google-Sender-Auth: kU-l8cTgPDU8qFFYU8vla5B0g0I Subject: HTTP logging From: Jason Friedman To: python-list Content-Type: text/plain; charset=ISO-8859-1 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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1329753809 news.xs4all.nl 6968 [2001:888:2000:d::a6]:50599 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20624 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?