Browse Source

Enable setting LogLevels

bernhardbuhl 3 years ago
parent
commit
282d3a378d

+ 2 - 2
baangt/base/TestRun/TestRun.py

@@ -308,8 +308,8 @@ class TestRun:
                     # This could be the "old" way of the globals-file (with {"HEADLESS":"True"})
                     self.globalSettings[key] = value
 
-        if self.globalSettings.get("TC.LogLevel"):
-            utils.setLogLevel(self.globalSettings.get("TC.LogLevel"))
+        if self.globalSettings.get("TC." + GC.EXECUTION_LOGLEVEL):
+            utils.setLogLevel(self.globalSettings.get("TC." + GC.EXECUTION_LOGLEVEL))
 
     def _loadJSONTestRunDefinitions(self):
         if not self.testRunFileName and not self.testRunDict:  # -- API support: testRunDict --

+ 5 - 1
baangt/base/Utils.py

@@ -92,7 +92,11 @@ class utils:
     @staticmethod
     def setLogLevel(level):
         logger.info(f"Changing Loglevel from {logger.level} to {level}")
-        logger.setLevel(level=level)
+
+        for logHandler in logger.handlers:
+            logHandler.setLevel(level=level.upper())
+
+        logger.setLevel(level=level.upper())
 
     @staticmethod
     def listToString(completeList):

+ 4 - 0
docs/ParametersConfigFile.rst

@@ -68,4 +68,8 @@ for instance to slowly retest a single testrecord or to not close the browser af
        object of a testrun (TestCaseSequence, TestCase, TestStepSequence, TestStep). Here you also have the
        change/define other classes (e.g. BrowserDriver, Timing, etc.), which you subclassed and enhanced for your
        local installation.
+   * - ``TC.LogLevel``
+     - Set the LogLevel to a different value. In baangt standard the file-logger is set to ``debug`` while the console
+       output is set to ``info``. Using this setting you'll set both logger channels to whatever value you provide.
+       In the new UI you'll see a dropdown menu.
 

+ 1 - 1
examples/globalsFullExample.json

@@ -18,5 +18,5 @@
     "CL.testCaseSequenceMaster": "baangt.TestCaseSequenceMaster.TestCaseSequenceMaster",
     "TC.TestStepClass": "",
     "TC.TestDataFileName": "",
-    "TC.ExecutionLogLevel": "Info"
+    "TC.LogLevel": "Info"
 }

+ 1 - 1
globalSetting.json

@@ -129,7 +129,7 @@
             "default": "",
             "displayText": "Datafile"
         },
-        "TC.ExecutionLogLevel": {
+        "TC.LogLevel": {
             "hint": "Set the level of logging. Standard = 'debug'. For production you might want to change to another value",
             "type": "select",
             "default": "Debug",