Opened 12 years ago

Closed 12 years ago

#194 closed defect (fixed)

using tub.setOption("bridge-twisted-logs") multiple times causes duplicate messages

Reported by: Brian Warner Owned by:
Priority: major Milestone: 0.6.4
Component: logging Version: 0.6.1
Keywords: Cc:

Description

The tahoe unit tests exercise node-creation a lot (35 times in test_system), and node-creation calls tub.setOption("bridge-twisted-logs", True), which calls foolscap.logging.log.bridgeLogsFromTwisted(), which does twisted.python.log.addObserver each time. By the end of the run, there are 35 duplicate observers, and every twisted log message gets duplicated 35 times.

I don't think this is breaking anything, but it's certainly annoying.

Attachments (1)

no-duplog.diff (917 bytes) - added by Brian Warner 12 years ago.
incomplete patch (tests fail)

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by Brian Warner

Attachment: no-duplog.diff added

incomplete patch (tests fail)

comment:1 Changed 12 years ago by Brian Warner

That patch fails a few tests in test_logging, because the tests expect to be able to replace the observer. A better patch might be to keep track of the observer that was added, and remove it again when bridgeLogsFromTwisted is called a second time.

comment:2 Changed 12 years ago by Brian Warner

Resolution: fixed
Status: newclosed

Fixed in a better way in [faaa73b].

Note: See TracTickets for help on using tickets.