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


Groups > comp.lang.python > #19040

Re: python loggingL filter limitation, looks intentional?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <vinay_sajip@yahoo.co.uk>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'handler': 0.04; 'passes': 0.05; 'live?': 0.07; 'python': 0.08; 'commonly': 0.09; 'handlers': 0.09; 'subject:python': 0.10; 'cc:addr:python-list': 0.15; 'cc:name:python list': 0.16; 'chris,': 0.16; 'from:addr:vinay_sajip': 0.16; 'logger.': 0.16; 'reply- to:addr:vinay_sajip': 0.16; 'sajip': 0.16; 'simplistix': 0.16; 'subject:limitation': 0.16; 'url:simplistix': 0.16; 'vinay': 0.16; 'instance': 0.18; 'that?': 0.18; 'cheers,': 0.20; 'header:In- Reply-To:1': 0.22; '-----': 0.23; 'libraries': 0.24; 'cc:2**0': 0.25; 'cc:': 0.25; 'looks': 0.27; 'filter': 0.28; "skip:' 10": 0.29; 'cc:addr:python.org': 0.29; 'class': 0.29; 'down,': 0.30; 'pattern': 0.30; 'chris': 0.30; 'subject:?': 0.30; 'app': 0.31; 'attach': 0.32; 'cases': 0.32; 'dependent': 0.32; 'like.': 0.32; 'list': 0.32; 'it.': 0.33; 'message.': 0.33; 'match': 0.33; 'subject:': 0.34; 'from:addr:yahoo.co.uk': 0.34; 'rather': 0.34; 'certain': 0.34; 'integer': 0.34; 'root': 0.34; 'apply': 0.35; 'however,': 0.35; 'sent:': 0.36; 'uses': 0.36; 'example,': 0.36; 'passed': 0.37; 'enough': 0.37; 'getting': 0.37; 'monday,': 0.38; 'processing': 0.39; 'from:': 0.39; 'why': 0.39; 'or,': 0.39; 'subject:: ': 0.39; 'url:uk': 0.40; 'more': 0.61; 'your': 0.61; 'url:co': 0.63; 'levels': 0.64; 'making': 0.65; 'header:Reply- To:1': 0.71; 'received:bullet.mail.ukl.yahoo.com': 0.80; '13:10': 0.84; '2012,': 0.84; 'received:217.146.183.180': 0.84; 'reply- to:addr:yahoo.co.uk': 0.91; 'received:217.146.183': 0.95
X-Yahoo-Newman-Property ymail-3
X-Yahoo-Newman-Id 344126.12382.bm@omp1039.mail.ukl.yahoo.com
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1326726505; bh=lfnCZvmmAh1vo7zb9LZ71xaoLIdlOpUjFdrJto2v/rU=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=DR3vKjq6HwCmOyF1giQxz0BsJiRz/Gn+hxR8zvzGoec5YAuvLVO14hpVh6RmvLWxDDLqhsguRjEXD+7db7eXCNhx4dDJieXk/xRWaXxi+kfX9H55vLGBMhHare4tGdJ+sjRaPynW7KYopAqwZPo+xCukopcSHQBg9txftf10/Ag=
DomainKey-Signature a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=jvqn+kHXHART0Jkg7tYL+spq0AkH558NTUEVmlU/7sEu2f+SWti14X9HFotc5CJgxT2V2b6HHKS/FeQjzf1Mga/UPt15tCIkylXkfV6XFePHmkL0WdJ8C4NxzIoEjuFyIMDj68zkEf+o4IdxLQv08QBPosyJjlnQXqQ/yJkYPqY=;
X-YMail-OSG UDvGqEwVM1lObUcQSnvyFLpHpR0ym1glzJJVW34wVBhhxpO ECf8lWo5mp_eptvqmvuks3HgiU70xKapFMCBozHchhod5WZiPMxEDVM0SN1H NvrhGVFI3oB7pAU4rn5Q_LEVSNg3teoLPY99xDDAkmiJf7lpbKn43Fe3QDb_ KAWUK06FNbX6JXRiSHyUT6rmNeQTPHEJphqcIobW_FfAhrvDSSLaFlWkYXzq MeapebK3OYauEYT3PhuhUKkSMQc3WAR5x773xf5PrxfBFbfXlCY.1CD_BL1J 9yHECa1a.dbAeCqkzGCWSb6me3h0hTG3lIBB5tKjJrfmirEGiW0vOognt1vj bJdouvA6p12U.MfX40DBUwgAx8VXcRA18Klw8KoqRMnhMCgc5O7pFFxAmT3n V.sOcyyDW6ML5_8XV9r7o56nzy8._TdUQ8aUir55cMrk4StunKbD9Eo9sjui My09yQerKQGVXnafN27iZXs264Fekz.JYuFyAlEjfdckmDE2a8NjmD1g-
X-Mailer YahooMailWebService/0.8.115.331698
References <4F1421C3.6060806@simplistix.co.uk>
Date Mon, 16 Jan 2012 15:08:25 +0000 (GMT)
From Vinay Sajip <vinay_sajip@yahoo.co.uk>
Subject Re: python loggingL filter limitation, looks intentional?
To Chris Withers <chris@simplistix.co.uk>
In-Reply-To <4F1421C3.6060806@simplistix.co.uk>
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-1
Content-Transfer-Encoding quoted-printable
Cc Python List <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To Vinay Sajip <vinay_sajip@yahoo.co.uk>
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.4794.1326726512.27778.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326726512 news.xs4all.nl 6955 [2001:888:2000:d::a6]:44993
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19040

Show key headers only | View raw


Hi Chris,

Filtering is intended to be for cases where integer level-based filtering is insufficient; hence it applies to individual loggers and handlers, just as the integer levels do.  You are right that you would need to add a filter to all of the loggers where you want it to apply, or to all of the handlers where you want it to apply. However, if you find your usage pattern occurring very commonly in your applications, it's easy enough to create a DelegatingHandler handler class which passes its events on to any number of handlers you like. You can then apply the filter you want to an instance of this handler, which you attach to your root logger.
Regards,


Vinay Sajip


----- Original Message -----
> From: Chris Withers <chris@simplistix.co.uk>
> To: Vinay Sajip <vinay_sajip@yahoo.co.uk>
> Cc: Python List <python-list@python.org>
> Sent: Monday, 16 January 2012, 13:10
> Subject: python loggingL filter limitation, looks intentional?
> 
> Hi Vinay,
> 
> It looks like this was intentional, so why was it decided that filters would 
> only be passed messages logged to the logger they're attached to rather than 
> the all messages that end up getting passed to logger?
> 
> For example, an app and the libraries it uses log to 'some.db.driver', 
> 'some.lib' and 'myapp'.
> 
> The root logger has a number of handlers attached to it.
> 
> I want to write a filter that adjusts, up or down, the level of certain messages 
> logged based on a regex match of their message.
> 
> If I understand correctly, I have to add my filter to all of the loggers above, 
> rather than just the root logger where my handlers live?
> 
> Or, alternatively, add the filter to all of the root handlers, thereby making 
> the configuration of those handlers and/or more dependent on each other.
> 
> Why is that?
> 
> cheers,
> 
> Chris
> 
> -- Simplistix - Content Management, Batch Processing & Python Consulting
>             - http://www.simplistix.co.uk
> 

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


Thread

Re: python loggingL filter limitation, looks intentional? Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-01-16 15:08 +0000

csiph-web