Skip to content

lib: Add --verbose flag to the CLI for providing a debug output option #1154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ bootc.tar.zst

# Added by cargo
/target

# IDEs / Editors
.idea/
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@

- [bootc image](experimental-bootc-image.md)
- [--progress-fd](experimental-progress-fd.md)
-
# Troubleshooting

- [increasing_logging_verbosity](increasing_logging_verbosity.md)

# More information

Expand Down
48 changes: 48 additions & 0 deletions docs/src/increasing_logging_verbosity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Increasing Logging Verbosity

When troubleshooting issues with **bootc**, it is often helpful to enable **verbose logging** to gain additional insights into its execution flow.

## Using the `--verbose` Flag
Most **bootc** commands support the `--verbose` flag, which enables detailed logging output. The verbosity level determines how much information is logged.

### **Verbosity Levels**
The `--verbose` flag can be used multiple times (`-v`, `-vv`, `-vvv`) to increase the verbosity of logging:

| Verbosity Level | Flag Used | Logs Enabled |
|---------------|-----------|--------------|
| **WARN** (default) | *(no flag)* | Only warnings and errors |
| **INFO** | `-v` | Warnings, errors, and general information |
| **DEBUG** | `-vv` | Info, warnings, errors, and debug logs |
| **TRACE** | `-vvv` or more | All logs, including low-level tracing |

### Example Usage
To switch to a new container image with verbose logging enabled:
```sh
bootc switch --apply -vv quay.io/centos-bootc/centos-bootc:stream9
```
This command will print **INFO, DEBUG, and WARN logs**, helping diagnose issues during the `switch` process.

### Example Output (Verbose Mode Enabled with `-vv`)
```sh
$ bootc switch --apply -vvv quay.io/centos-bootc/centos-bootc:stream9
TRACE Verified uid 0 with CAP_SYS_ADMIN
DEBUG Re-executing current process for _ostree_unshared
DEBUG Already in a mount namespace
DEBUG Current security context is unconfined_u:system_r:install_t:s0:c1023
INFO We have install_t
INFO Staged: None
DEBUG Rollback queued=false
DEBUG Wrote merge commit b8761b75924d7f21e7f92abc8fd8b3c645d289fc91555
DEBUG new_with_config: Spawned skopeo pid=1023
TRACE new_with_config: impl_request: sending request Initialize
TRACE new_with_config: impl_request: completed request Config=ImageProxy
```
With `-vvv`, the output includes **INFO, DEBUG, WARN, and TRACE** level messages.

## Using the `RUST_LOG` Environment Variable
For even more detailed logging, use the `RUST_LOG` environment variable (if applicable for Rust-based components):

```sh
RUST_LOG=debug bootc switch --apply -vvv quay.io/centos-bootc/centos-bootc:stream9
```
The environment variable will override the `-vvv` and enable **DEBUG** level logs for Rust-based sub-components within **bootc**.
6 changes: 6 additions & 0 deletions docs/src/man/bootc-container-lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ part of a build process; it will error if any problems are detected.

: Operate on the provided rootfs

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**\--fatal-warnings**

: Make warnings fatal
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Operations which can be executed as part of a container build

# OPTIONS

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**-h**, **\--help**

: Print help
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-edit.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ Only changes to the \`spec\` section are honored.

: Use filename to edit system specification

**-v**, **\--verbose...**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**\--quiet**

: Dont display progress
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-install-ensure-completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ your code is using \`bootc install to-filesystem\` from the start.

# OPTIONS

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**-h**, **\--help**

: Print help (see a summary with -h)
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-install-print-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ string-valued filesystem name suitable for passing to \`mkfs.\$type\`.

# OPTIONS

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**-h**, **\--help**

: Print help (see a summary with -h)
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-install-to-disk.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ more complex such as RAID, LVM, LUKS etc.

# OPTIONS

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**\--wipe**

: Automatically wipe all existing data on device
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-install-to-existing-root.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ cleaned up if desired when rebooted into the new root.
However, the running system (and all files) will remain in place
until reboot

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**\--source-imgref**=*SOURCE_IMGREF*

: Install the system from an explicitly given source.
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-install-to-filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ is currently expected to be empty by default.

If not provided, the UUID of the target filesystem will be used.

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**\--boot-mount-spec**=*BOOT_MOUNT_SPEC*

: Mount specification for the /boot filesystem.
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ includes other setup and metadata.

# OPTIONS

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**-h**, **\--help**

: Print help (see a summary with -h)
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-rollback.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ rollback invocation.

# OPTIONS

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**-h**, **\--help**

: Print help (see a summary with -h)
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ not \`null\`.

# OPTIONS

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**\--format**=*FORMAT*

: The output format\
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ updates via container image tags; for example,

: Dont display progress

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**\--apply**

: Restart or reboot into the new target image.
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ the update in addition.

: Dont display progress

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**\--check**

: Check if an update is available without applying it.
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc-usr-overlay.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ unmount\".

# OPTIONS

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**-h**, **\--help**

: Print help (see a summary with -h)
Expand Down
6 changes: 6 additions & 0 deletions docs/src/man/bootc.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ pulled and \`bootc upgrade\`.

# OPTIONS

**-v**, **\--verbose**

: Increase logging verbosity

Use `-vv`, `-vvv` to increase verbosity more.

**-h**, **\--help**

: Print help (see a summary with -h)
Expand Down
1 change: 1 addition & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ uuid = { version = "1.8.0", features = ["v4"] }
tini = "1.3.0"
comfy-table = "7.1.1"
thiserror = { workspace = true }
nix = "0.27.1"

[dev-dependencies]
similar-asserts = { workspace = true }
Expand Down
Loading