Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17153
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <andrea.crotti.0@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'suppose': 0.05; '"""': 0.07; 'filters.': 0.07; '%s"': 0.09; 'output': 0.10; 'def': 0.13; '"""set': 0.16; 'logger.': 0.16; 'out?': 0.16; 'subject:issues': 0.16; 'subject:logging': 0.16; 'cc:addr:python-list': 0.16; 'received:74.125.82.44': 0.16; 'received:mail-ww0-f44.google.com': 0.16; 'seems': 0.20; 'cc:no real name:2**0': 0.20; 'maybe': 0.21; 'input': 0.22; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.24; "i'm": 0.26; 'script': 0.28; 'expressions': 0.29; 'order.': 0.29; 'cc:addr:python.org': 0.29; 'second': 0.29; 'skip:% 10': 0.30; 'skip:l 30': 0.32; 'list': 0.32; 'message-id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'filter': 0.34; 'received:74.125.82': 0.35; 'supposed': 0.35; 'regular': 0.35; 'file': 0.36; 'but': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'another': 0.37; 'received:10.0.0': 0.38; 'couple': 0.38; 'getting': 0.38; 'called': 0.40; 'below': 0.63 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=f7rvPXV8AFI/vlkYJLN38Qkq0PdJDwNkQnspraWc5nI=; b=NS+3tBGHPAw6byQI1piLGfAGsr7b9gqXpDiC2Cvyx9sCQin5VlmoOwb3jCaS/VWaG7 +NjzkLYbIMWD9HMGC/wYTNM2YtH9UaOau2kEnfZuVIkI6BW5Vbbj6Y2YjqyByV1tTsyV s5qXsAv8ZmX7J/E6G65dFh2+E1ceTcWL7bfP0= |
| Date | Tue, 13 Dec 2011 17:03:01 +0000 |
| From | Andrea Crotti <andrea.crotti.0@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111108 Thunderbird/8.0 |
| MIME-Version | 1.0 |
| To | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| Subject | Re: logging issues |
| References | <4EE77279.10104@gmail.com> <4EE77933.2060705@sequans.com> <4EE77B7B.9090408@gmail.com> |
| In-Reply-To | <4EE77B7B.9090408@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Cc | 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.3606.1323795786.27778.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1323795786 news.xs4all.nl 6968 [2001:888:2000:d::a6]:53424 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:17153 |
Show key headers only | View raw
And by the way suppose I have a script which takes as input the log
level and a list of possible filters.
In another file I have a couple of functions as below which are called
in that order.
Is that supposed to work?
In theory I'm getting both times the same logger.
The set_verbosity seems to do its job, the second is also
called and the filters are added but I don't see the output
formatted as it should..
Maybe I can only set it up once?
def set_verbosity(log_level):
"""Set the desired log level
"""
root_logger = logging.getLogger()
root_logger.setLevel(LOG_LEVELS[log_level])
def setup_logging(to_filter):
root_logger = logging.getLogger()
hdlr = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
# a list of regular expressions to filter out?
if to_filter:
for f in to_filter:
logger.debug("adding filter for name %s" % f)
filt = logging.Filter(f)
hdlr.addFilter(filt)
root_logger.addHandler(hdlr)
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: logging issues Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-12-13 17:03 +0000 Re: logging issues Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2011-12-17 12:44 -0800
csiph-web