Much of the logging functionality is undocumented at the moment. I suggest the following additions to the BitBake user manual and the Yocto Project Reference Manual. ***Change 1*** In the BitBake User Manual, change the following, -v, --verbose Output more log message data to the terminal. -D, --debug Increase the debug level. You can specify this more than once. , to the following: -v, --verbose Enable tracing of shell tasks (with 'set -x'). Also print bb.note(...) messages to stdout (in addition to writing them to ${T}/log.do_<task>). -D, --debug Increase the debug level. You can specify this more than once. -D sets the debug level to 1, where only bb.debug(1, ...) messages are printed to stdout; -DD sets the debug level to 2, where both bb.debug(1, ...) and bb.debug(2, ...) messages are printed; etc. Without -D, no debug messages are printed. Note that -D only affects output to stdout. All debug messages are written to ${T}/log.do_taskname, regardless of the debug level. ***Change 2*** Fix typo in https://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#var-BBDEBUG. "... -d command line option" should be "... -D command line option". ***Change 3*** In the Yocto Project Reference manual, replace the contents of 2.3.8. Recipe Logging Mechanisms with the following. This removes "best practices exist while writing recipes that both log build progress and act on build conditions such as warnings and errors" and the reference to logging.bbclass, but I think that's okay. For Python functions, the following logging functions exist. All of these functions log to ${T}/log.do_<task>, and can also log to stdout with the right settings. * bb.plain(<msg>): Writes <msg> as-is to the log, also logging to stdout. * bb.note(<msg>): Writes "NOTE: <msg>" to the log. Also logs to stdout if bitbake is called with -v. * bb.debug(<level>, <msg>): Writes "DEBUG: <msg>" to the log. Also logs to stdout if the log level is greater than or equal to <level>: See the -D option in the (bitbake command overview)[https://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#usage-and-syntax]. * bb.warn(<msg>): Writes "WARNING: <msg>" to the log, also logging to stdout. * bb.error(<msg>): Writes "ERROR: <msg>" to the log, also logging to stdout. Note that calling this function does not cause the task to fail. * bb.fatal(<msg>): Like bb.error(<msg>), but also causes the calling task to fail. The same logging functions are also available in shell functions, under the names 'bbplain', 'bbnote', 'bbdebug', 'bbwarn', 'bberror', and 'bbfatal'.
Ulf, Change 1: This change needs to be made to reflect the screen output when a user enters "bitbake -h". The manual is reflecting the code here. So I suggest filing a bug against the actual help output for the bitbake command. When you file that, mark the dog flag as "yes" so I will see that the output in the manual needs updated as well. Change 2: Fixed the -d to -D - see http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#var-BBDEBUG Change 3: This was a more complicated change. I did not want to just substitute that entire block for that fragment of the first paragraph. We really need some sort of introductory sentence to start the section with. So, you will see that I left the general start of the section. Then I put in the changes you suggested. I was unclear what to do with the existing two-bullet list that generally mentioned "Python" and "Bash", so I removed them in favor of the more detailed stuff you provided. Also, was not sure how you were suggesting to end the section. So... check it out and let me know. http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#recipe-logging-mechanisms Thanks, Scott
(In reply to comment #1) > Ulf, > > Change 1: This change needs to be made to reflect the screen output when a > user enters "bitbake -h". The manual is reflecting the code here. So I > suggest filing a bug against the actual help output for the bitbake command. > When you file that, mark the dog flag as "yes" so I will see that the output > in the manual needs updated as well. Alright. I filed a separate ticket at https://bugzilla.yoctoproject.org/show_bug.cgi?id=9962. > Change 3: This was a more complicated change. I did not want to just > substitute that entire block for that fragment of the first paragraph. We > really need some sort of introductory sentence to start the section with. > So, you will see that I left the general start of the section. Then I put > in the changes you suggested. I was unclear what to do with the existing > two-bullet list that generally mentioned "Python" and "Bash", so I removed > them in favor of the more detailed stuff you provided. Yeah, might be nice to have an introductory sentence, but to be honest I have no idea what the current one is trying to say :). Maybe it could be replaced with Yocto provides several logging functions for producing debugging output and reporting errors and warnings. > Also, was not sure how you were suggesting to end the section. > So... check it out and let me know. I just noticed there's separate documentation for logging.bbclass. Maybe this would work: The same logging functions are also available in shell functions, under the names bbplain, bbnote, bbdebug, bbwarn, bberror, and bbfatal. These are implemented in [logging.bbclass](http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#ref-classes-logging).
Ulf, See http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#recipe-logging-mechanisms for the modifications and let me know if we are good on this bug now. Thanks, Scott
Looks good to me! Thanks, Ulf
Thanks, Reset to RESOLVED and marked doc flag to "Done." Scott