Merge lp:~rharding/charms/precise/juju-gui/fix-log-test into lp:~juju-gui/charms/precise/juju-gui/trunk
Proposed by
Richard Harding
Status: | Merged |
---|---|
Merged at revision: | 146 |
Proposed branch: | lp:~rharding/charms/precise/juju-gui/fix-log-test |
Merge into: | lp:~juju-gui/charms/precise/juju-gui/trunk |
Diff against target: |
19 lines (+9/-0) 1 file modified
hooks/utils.py (+9/-0) |
To merge this branch: | bzr merge lp:~rharding/charms/precise/juju-gui/fix-log-test |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
charmers | Pending | ||
Review via email:
|
Description of the change
Remove existing Log handers when setupLogging.
- If there are existing handlers on the root logger then the
logging.basicConfig is a noop. Changes we expect to see will not occur.
To post a comment you must log in.
Reviewers: mp+201453_ code.launchpad. net,
Message:
Please take a look.
Description:
Remove existing Log handers when setupLogging.
- If there are existing handlers on the root logger then the
logging.basicConfig is a noop. Changes we expect to see will not occur.
https:/ /code.launchpad .net/~rharding/ charms/ precise/ juju-gui/ fix-log- test/+merge/ 201453
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/51280047/
Affected files (+11, -0 lines):
A [revision details]
M hooks/utils.py
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision: <email address hidden>
Index: hooks/utils.py handlers: handlers: removeHandler( handler) basicConfig(
filename= config[ 'command- log-file' ],
=== modified file 'hooks/utils.py'
--- hooks/utils.py 2013-11-15 14:56:04 +0000
+++ hooks/utils.py 2014-01-13 16:39:51 +0000
@@ -319,6 +319,15 @@
global results_log
if results_log is not None:
return
+
+ # Make sure that the root logger isn't configured already. If it does,
+ # this basicConfig will be a noop and not setup the expected file
handler
+ # on the logger.
+ root_logger = logging.getLogger()
+ if root_logger.
+ for handler in root_logger.
+ root_logger.
+
config = get_config()
logging.