Skip to content

Commit d608e44

Browse files
committed
maint: do not alter external logging configuration
1 parent cea3ba9 commit d608e44

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

nipype/utils/logger.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ class Logging(object):
3030

3131
def __init__(self, config):
3232
self._config = config
33-
logging.basicConfig(
34-
format=self.fmt, datefmt=self.datefmt, stream=sys.stdout)
35-
# logging.basicConfig(stream=sys.stdout)
33+
# scope our logger to not interfere with user
34+
_nipype_logger = logging.getLogger('nipype')
35+
_nipype_hdlr = logging.StreamHandler(stream=sys.stdout)
36+
_nipype_hdlr.setFormatter(logging.Formatter(fmt=self.fmt,
37+
datefmt=self.datefmt))
38+
# if StreamHandler was added, do not stack
39+
if not len(_nipype_logger.handlers):
40+
_nipype_logger.addHandler(_nipype_hdlr)
41+
3642
self._logger = logging.getLogger('workflow')
3743
self._utlogger = logging.getLogger('utils')
3844
self._fmlogger = logging.getLogger('filemanip')

0 commit comments

Comments
 (0)