summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Opdenacker <michael.opdenacker@bootlin.com>2023-01-27 19:28:24 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-02-04 17:03:15 +0000
commitde41e1737b6014f651ad8beb08519b3ccbcc34d1 (patch)
treec8aa998e3ce9779998aa537f9ba75cce5130cd1f /bitbake
parent940cee8422eb7a002faaddbbab0b93d414ee413b (diff)
downloadpoky-de41e1737b6014f651ad8beb08519b3ccbcc34d1.tar.gz
bitbake: bitbake-user-manual: show how use BB_LOGCONFIG to log warnings
(Bitbake rev: 22be2dbd8e70322239f70e53ace2a552425e3665) Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Suggested-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst45
1 files changed, 41 insertions, 4 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst
index f6ebf7ba6a..4fa3ca4b54 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.rst
@@ -656,7 +656,7 @@ builds are when execute, bitbake also supports user defined
656configuration of the `Python 656configuration of the `Python
657logging <https://docs.python.org/3/library/logging.html>`__ facilities 657logging <https://docs.python.org/3/library/logging.html>`__ facilities
658through the :term:`BB_LOGCONFIG` variable. This 658through the :term:`BB_LOGCONFIG` variable. This
659variable defines a json or yaml `logging 659variable defines a JSON or YAML `logging
660configuration <https://docs.python.org/3/library/logging.config.html>`__ 660configuration <https://docs.python.org/3/library/logging.config.html>`__
661that will be intelligently merged into the default configuration. The 661that will be intelligently merged into the default configuration. The
662logging configuration is merged using the following rules: 662logging configuration is merged using the following rules:
@@ -690,9 +690,9 @@ logging configuration is merged using the following rules:
690 adds a filter called ``BitBake.defaultFilter``, both filters will be 690 adds a filter called ``BitBake.defaultFilter``, both filters will be
691 applied to the logger 691 applied to the logger
692 692
693As an example, consider the following user logging configuration file 693As a first example, you can create a ``hashequiv.json`` user logging
694which logs all Hash Equivalence related messages of VERBOSE or higher to 694configuration file to log all Hash Equivalence related messages of ``VERBOSE``
695a file called ``hashequiv.log`` :: 695or higher priority to a file called ``hashequiv.log``::
696 696
697 { 697 {
698 "version": 1, 698 "version": 1,
@@ -721,3 +721,40 @@ a file called ``hashequiv.log`` ::
721 } 721 }
722 } 722 }
723 } 723 }
724
725Then set the :term:`BB_LOGCONFIG` variable in ``conf/local.conf``::
726
727 BB_LOGCONFIG = "hashequiv.json"
728
729Another example is this ``warn.json`` file to log all ``WARNING`` and
730higher priority messages to a ``warn.log`` file::
731
732 {
733 "version": 1,
734 "formatters": {
735 "warnlogFormatter": {
736 "()": "bb.msg.BBLogFormatter",
737 "format": "%(levelname)s: %(message)s"
738 }
739 },
740
741 "handlers": {
742 "warnlog": {
743 "class": "logging.FileHandler",
744 "formatter": "warnlogFormatter",
745 "level": "WARNING",
746 "filename": "warn.log"
747 }
748 },
749
750 "loggers": {
751 "BitBake": {
752 "handlers": ["warnlog"]
753 }
754 },
755
756 "@disable_existing_loggers": false
757 }
758
759Note that BitBake's helper classes for structured logging are implemented in
760``lib/bb/msg.py``.