samba-gpupdate -d3 should print log messages issued with log.info(). However this doesn't work. I have the following patch: diff --git a/python/samba/gp/util/logging.py b/python/samba/gp/util/logging.py index 9e70891b62c..1bc7f9bd9e2 100644 --- a/python/samba/gp/util/logging.py +++ b/python/samba/gp/util/logging.py @@ -26,6 +26,7 @@ import sys logger = logging.getLogger() def logger_init(name, log_level): logger = logging.getLogger(name) + print("XXXXXX log_level=", log_level) logger.addHandler(logging.StreamHandler(sys.stdout)) logger.setLevel(logging.CRITICAL) if log_level == 1: @@ -33,6 +34,7 @@ def logger_init(name, log_level): elif log_level == 2: logger.setLevel(logging.WARNING) elif log_level == 3: + print("XXXXXX setting log level to logging.INFO") logger.setLevel(logging.INFO) elif log_level >= 4: logger.setLevel(logging.DEBUG) @@ -69,6 +71,8 @@ class log(object): if data is None: data = {} msg = message_with_code('I', message) + print("XXXXXX effective log level: ", logger.getEffectiveLevel()) + logger.info("XXXXXX What a wurst!") logger.info(slogm(msg, data)) return msg When running gpupdate I can see XXXXXX log_level= 3 XXXXXX setting log level to logging.INFO XXXXXX effective log level: 30 However I don't get the line with "What a wurst!". I have no idea what's wrong here.
I think one issue is, that there are two logging instances, in line 26 and 28.
A possible fix would be: python/samba/gp/util/logging.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/samba/gp/util/logging.py b/python/samba/gp/util/logging.py index 9e70891b62c..da085d8d7e6 100644 --- a/python/samba/gp/util/logging.py +++ b/python/samba/gp/util/logging.py @@ -23,9 +23,10 @@ import gettext import random import sys -logger = logging.getLogger() +logger = logging.getLogger("gp") + + def logger_init(name, log_level): - logger = logging.getLogger(name) logger.addHandler(logging.StreamHandler(sys.stdout)) logger.setLevel(logging.CRITICAL) if log_level == 1: The better solution would be if the log class has an init function and the logger is stored in the class ...
This bug was referenced in samba master: 145194071b10c4c1857f28fe79c57fd63ffab889
Created attachment 18238 [details] patch for 4.19 and 4.20
Jule, please apply the patch to 4.19 and 4.20. Thanks!
Pushed to autobuild-v4-{20,19}-test.
This bug was referenced in samba v4-19-test: 60514eb68362ff883b7406fe03515d1439fb12a2
This bug was referenced in samba v4-20-test: 9e946a8ddd37ac8286c08293d1509260520f252e
Closing out bug report. Thanks!
This bug was referenced in samba v4-20-stable (Release samba-4.20.0rc2): 9e946a8ddd37ac8286c08293d1509260520f252e
This bug was referenced in samba v4-19-stable (Release samba-4.19.5): 60514eb68362ff883b7406fe03515d1439fb12a2