Skip to content

Commit 558d1cb

Browse files
committed
Fixed bug in which logging outputs from dummy lockers were duplicated.
The issue was that the same name was given for the logger for both the DummyLocker and DummyScanZoomLocker, which meant that they actually shared one logger. This led to dupplicated outputs, probably due to multiple handlers being added to the same logger.
1 parent 9736303 commit 558d1cb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

blacs/plugins/lock_monitor/dummy_lockers.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ def lock(self):
102102

103103
# Create a dummy locker that doesn't actually control anything, which can be
104104
# used for testing purposes. First create a logger for it. See the readme for
105-
# some discussion on how to set up a logger.
106-
_dummy_logger = logging.getLogger(__name__)
105+
# some discussion on how to set up a logger. This logger has '_dummy_locker'
106+
# appended to its name to distinguish it from the logger for the
107+
# DummyScanZoomLocker created below.
108+
_dummy_logger = logging.getLogger(__name__ + '_dummy_locker')
107109
_dummy_logger.setLevel(logging.DEBUG)
108110
_formatter = logging.Formatter(
109111
'%(asctime)s:%(filename)s:%(funcName)s:%(lineno)d:%(levelname)s: %(message)s'
@@ -375,8 +377,10 @@ def check_lock(self):
375377

376378
# Create a dummy locker that doesn't actually control anything, which can be
377379
# used for testing purposes. First create a logger for it. See the readme for
378-
# some discussion on how to set up a logger.
379-
_dummy_logger = logging.getLogger(__name__)
380+
# some discussion on how to set up a logger. This logger has
381+
# '_dummy_scan_zoom_locker' appended to its name to distinguish it from the
382+
# logger for the DummyLocker created above.
383+
_dummy_logger = logging.getLogger(__name__ + '_dummy_scan_zoom_locker')
380384
_dummy_logger.setLevel(logging.DEBUG)
381385
_formatter = logging.Formatter(
382386
'%(asctime)s:%(filename)s:%(funcName)s:%(lineno)d:%(levelname)s: %(message)s'

0 commit comments

Comments
 (0)