Skip to content
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

Feature: enhanced debug logging #1525

Closed
saschagrunert opened this issue Aug 14, 2024 · 4 comments
Closed

Feature: enhanced debug logging #1525

saschagrunert opened this issue Aug 14, 2024 · 4 comments

Comments

@saschagrunert
Copy link
Member

I think it's awesome that crun is able to log to journald using --log=journald:IDENTIFIER. Right now, it looks like that the project only logs warnings and errors occasionally:

> rg 'libcrun_(warning|error) \('
src/libcrun/container.c
772:            libcrun_warning ("error executing hook `%s` (exit code: %d)", hooks[i]->path, ret);
775:              libcrun_error (0, "error executing hook `%s` (exit code: %d)", hooks[i]->path, ret);
1187:          libcrun_warning ("cannot detect HOME environment variable, setting default");
1195:      libcrun_warning ("setting LISTEN_PID=1 since no previous configuration was found");
2932:      libcrun_error ((*err)->status, "%s", (*err)->msg);
3316:          libcrun_warning ("cannot detect HOME environment variable, setting default");

src/libcrun/error.h
78:LIBCRUN_PUBLIC void libcrun_warning (const char *msg, ...) __attribute__ ((format (printf, 1, 2)));
80:LIBCRUN_PUBLIC void libcrun_error (int errno_, const char *msg, ...) __attribute__ ((format (printf, 2, 3)));

src/libcrun/status.c
608:          libcrun_error (errno, "error opening file `%s`", status_file);

src/libcrun/error.c
408:libcrun_warning (const char *msg, ...)
417:libcrun_error (int errno_, const char *msg, ...)

src/libcrun/linux.c
742:          libcrun_warning ("could not create a new keyring: keyctl_join is not supported");
3047:            libcrun_warning ("unable to invoke `newgidmap`, will try creating a user namespace with single mapping as an alternative");
3078:            libcrun_warning ("unable to invoke `newuidmap`, will try creating a user namespace with single mapping as an alternative");
3226:          libcrun_warning ("unknown cap: `%s`", values[i]);
3931:      libcrun_warning ("non root user need to have an 'user' namespace");

src/libcrun/seccomp.c
754:              libcrun_warning ("unknown seccomp syscall `%s` ignored", seccomp->syscalls[i]->names[j]);

The --debug flag sets the verbosity from LIBCRUN_VERBOSITY_ERROR to LIBCRUN_VERBOSITY_WARNING.

Do you think it would make sense to add a more verbose debug logging mechanism which provides more information? I think that would play well together with CRI-O and conmon-rs.

cc @kolyshkin @giuseppe @haircommander

@giuseppe
Copy link
Member

I think this is a good idea. We could add more debugging levels, so that --debug could be implemented without flooding the normal execution

@saschagrunert
Copy link
Member Author

@giuseppe --debug shoult stay warning verbosity?

I could imaging that we add --log-level to allow debug, warning and error.

@kwilczynski
Copy link
Member

--debug command-line switch enabling warning log level is a bit confusing...

@saschagrunert
Copy link
Member Author

Let's close this for now, we can follow-up on more debug logs later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants