On 8/24/20 3:53 AM, Richard Purdie wrote:
On Sun, 2020-08-23 at 17:01 +0200, Konrad Weihmann wrote:
Hi all,

when running bitbake in CI I would like to add an additional log
handler to used python logging to catch *ALL* (task warnings,
dangling append, qa issues, a.s.o.), instead of manually grepping
through the console  log.
The information coming from this should be ideally be written to a
file, file, which can then serve as some sort of report.

Is there a way to do that?

In theory it should be possible to hook to an (obviously non-
existing)
event and handle it from there, right?

Or am I thinking in the wrong direction?

Any pointers are appreciated from my side...
On the autobuilder the code simple watches the console log, filtering
on WARNING: and produces a separate warning stream. A non empty file
triggers the build to show a having warnings.

At the bitbake level it would also definitely be possible, the log
messages are seen in the UI code as events and it can do whatever it
wants with them.

There was a also much more advanced log handling added recently through
the BB_LOGCONFIG variable. I'm not sure if that can define a completely
separate stream or not, I've not tried that.

The newer log handling uses Python's structure logging configuration [1], so you should be able to use whatever capabilities it has (including logging different domains/levels to a separate file). In fact, this is the only way logging is handled by core bitbake now; all of the other logging mechanisms used by the UI are additional configuration specified on top of the user's BB_LOGCONFIG file. If you are interested, you can see this in bitbake/lib/bb/ui/knotty.py. In that file is an additional tool that might be helpful. Around line 553, there are two commented lines of code:

    #import logging_tree
    #logging_tree.printout()

uncommenting them and installing the logging_tree python package will make bitbake dump the entire structured logging configuration to stdout on startup so you can look at it.


[1]: https://docs.python.org/3/library/logging.config.html


Cheers,

Richard



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#50333): https://lists.yoctoproject.org/g/yocto/message/50333
Mute This Topic: https://lists.yoctoproject.org/mt/76366066/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to