summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-19 18:08:31 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-19 18:11:16 +0200
commit170a434c784fc7919e6ad7c269ea4f7abcc6065a (patch)
treea8cbc74c7d46fcf5a296606aa57bf6eb18ddf94e /src
parentf7e7bb6546ab5d679ab23dc80c714a26d1a57a24 (diff)
downloadsystemd-170a434c784fc7919e6ad7c269ea4f7abcc6065a.tar.gz
systemd-170a434c784fc7919e6ad7c269ea4f7abcc6065a.tar.bz2
systemd-170a434c784fc7919e6ad7c269ea4f7abcc6065a.zip
journal: emit debug log about settings only once (or when changed)
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=902795 https://bugzilla.redhat.com/show_bug.cgi?id=1715699 report "thousands" of those messages. I think this occurs when journald rotates files very quickly. Nevertheless, logging this over and over is not useful, let's do it just once.
Diffstat (limited to 'src')
-rw-r--r--src/journal/journal-file.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 91ca53e5eb..f0dd695adb 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -3185,7 +3185,6 @@ int journal_file_open(
JournalFile *f;
void *h;
int r;
- char bytes[FORMAT_BYTES_MAX];
assert(ret);
assert(fd >= 0 || fname);
@@ -3221,9 +3220,23 @@ int journal_file_open(
#endif
};
- log_debug("Journal effective settings seal=%s compress=%s compress_threshold_bytes=%s",
- yes_no(f->seal), yes_no(JOURNAL_FILE_COMPRESS(f)),
- format_bytes(bytes, sizeof(bytes), f->compress_threshold_bytes));
+ if (DEBUG_LOGGING) {
+ static int last_seal = -1, last_compress = -1;
+ static uint64_t last_bytes = UINT64_MAX;
+ char bytes[FORMAT_BYTES_MAX];
+
+ if (last_seal != f->seal ||
+ last_compress != JOURNAL_FILE_COMPRESS(f) ||
+ last_bytes != f->compress_threshold_bytes) {
+
+ log_debug("Journal effective settings seal=%s compress=%s compress_threshold_bytes=%s",
+ yes_no(f->seal), yes_no(JOURNAL_FILE_COMPRESS(f)),
+ format_bytes(bytes, sizeof bytes, f->compress_threshold_bytes));
+ last_seal = f->seal;
+ last_compress = JOURNAL_FILE_COMPRESS(f);
+ last_bytes = f->compress_threshold_bytes;
+ }
+ }
if (mmap_cache)
f->mmap = mmap_cache_ref(mmap_cache);