diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-02-27 15:47:11 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-02-28 09:32:42 +0100 |
commit | 32b0678c868b42ad68d383c8bf18fc2cdb1fbe95 (patch) | |
tree | 1b36a8fefce2000373ecabca06597de52792378a /src | |
parent | journald: upgrade log message about missing mmap() support to LOG_ERR (diff) | |
download | systemd-32b0678c868b42ad68d383c8bf18fc2cdb1fbe95.tar.xz systemd-32b0678c868b42ad68d383c8bf18fc2cdb1fbe95.zip |
journald: always pass error code to logging function, even if we don't use it with %m
We always want to pass the error code along with the log call, so that
it can add it to structured logging, even if the format string does not
contain %m.
Diffstat (limited to 'src')
-rw-r--r-- | src/journal/journald-server.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 1c7372e628..a6741ff8cc 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -836,7 +836,7 @@ static bool shall_try_append_again(JournalFile *f, int r) { case -EFBIG: /* Hit fs limit */ case -EDQUOT: /* Quota limit hit */ case -ENOSPC: /* Disk full */ - log_debug("%s: Allocation limit reached, rotating.", f->path); + log_debug_errno(r, "%s: Allocation limit reached, rotating.", f->path); return true; case -EROFS: /* Read-only file system */ @@ -844,53 +844,53 @@ static bool shall_try_append_again(JournalFile *f, int r) { * rotated. If the FS is read-only, rotation will fail and s->system_journal will be set to * NULL. After that, when find_journal will try to open the journal since s->system_journal * will be NULL, it will open the runtime journal. */ - log_ratelimit_warning(JOURNAL_LOG_RATELIMIT, "%s: Read-only file system, rotating.", f->path); + log_ratelimit_warning_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Read-only file system, rotating.", f->path); return true; case -EIO: /* I/O error of some kind (mmap) */ - log_ratelimit_warning(JOURNAL_LOG_RATELIMIT, "%s: IO error, rotating.", f->path); + log_ratelimit_warning_errno(r, JOURNAL_LOG_RATELIMIT, "%s: IO error, rotating.", f->path); return true; case -EHOSTDOWN: /* Other machine */ - log_ratelimit_info(JOURNAL_LOG_RATELIMIT, "%s: Journal file from other machine, rotating.", f->path); + log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Journal file from other machine, rotating.", f->path); return true; case -EBUSY: /* Unclean shutdown */ - log_ratelimit_info(JOURNAL_LOG_RATELIMIT, "%s: Unclean shutdown, rotating.", f->path); + log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Unclean shutdown, rotating.", f->path); return true; case -EPROTONOSUPPORT: /* Unsupported feature */ - log_ratelimit_info(JOURNAL_LOG_RATELIMIT, "%s: Unsupported feature, rotating.", f->path); + log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Unsupported feature, rotating.", f->path); return true; case -EBADMSG: /* Corrupted */ case -ENODATA: /* Truncated */ case -ESHUTDOWN: /* Already archived */ - log_ratelimit_info(JOURNAL_LOG_RATELIMIT, "%s: Journal file corrupted, rotating.", f->path); + log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Journal file corrupted, rotating.", f->path); return true; case -EIDRM: /* Journal file has been deleted */ - log_ratelimit_info(JOURNAL_LOG_RATELIMIT, "%s: Journal file has been deleted, rotating.", f->path); + log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Journal file has been deleted, rotating.", f->path); return true; case -EREMCHG: /* Wallclock time (CLOCK_REALTIME) jumped backwards relative to last journal entry */ - log_ratelimit_info(JOURNAL_LOG_RATELIMIT, "%s: Realtime clock jumped backwards relative to last journal entry, rotating.", f->path); + log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Realtime clock jumped backwards relative to last journal entry, rotating.", f->path); return true; case -EREMOTE: /* Boot ID different from the one of the last entry */ - log_ratelimit_info(JOURNAL_LOG_RATELIMIT, "%s: Boot ID changed since last record, rotating.", f->path); + log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Boot ID changed since last record, rotating.", f->path); return true; case -ENOTNAM: /* Monotonic time (CLOCK_MONOTONIC) jumped backwards relative to last journal entry */ - log_ratelimit_info(JOURNAL_LOG_RATELIMIT, "%s: Monotonic clock jumped backwards relative to last journal entry, rotating.", f->path); + log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Monotonic clock jumped backwards relative to last journal entry, rotating.", f->path); return true; case -EILSEQ: /* seqnum ID last used in the file doesn't match the one we'd passed when writing an entry to it */ - log_ratelimit_info(JOURNAL_LOG_RATELIMIT, "%s: Journal file uses a different sequence number ID, rotating.", f->path); + log_ratelimit_info_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Journal file uses a different sequence number ID, rotating.", f->path); return true; case -EAFNOSUPPORT: - log_ratelimit_error(JOURNAL_LOG_RATELIMIT, "%s: Underlying file system does not support memory mapping or another required file system feature.", f->path); + log_ratelimit_error_errno(r, JOURNAL_LOG_RATELIMIT, "%s: Underlying file system does not support memory mapping or another required file system feature.", f->path); return false; default: |