Skip to content

Commit

Permalink
keep existing loggers when invoking setup_logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerickel committed Jul 11, 2018
1 parent 411db74 commit fd0302b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
unreleased
==========

- Change ``setup_logging`` to invoke ``logging.config.fileConfig`` with
``disable_existing_loggers=False`` to avoid disabling any loggers that were
imported prior to configuration of the logging system.
See https://github.com/Pylons/plaster_pastedeploy/pull/16

0.5 (2018-03-29)
================

Expand Down
2 changes: 1 addition & 1 deletion src/plaster_pastedeploy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def setup_logging(self, defaults=None):
"""
if 'loggers' in self.get_sections():
defaults = self._get_defaults(defaults)
fileConfig(self.uri.path, defaults)
fileConfig(self.uri.path, defaults, disable_existing_loggers=False)

else:
logging.basicConfig()
Expand Down
6 changes: 6 additions & 0 deletions tests/test_setup_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def test_egg_uri(self):
assert self.basicConfig.args == ()
assert self.basicConfig.kwargs == {}

def test_it_keeps_existing_loggers(self):
loader = self._makeOne()
loader.setup_logging()
assert self.fileConfig.called
assert self.fileConfig.kwargs['disable_existing_loggers'] is False


class DummyFileConfig(object):
called = False
Expand Down

0 comments on commit fd0302b

Please sign in to comment.