Logger prints multiple times
See original GitHub issueHi,
I have a bit of strange issue. When I run my application the logger prints lines multiple times. For instance after while when I close my application:
/dev/tty.usbserial-1420 port closed
/dev/tty.usbserial-1420 port closed
/dev/tty.usbserial-1420 port closed
/dev/tty.usbserial-1420 port closed
/dev/tty.usbserial-1420 port closed
/dev/tty.usbserial-1420 port closed
/dev/tty.usbserial-1420 port closed
/dev/tty.usbserial-1420 port closed
/dev/tty.usbserial-1420 port closed
Even the last message I received was printed 7 times. As my program runs longer this number increases.
I checked, by adding some debug printing in the library, and the printed message is actually logged once but printed multiple times. And my program isn’t leaking any memory or something. So everything does look fine.
I have been searching on it a little bit and the internet is full of the same questions regarding python logger. Like (stackoverflow):
So every time you instantiate your class you add new handlers to the logger and every handler prints a line.
Any idea how to solve this? Do you think this issue be related to having multiple logger handlers?
Thanks, Fokko
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
I just found this issue too. It turns out that it was already fixed in master at dad8aae0d744ae094e36f6f1987b0bf301d753b4 before you even asked your question. It hasn’t been published as a new release though, so you will have to install from source, instead of using pip.
Fix to this issue at c922ab1051aa6042ebde510f1564504fd14a3012 is already included in release 1.3.0.