containers / toolbox

Tool for interactive command line environments on Linux
https://containertoolbx.org/
Apache License 2.0
2.58k stars 219 forks source link

Debug logs are being logged as errors #1381

Open A6GibKm opened 1 year ago

A6GibKm commented 1 year ago

Doing journalctl -e -p err will return

sep 29 17:59:34 thinkpad fedora-toolbox-39[7726]: level=debug msg="Binding /var/lib/systemd/coredump to /run/host/var/lib/systemd/coredump"
sep 29 17:59:34 thinkpad fedora-toolbox-39[7726]: level=debug msg="Creating directory /var/log/journal"
sep 29 17:59:34 thinkpad fedora-toolbox-39[7726]: level=debug msg="Binding /var/log/journal to /run/host/var/log/journal"

and others.

$ toolbox --version
toolbox version 0.0.99.4
debarshiray commented 1 year ago

I haven't dug too much into this.

So far, my suspicion is that podman start logs everything being sent to the standard error stream as an error. Toolbx does use the standard error stream for all its verbose output. It has done so since the very early days of the POSIX shell implementation, and is also the default for logrus that the Go implementation uses today.

debarshiray commented 1 year ago

Whatever we do here, we should probably take care not to break podman logs, and the ability to see the logs in the terminal with podman start --attach ... or toolbox --verbose ... Those are really useful for when hacking and debugging Toolbx.

HarryMichal commented 1 year ago

So far, my suspicion is that podman start logs everything being sent to the standard error stream as an error. Toolbx does use the standard error stream for all its verbose output.

Ah! That might be it! Then the solution to this could be fairly straightforward by setting the logging output to stdout when Toolbx is being used as the entry-point.

debarshiray commented 6 months ago

This is the relevant Podman bug: https://github.com/containers/podman/issues/20728

I think we should switch logrus to use the standard output stream for all verbose output and only use the standard error stream for actual errors.