diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2021-09-07 13:59:34 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2021-09-07 14:02:25 +0200 |
commit | 9dff1c03019ccbe03e4567b0fa32bed93dc6abe4 (patch) | |
tree | 0799616e4ecf91b0a8629c6ec2563dde081eeaea /src/libnm-log-core/nm-logging.h | |
parent | 9b089b34a1e92d55f1b0de95a59bdd3dd7b6feab (diff) | |
download | NetworkManager-bg/log-none.tar.gz |
log: introduce "none" logging backendbg/log-none
In initrd, the NM service should write logs to both the active console
and the journal. To achieve that, NetworkManager is started with
"--debug" to output logs to stderr, and the systemd unit is configured
with "StandardError=tty" to redirect messages to the console. NM is
configured with "logging.backend=journal" to also save logs in the
journal. The problem of this approach is that when the system doesn't
have a console, the NM service fails to start [1].
This can be solved by using "StandardError=journal+console" which
forwards messages from stderr to journald (which in turn also writes
them to the console if available). To avoid duplicates entries in the
journal, we need a way to disable all logging backends in NM and only
write to stderr.
Introduce a "none" logging backend. Of course, it's not recommended to
start NM without logging; therefore the "none" backend can't be used
as build-time default. "none" only makes some sense when also starting
NM with "--debug".
[1] https://github.com/coreos/fedora-coreos-tracker/issues/943
Diffstat (limited to 'src/libnm-log-core/nm-logging.h')
-rw-r--r-- | src/libnm-log-core/nm-logging.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libnm-log-core/nm-logging.h b/src/libnm-log-core/nm-logging.h index 8071967552..739473a1ad 100644 --- a/src/libnm-log-core/nm-logging.h +++ b/src/libnm-log-core/nm-logging.h @@ -16,6 +16,7 @@ #define NM_LOG_CONFIG_BACKEND_DEBUG "debug" #define NM_LOG_CONFIG_BACKEND_SYSLOG "syslog" #define NM_LOG_CONFIG_BACKEND_JOURNAL "journal" +#define NM_LOG_CONFIG_BACKEND_NONE "none" #define nm_log_err(domain, ...) nm_log(LOGL_ERR, (domain), NULL, NULL, __VA_ARGS__) #define nm_log_warn(domain, ...) nm_log(LOGL_WARN, (domain), NULL, NULL, __VA_ARGS__) |