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


Groups > comp.lang.python > #19344 > unrolled thread

PythonWin debugger holds onto global logging objects too long

Started byRob Richardson <RDRichardson@rad-con.com>
First post2012-01-24 14:52 +0000
Last post2012-02-08 10:04 +1100
Articles 4 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  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

#19344 — PythonWin debugger holds onto global logging objects too long

FromRob Richardson <RDRichardson@rad-con.com>
Date2012-01-24 14:52 +0000
SubjectPythonWin debugger holds onto global logging objects too long
Message-ID<mailman.5026.1327416731.27778.python-list@python.org>
I use PythonWin to debug the Python scripts we write.  Our scripts often use the log2py logging package.  When running the scripts inside the debugger, we seem to get one logging object 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 the logging objects so that I never get more than one copy of each message in my log files?

Thank you very much!

Rob Richardson

[toc] | [next] | [standalone]


#19925

FromVinay Sajip <vinay_sajip@yahoo.co.uk>
Date2012-02-04 09:09 -0800
Message-ID<86ba1ef0-fe15-4404-a11e-8d762ca8b600@e27g2000vbu.googlegroups.com>
In reply to#19344
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

[toc] | [prev] | [next] | [standalone]


#19953

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2012-02-07 11:48 +0100
Message-ID<mailman.5496.1328611757.27778.python-list@python.org>
In reply to#19925
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

[toc] | [prev] | [next] | [standalone]


#19992

FromMark Hammond <skippy.hammond@gmail.com>
Date2012-02-08 10:04 +1100
Message-ID<mailman.5523.1328655882.27778.python-list@python.org>
In reply to#19925
On 7/02/2012 9:48 PM, Jean-Michel Pichavant wrote:
> 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.

That is what everyone's pythonwin does :)  It always works "in process" 
- not ideal, but also likely to not change.

Cheers,

Mark

>
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web