[PyQt] logger outputs duplicate messages in the console window
Phil Thompson
phil at riverbankcomputing.co.uk
Wed Dec 19 18:08:12 GMT 2007
On Tuesday 18 December 2007, DDGG wrote:
> Hello friends!
> I found my logger outputs duplicate messages in the console window, i
> found it looks like is the uic module causes.
>
> # test.py
>
> import sys
> import logging
> from PyQt4 import QtGui, uic
>
> app = QtGui.QApplication(sys.argv)
>
> logger = logging.getLogger("begginer")
> handler = logging.StreamHandler()
> logger.addHandler(handler)
> logger.setLevel(logging.DEBUG)
>
> window = QtGui.QWidget()
> uifile = "window.ui"
> uic.loadUi(uifile, window)
>
> logger.debug("hello")
>
> window.show()
> app.exec_()
>
> # end of test.py
>
> The window.ui file can be very simple, just like this:
> <ui version="4.0" >
> <class>Form</class>
> <widget class="QWidget" name="Form" >
> </widget>
> <resources/>
> <connections/>
> </ui>
>
> When it runs, console window outputs:
> hello
> DEBUG:begginer:hello
>
> How to avoid the 2nd debug message?
This will be fixed in tonight's snapshot.
Thanks,
Phil
More information about the PyQt
mailing list