bootc icon indicating copy to clipboard operation
bootc copied to clipboard

Add debug output option

Open jmpolom opened this issue 1 year ago • 7 comments

When bootc shells out to external applications, such as during installation to sgdisk and systemd-cryptenroll, it should provide a way for the entire exact command to be logged or otherwise visible to the user for debugging purposes.

jmpolom avatar Apr 17 '24 18:04 jmpolom

From: https://github.com/containers/bootc/blob/9a1e29cf3f0d2aa45206845a7e69bb9f21a4a157/lib/src/task.rs#L89

Currently setting the environment RUST_LOG=debug should provide this with output like:

DEBUG exec: "ostree" "--repo=/ostree/repo" "rev-parse" "--single"

Is that sufficient? If so, at the very least it sounds like we could probably improve the docs to point this out.

jeckersb avatar Apr 17 '24 19:04 jeckersb

~~I will try it and let you know what I find.~~ It appears to do some kind of logging.

At a minimum a documentation improvement is needed to ensure that option is publicized, both on the website docs and in the help output from the (sub)command.

A flag would be far more user friendly than setting a random env var, particularly when dealing with the command running inside of a container. When running the command inside of the container you'd need to add an env var flag to the already very complex podman run invocation which will be tedious.

tldr; Adding a --verbose or --debug flag would be more user friendly/accessible than an env var.

jmpolom avatar Apr 17 '24 19:04 jmpolom

Hi @cgwalters & @jmarrero! Can I take this issue if nobody else is working on it? (no assignees but asking anyways) Not an expert on the topic but I want to give it a start on contributing to bootc so this issue looked suitable as this is a good first issue.

mabulgu avatar Feb 19 '25 13:02 mabulgu

/assign

Starting to look at this (in my spare time. So dont expect a quick PR pls). Pls let me know if you have any concerns.

Edit: Oh, seems that you don't have the assign bot.

mabulgu avatar Feb 20 '25 09:02 mabulgu

Image

This is how it looks like RN. I am going to create a PR soon. Before, I need to add some tests where possible.

mabulgu avatar Feb 22 '25 23:02 mabulgu

Does this more or less follow the same code path as the previous env var method? Output looks quite similar.

jmpolom avatar Feb 23 '25 00:02 jmpolom

Does this more or less follow the same code path as the previous env var method? Output looks quite similar.

It is actually not related to the prev. code path. The tracing is the same tracing mechanism, we tweak it and add a new flag to the CLI for tweaking the log level on the fly. Now it is the --verbose flag does the magic. If someone uses the env var, this will be overriding, otherwise, the tracing level can be changed by using -v, -vv, -vvv:

Image

mabulgu avatar Feb 23 '25 10:02 mabulgu