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


Groups > comp.lang.python > #19953

Re: PythonWin debugger holds onto global logging objects too long

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <prvs=377d4667d=jeanmichel@sequans.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'debug': 0.03; 'handler': 0.04; 'interpreter': 0.05; 'library,': 0.05; 'run,': 0.07; 'python': 0.08; 'scripts': 0.09; 'any.': 0.09; 'demonstrates': 0.09; 'handlers': 0.09; 'relevant.': 0.09; 'spawn': 0.09; 'anyway': 0.09; 'debugger,': 0.16; 'guessing': 0.16; 'module).': 0.16; 'pythonwin': 0.16; 'richardson': 0.16; 'sajip': 0.16; 'subject:global': 0.16; 'subject:logging': 0.16; 'vinay': 0.16; 'looked': 0.16; 'wrote:': 0.18; 'jan': 0.19; 'possibly': 0.19; 'header:In-Reply-To:1': 0.22; 'static': 0.24; 'times,': 0.24; '(like': 0.26; "i'm": 0.28; 'script': 0.28; '24,': 0.29; 'script.': 0.29; 'problem': 0.29; 'seem': 0.29; 'pm,': 0.29; 'ran': 0.30; "didn't": 0.30; 'does': 0.32; 'objects': 0.32; 'list': 0.32; "can't": 0.33; 'header:User-Agent:1': 0.33; 'it.': 0.33; 'message.': 0.33; 'file': 0.34; 'anything': 0.34; 'running': 0.34; 'here,': 0.35; 'probably': 0.35; 'to:addr:python-list': 0.35; 'google': 0.35; 'post': 0.36; 'run': 0.37; 'but': 0.37; 'could': 0.38; 'difficult': 0.39; 'to:addr:python.org': 0.40; "you'll": 0.61; 'more': 0.61; 'simple': 0.61; 'your': 0.61; 'talking': 0.62; 'our': 0.63; 'show': 0.66; 'subject:long': 0.93
X-IronPort-AV E=Sophos;i="4.73,376,1325458800"; d="scan'208";a="138080"
X-Virus-Scanned amavisd-new at zimbra.sequans.com
Date Tue, 07 Feb 2012 11:48:04 +0100
From Jean-Michel Pichavant <jeanmichel@sequans.com>
User-Agent Mozilla-Thunderbird 2.0.0.24 (X11/20100328)
MIME-Version 1.0
To python-list@python.org
Subject Re: PythonWin debugger holds onto global logging objects too long
References <mailman.5026.1327416731.27778.python-list@python.org> <86ba1ef0-fe15-4404-a11e-8d762ca8b600@e27g2000vbu.googlegroups.com>
In-Reply-To <86ba1ef0-fe15-4404-a11e-8d762ca8b600@e27g2000vbu.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
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.5496.1328611757.27778.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328611757 news.xs4all.nl 6846 [2001:888:2000:d::a6]:43351
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19953

Show key headers only | View raw


Vinay Sajip wrote:
> On Jan 24, 2:52 pm, Rob Richardson <RDRichard...@rad-con.com> wrote:
>   
>> I use PythonWin to debug the Python scripts we write.  Our scripts often use the log2pyloggingpackage.  When running the scripts inside the debugger, we seem to get oneloggingobject for every time we run the script.  The result is that after running the script five times, the log file contains five copies of every message.  The only way I know to clean this up and get only a single copy of each message is to close PythonWin and restart it.
>>
>> What do I have to do in my scripts to clean up theloggingobjects so that I never get more than one copy of each message in my log files?
>>
>>     
>
> I don't know what log2py is - Google didn't show up anything that
> looked relevant. If you're talking about the logging package in the
> Python standard library, I may be able to help: but a simple script
> that I ran in PythonWin didn't show any problems, so you'll probably
> need to post a short script which demonstrates the problem when run in
> PythonWin.
>
> Regards,
>
> Vinay Sajip
>   
Same here, can't find anything about log2py.
Anyway it's possible that your pythonwin does not spawn a clean python 
interpreter for every run, keeping the same one.

So you could possibly keep adding log handlers to your loggers because 
they may be static objects (like for the standard logging module).
One solution would be to empty your logger handler list before adding any.

I'm just guessing though, difficult to know without any info on log2py.

JM

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


Thread

PythonWin debugger holds onto global logging objects too long Rob Richardson <RDRichardson@rad-con.com> - 2012-01-24 14:52 +0000
  Re: PythonWin debugger holds onto global logging objects too long Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-02-04 09:09 -0800
    Re: PythonWin debugger holds onto global logging objects too long Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-02-07 11:48 +0100
    Re: PythonWin debugger holds onto global logging objects too long Mark Hammond <skippy.hammond@gmail.com> - 2012-02-08 10:04 +1100

csiph-web