Module: check_mk
Branch: master
Commit: fd5d10166af845feb657159974d1b8a67e03cf65
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fd5d10166af845…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 9 19:33:53 2018 +0200
6777 FIX Background job logs were not always shown in job output
In some situations log entries which should be written to the job output,
which is visible from the GUI, was not written to it.
Background: The default logger was based on cmk.log logger which is not
initialized with the GUI log level. The job logger is now based on cmk.gui.log
logger as intended which makes the job log entries now available in the job
progress dialog by default.
Change-Id: I92e65bb7a2ab467fd567c7456c4fbe2761bbfc66
---
.werks/6777 | 17 +++++++++++++++++
cmk/gui/background_job.py | 5 +++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/.werks/6777 b/.werks/6777
new file mode 100644
index 0000000..27e239a
--- /dev/null
+++ b/.werks/6777
@@ -0,0 +1,17 @@
+Title: Background job logs were not always shown in job output
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1539106361
+
+In some situations log entries which should be written to the job output,
+which is visible from the GUI, was not written to it.
+
+Background: The default logger was based on cmk.log logger which is not
+initialized with the GUI log level. The job logger is now based on cmk.gui.log
+logger as intended which makes the job log entries now available in the job
+progress dialog by default.
diff --git a/cmk/gui/background_job.py b/cmk/gui/background_job.py
index b0d0f0c..3995335 100644
--- a/cmk/gui/background_job.py
+++ b/cmk/gui/background_job.py
@@ -46,6 +46,7 @@ import cmk.daemon as daemon
import cmk.store as store
from cmk.exceptions import MKGeneralException
+import log
class BackgroundJobAlreadyRunning(MKGeneralException):
pass
@@ -217,7 +218,7 @@ class BackgroundProcess(multiprocessing.Process):
def initialize_environment(self):
if not self._logger:
- self._logger = cmk.log.logger
+ self._logger = log.logger
self._open_stdout_and_stderr()
self._enable_logging_to_stdout()
@@ -295,7 +296,7 @@ class BackgroundProcess(multiprocessing.Process):
in stdout (which results in job progress info)"""
handler = logging.StreamHandler(stream=sys.stdout)
handler.setFormatter(cmk.log.get_formatter())
- cmk.log.logger.addHandler(handler)
+ log.logger.addHandler(handler)