crun icon indicating copy to clipboard operation
crun copied to clipboard

Feature: enhanced debug logging

Open saschagrunert opened this issue 1 year ago • 3 comments
trafficstars

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

saschagrunert avatar Aug 14 '24 14:08 saschagrunert