libcnb.rs icon indicating copy to clipboard operation
libcnb.rs copied to clipboard

Provide a consistent way to control log verbosity (`BP_LOG_LEVEL`)

Open edmorley opened this issue 4 years ago • 1 comments

I noticed that the Paketo buildpacks have a consistent way to control the verbosity of log output of their buildpacks via a BP_LOG_LEVEL env var: https://github.com/paketo-buildpacks/rfcs/blob/main/text/0027-log-levels.md

I think it makes sense for us to have something similar (if not exactly the same).

edmorley avatar Sep 25 '21 13:09 edmorley

I was at an authors working group meeting where they talked about it. I think it’s good to have standardization around giving the user control over how much info they want output.

This is related to the display work in libherokubuildpack.

we could put the core of that (or something like it) in libcnb and then build on top of it for libherokubuildpack. I don’t think we need to block that work though.

as a design decision we should ask what our goals are and how much we want to integrate. For example if we can assume a logger/display interface is always present then we could have libcnb internals log (for example maybe we emit what shell commands are being run or files downloaded to “debug” level automatically.

I know that Java suffers from massive outputs. I would start looking there to better understand what our use cases for strategically condensing/reducing/eliminating output are.

The other related idea is to have a standard interface for capturing certain information and emitting it only on failure or error. Since long builds may take 10-20 minutes it is a bad experience to have it fail and have to set a level and re-run just to see if the logs have any extra info.

schneems avatar Sep 25 '21 14:09 schneems