diff options
author | Michael Opdenacker <michael.opdenacker@bootlin.com> | 2023-01-27 19:28:24 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-04 17:03:15 +0000 |
commit | de41e1737b6014f651ad8beb08519b3ccbcc34d1 (patch) | |
tree | c8aa998e3ce9779998aa537f9ba75cce5130cd1f /bitbake | |
parent | 940cee8422eb7a002faaddbbab0b93d414ee413b (diff) | |
download | poky-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.rst | 45 |
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 | |||
656 | configuration of the `Python | 656 | configuration of the `Python |
657 | logging <https://docs.python.org/3/library/logging.html>`__ facilities | 657 | logging <https://docs.python.org/3/library/logging.html>`__ facilities |
658 | through the :term:`BB_LOGCONFIG` variable. This | 658 | through the :term:`BB_LOGCONFIG` variable. This |
659 | variable defines a json or yaml `logging | 659 | variable defines a JSON or YAML `logging |
660 | configuration <https://docs.python.org/3/library/logging.config.html>`__ | 660 | configuration <https://docs.python.org/3/library/logging.config.html>`__ |
661 | that will be intelligently merged into the default configuration. The | 661 | that will be intelligently merged into the default configuration. The |
662 | logging configuration is merged using the following rules: | 662 | logging 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 | ||
693 | As an example, consider the following user logging configuration file | 693 | As a first example, you can create a ``hashequiv.json`` user logging |
694 | which logs all Hash Equivalence related messages of VERBOSE or higher to | 694 | configuration file to log all Hash Equivalence related messages of ``VERBOSE`` |
695 | a file called ``hashequiv.log`` :: | 695 | or 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 | |||
725 | Then set the :term:`BB_LOGCONFIG` variable in ``conf/local.conf``:: | ||
726 | |||
727 | BB_LOGCONFIG = "hashequiv.json" | ||
728 | |||
729 | Another example is this ``warn.json`` file to log all ``WARNING`` and | ||
730 | higher 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 | |||
759 | Note that BitBake's helper classes for structured logging are implemented in | ||
760 | ``lib/bb/msg.py``. | ||