From: Joshua Watt <jpewhacker@gmail.com>
To: bitbake-devel@lists.openembedded.org
Cc: docs@lists.yoctoproject.org
Subject: [PATCH 15/15] bitbake-user-manual: Add documentation for BB_LOGCONFIG
Date: Mon, 9 Mar 2020 11:33:53 -0500 [thread overview]
Message-ID: <20200309163353.15362-16-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20200309163353.15362-1-JPEWhacker@gmail.com>
Adds documentation describing how to use the BB_LOGCONFIG variable to
enable custom logging.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
.../bitbake-user-manual-execution.xml | 97 +++++++++++++++++++
.../bitbake-user-manual-ref-variables.xml | 11 +++
2 files changed, 108 insertions(+)
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml
index 8f606676b4..3b31f748cc 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml
@@ -929,4 +929,101 @@
section.
</para>
</section>
+
+ <section id="logging">
+ <title>Logging</title>
+ <para>
+ In addition to the standard command line option to control how
+ verbose builds are when execute, bitbake also supports user defined
+ configuration of the
+ <ulink url='https://docs.python.org/3/library/logging.html'>Python logging</ulink>
+ facilities through the
+ <link linkend="var-bb-BB_LOGCONFIG"><filename>BB_LOGCONFIG</filename></link>
+ variable. This variable defines a json or yaml
+ <ulink url='https://docs.python.org/3/library/logging.config.html'>logging configuration</ulink>
+ that will be intelligently merged into the default configuration.
+ The logging configuration is merged using the following rules:
+ <itemizedlist>
+ <listitem><para>
+ The user defined configuration will completely replace the default
+ configuration if top level key
+ <filename>bitbake_merge</filename> is set to the value
+ <filename>False</filename>. In this case, all other rules
+ are ignored.
+ </para></listitem>
+ <listitem><para>
+ The user configuration must have a top level
+ <filename>version</filename> which must match the value of
+ the default configuration.
+ </para></listitem>
+ <listitem><para>
+ Any keys defined in the <filename>handlers</filename>,
+ <filename>formatters</filename>, or <filename>filters</filename>,
+ will be merged into the same section in the default
+ configuration, with the user specified keys taking
+ replacing a default one if there is a conflict. In
+ practice, this means that if both the default configuration
+ and user configuration specify a handler named
+ <filename>myhandler</filename>, the user defined one will
+ replace the default. To prevent the user from inadvertently
+ replacing a default handler, formatter, or filter, all of
+ the default ones are named with a prefix of
+ "<filename>BitBake.</filename>"
+ </para></listitem>
+ <listitem><para>
+ If a logger is defined by the user with the key
+ <filename>bitbake_merge</filename> set to
+ <filename>False</filename>, that logger will be completely
+ replaced by user configuration. In this case, no other
+ rules will apply to that logger.
+ </listitem></para>
+ <listitem><para>
+ All user defined <filename>filter</filename> and
+ <filename>handlers</filename> properties for a given logger
+ will be merged with corresponding properties from the
+ default logger. For example, if the user configuration adds
+ a filter called <filename>myFilter</filename> to the
+ <filename>BitBake.SigGen</filename>, and the default
+ configuration adds a filter called
+ <filename>BitBake.defaultFilter</filename>, both filters
+ will be applied to the logger
+ </listitem></para>
+ </itemizedlist>
+ </para>
+
+ <para>
+ As an example, consider the following user logging configuration
+ file which logs all Hash Equivalence related messages of VERBOSE or
+ higher to a file called <filename>hashequiv.log</filename>
+ <literallayout class='monospaced'>
+ {
+ "version": 1,
+ "handlers": {
+ "autobuilderlog": {
+ "class": "logging.FileHandler",
+ "formatter": "logfileFormatter",
+ "level": "DEBUG",
+ "filename": "hashequiv.log",
+ "mode": "w"
+ }
+ },
+ "formatters": {
+ "logfileFormatter": {
+ "format": "%(name)s: %(levelname)s: %(message)s"
+ }
+ },
+ "loggers": {
+ "BitBake.SigGen.HashEquiv": {
+ "level": "VERBOSE",
+ "handlers": ["autobuilderlog"]
+ },
+ "BitBake.RunQueue.HashEquiv": {
+ "level": "VERBOSE",
+ "handlers": ["autobuilderlog"]
+ }
+ }
+ }
+ </literallayout>
+ </para>
+ </section>
</chapter>
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
index bae01d90c0..c4bd1f2584 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
@@ -539,6 +539,17 @@
</glossdef>
</glossentry>
+ <glossentry id='var-bb-BB_LOGCONFIG'><glossterm>BB_LOGCONFIG</glossterm>
+ <glossdef>
+ <para>
+ Specifies the name of a config file that contains the user
+ logging configuration. See
+ <link linkend="logging">Logging</link> for additional
+ information
+ </para>
+ </glossdef>
+ </glossentry>
+
<glossentry id='var-bb-BB_LOGFMT'><glossterm>BB_LOGFMT</glossterm>
<glossdef>
<para>
--
2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: "Joshua Watt" <JPEWhacker@gmail.com>
To: bitbake-devel@lists.openembedded.org
Cc: docs@lists.yoctoproject.org, Joshua Watt <JPEWhacker@gmail.com>
Subject: [bitbake-devel][PATCH 15/15] bitbake-user-manual: Add documentation for BB_LOGCONFIG
Date: Mon, 9 Mar 2020 11:33:53 -0500 [thread overview]
Message-ID: <20200309163353.15362-16-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20200309163353.15362-1-JPEWhacker@gmail.com>
Adds documentation describing how to use the BB_LOGCONFIG variable to
enable custom logging.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
.../bitbake-user-manual-execution.xml | 97 +++++++++++++++++++
.../bitbake-user-manual-ref-variables.xml | 11 +++
2 files changed, 108 insertions(+)
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml
index 8f606676b4..3b31f748cc 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-execution.xml
@@ -929,4 +929,101 @@
section.
</para>
</section>
+
+ <section id="logging">
+ <title>Logging</title>
+ <para>
+ In addition to the standard command line option to control how
+ verbose builds are when execute, bitbake also supports user defined
+ configuration of the
+ <ulink url='https://docs.python.org/3/library/logging.html'>Python logging</ulink>
+ facilities through the
+ <link linkend="var-bb-BB_LOGCONFIG"><filename>BB_LOGCONFIG</filename></link>
+ variable. This variable defines a json or yaml
+ <ulink url='https://docs.python.org/3/library/logging.config.html'>logging configuration</ulink>
+ that will be intelligently merged into the default configuration.
+ The logging configuration is merged using the following rules:
+ <itemizedlist>
+ <listitem><para>
+ The user defined configuration will completely replace the default
+ configuration if top level key
+ <filename>bitbake_merge</filename> is set to the value
+ <filename>False</filename>. In this case, all other rules
+ are ignored.
+ </para></listitem>
+ <listitem><para>
+ The user configuration must have a top level
+ <filename>version</filename> which must match the value of
+ the default configuration.
+ </para></listitem>
+ <listitem><para>
+ Any keys defined in the <filename>handlers</filename>,
+ <filename>formatters</filename>, or <filename>filters</filename>,
+ will be merged into the same section in the default
+ configuration, with the user specified keys taking
+ replacing a default one if there is a conflict. In
+ practice, this means that if both the default configuration
+ and user configuration specify a handler named
+ <filename>myhandler</filename>, the user defined one will
+ replace the default. To prevent the user from inadvertently
+ replacing a default handler, formatter, or filter, all of
+ the default ones are named with a prefix of
+ "<filename>BitBake.</filename>"
+ </para></listitem>
+ <listitem><para>
+ If a logger is defined by the user with the key
+ <filename>bitbake_merge</filename> set to
+ <filename>False</filename>, that logger will be completely
+ replaced by user configuration. In this case, no other
+ rules will apply to that logger.
+ </listitem></para>
+ <listitem><para>
+ All user defined <filename>filter</filename> and
+ <filename>handlers</filename> properties for a given logger
+ will be merged with corresponding properties from the
+ default logger. For example, if the user configuration adds
+ a filter called <filename>myFilter</filename> to the
+ <filename>BitBake.SigGen</filename>, and the default
+ configuration adds a filter called
+ <filename>BitBake.defaultFilter</filename>, both filters
+ will be applied to the logger
+ </listitem></para>
+ </itemizedlist>
+ </para>
+
+ <para>
+ As an example, consider the following user logging configuration
+ file which logs all Hash Equivalence related messages of VERBOSE or
+ higher to a file called <filename>hashequiv.log</filename>
+ <literallayout class='monospaced'>
+ {
+ "version": 1,
+ "handlers": {
+ "autobuilderlog": {
+ "class": "logging.FileHandler",
+ "formatter": "logfileFormatter",
+ "level": "DEBUG",
+ "filename": "hashequiv.log",
+ "mode": "w"
+ }
+ },
+ "formatters": {
+ "logfileFormatter": {
+ "format": "%(name)s: %(levelname)s: %(message)s"
+ }
+ },
+ "loggers": {
+ "BitBake.SigGen.HashEquiv": {
+ "level": "VERBOSE",
+ "handlers": ["autobuilderlog"]
+ },
+ "BitBake.RunQueue.HashEquiv": {
+ "level": "VERBOSE",
+ "handlers": ["autobuilderlog"]
+ }
+ }
+ }
+ </literallayout>
+ </para>
+ </section>
</chapter>
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
index bae01d90c0..c4bd1f2584 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
@@ -539,6 +539,17 @@
</glossdef>
</glossentry>
+ <glossentry id='var-bb-BB_LOGCONFIG'><glossterm>BB_LOGCONFIG</glossterm>
+ <glossdef>
+ <para>
+ Specifies the name of a config file that contains the user
+ logging configuration. See
+ <link linkend="logging">Logging</link> for additional
+ information
+ </para>
+ </glossdef>
+ </glossentry>
+
<glossentry id='var-bb-BB_LOGFMT'><glossterm>BB_LOGFMT</glossterm>
<glossdef>
<para>
--
2.17.1
next prev parent reply other threads:[~2020-03-09 16:34 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 16:33 [PATCH 00/15] Add support for python structured logging Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 01/15] bitbake: lib/bb/msg.py: Convert default domains to a dictionary Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 02/15] bitbake: knotty: Handle logging messages with specific logger Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 03/15] bitbake: lib/bb/msg.py: Use log level instead of debug count Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 04/15] bitbake: lib/bb/msg.py: Add repr for BBLogFormatter Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 05/15] bitbake: knotty: Add commented logging_tree code Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 06/15] bitbake: lib/bb/msg.py: Add filter utilities Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 07/15] bitbake: lib/bb/msg.py: Remove unused filters Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 08/15] bitbake: lib/bb/msg.py: Add helper to set logging config Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 09/15] bitbake: knotty: Remove dependency on format variable Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 10/15] bitbake: knotty: Setup logs with config helper Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 11/15] bitbake: worker: Remove unnecessary addDefaultLogFilter Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 12/15] bitbake: Log hash equivalence with a different logger Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 13/15] bitbake: Add autobuilder logging configuration Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` [PATCH 14/15] bitbake: Lower hash equivalence logging Joshua Watt
2020-03-09 16:33 ` [bitbake-devel][PATCH " Joshua Watt
2020-03-09 16:33 ` Joshua Watt [this message]
2020-03-09 16:33 ` [bitbake-devel][PATCH 15/15] bitbake-user-manual: Add documentation for BB_LOGCONFIG Joshua Watt
2020-03-12 23:50 ` [docs] [PATCH " Rich Persaud
2020-03-13 1:42 ` Joshua Watt
2020-03-13 1:42 ` [docs] [bitbake-devel][PATCH " Joshua Watt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200309163353.15362-16-JPEWhacker@gmail.com \
--to=jpewhacker@gmail.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=docs@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.