[oe-commits] [bitbake] 19/22: knotty: Update hash equivalence logging

git at git.openembedded.org git at git.openembedded.org
Thu Mar 12 23:04:49 UTC 2020


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 766587c0baaaeb5cda3e9454395edbb70e33f756
Author: Joshua Watt <jpewhacker at gmail.com>
AuthorDate: Wed Mar 11 18:28:46 2020 -0500

    knotty: Update hash equivalence logging
    
    Updates hash equivalence logging so that the interesting VERBOSE
    messages are always logged to the consolelog file so that issues in
    individual user builds can be diagnosed. The autobuilder logging config
    then updates this so that they also are shown on stdout, since the
    consolelog file is not capture there.
    
    In order to facilitate this, 2 new logging handlers were added,
    "BitBake.verbconsole" and "BitBake.verbconsolelog". Neither of these
    handlers are attached to anything by default, but they will log any
    messages that wouldn't otherwise be logged by the normal console or
    consolelog handlers. Users can attach whatever loggers the desire to
    this handler to get them to appear on the console or in the consolelog,
    as demonstrated by the autobuilderlog.json file.
    
    Signed-off-by: Joshua Watt <JPEWhacker at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 contrib/autobuilderlog.json | 18 ++----------
 lib/bb/ui/knotty.py         | 68 +++++++++++++++++++++++++++++++++++++++------
 2 files changed, 62 insertions(+), 24 deletions(-)

diff --git a/contrib/autobuilderlog.json b/contrib/autobuilderlog.json
index 103a114..193a675 100644
--- a/contrib/autobuilderlog.json
+++ b/contrib/autobuilderlog.json
@@ -1,27 +1,13 @@
 {
     "version": 1,
-    "handlers": {
-        "autobuilderlog": {
-            "class": "logging.FileHandler",
-            "formatter": "logfileFormatter",
-            "level": "DEBUG",
-            "filename": "autobuilder.log",
-            "mode": "w"
-        }
-    },
-    "formatters": {
-            "logfileFormatter": {
-                "format": "%(name)s: %(levelname)s: %(message)s"
-            }
-    },
     "loggers": {
         "BitBake.SigGen.HashEquiv": {
             "level": "VERBOSE",
-            "handlers": ["autobuilderlog"]
+            "handlers": ["BitBake.verbconsole"]
         },
         "BitBake.RunQueue.HashEquiv": {
             "level": "VERBOSE",
-            "handlers": ["autobuilderlog"]
+            "handlers": ["BitBake.verbconsole"]
         }
     }
 }
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 695108a..24b7a77 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -419,6 +419,18 @@ def main(server, eventHandler, params, tf = TerminalFilter):
                 "stream": "ext://sys.stderr",
                 "filters": ["BitBake.stderrFilter"],
             },
+            # This handler can be used if specific loggers should print on
+            # the console at a lower severity than the default. It will
+            # display any messages sent to it that are lower than then
+            # BitBake.console logging level (so as to prevent duplication of
+            # messages). Nothing is attached to this handler by default
+            "BitBake.verbconsole": {
+                "class": "logging.StreamHandler",
+                "formatter": "BitBake.consoleFormatter",
+                "level": 1,
+                "stream": "ext://sys.stdout",
+                "filters": ["BitBake.verbconsoleFilter"],
+            },
         },
         "formatters": {
             # This format instance will get color output enabled by the
@@ -442,7 +454,11 @@ def main(server, eventHandler, params, tf = TerminalFilter):
             "BitBake.stderrFilter": {
                 "()": "bb.msg.LogFilterGEQLevel",
                 "level": "ERROR"
-            }
+            },
+            "BitBake.verbconsoleFilter": {
+                "()": "bb.msg.LogFilterLTLevel",
+                "level": console_loglevel
+            },
         },
         "loggers": {
             "BitBake": {
@@ -455,13 +471,49 @@ def main(server, eventHandler, params, tf = TerminalFilter):
 
     # Enable the console log file if enabled
     if consolelogfile and not params.options.show_environment and not params.options.show_versions:
-        logconfig["handlers"]["BitBake.consolelog"] ={
-            "class": "logging.FileHandler",
-            "formatter": "BitBake.logfileFormatter",
-            "level": "INFO",
-            "filename": consolelogfile,
-        }
-        logconfig["loggers"]["BitBake"]["handlers"].append("BitBake.consolelog")
+        logconfig = bb.msg.mergeLoggingConfig(logconfig, {
+                "version": 1,
+                "handlers" : {
+                    "BitBake.consolelog": {
+                        "class": "logging.FileHandler",
+                        "formatter": "BitBake.logfileFormatter",
+                        "level": loglevel,
+                        "filename": consolelogfile,
+                    },
+                    # Just like verbconsole, anything sent here will go to the
+                    # log file, unless it would go to BitBake.consolelog
+                    "BitBake.verbconsolelog" : {
+                        "class": "logging.FileHandler",
+                        "formatter": "BitBake.logfileFormatter",
+                        "level": 1,
+                        "filename": consolelogfile,
+                        "filters": ["BitBake.verbconsolelogFilter"],
+                    },
+                },
+                "filters": {
+                    "BitBake.verbconsolelogFilter": {
+                        "()": "bb.msg.LogFilterLTLevel",
+                        "level": loglevel,
+                    },
+                },
+                "loggers": {
+                    "BitBake": {
+                        "handlers": ["BitBake.consolelog"],
+                    },
+
+                    # Other interesting things that we want to keep an eye on
+                    # in the log files in case someone has an issue, but not
+                    # necessarily show to the user on the console
+                    "BitBake.SigGen.HashEquiv": {
+                        "level": "VERBOSE",
+                        "handlers": ["BitBake.verbconsolelog"],
+                    },
+                    "BitBake.RunQueue.HashEquiv": {
+                        "level": "VERBOSE",
+                        "handlers": ["BitBake.verbconsolelog"],
+                    }
+                }
+            })
 
         bb.utils.mkdirhier(os.path.dirname(consolelogfile))
         loglink = os.path.join(os.path.dirname(consolelogfile), 'console-latest.log')

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list