journald: add debug logs around offlining/archiving/rotating/varlink operations

It is not easy to understand what happens to a journal file
even with debug logs enabled. Add more dbg messages around operations
started by users to make it possible to follow the flow of operations.
This commit is contained in:
Luca Boccassi
2025-08-01 05:42:51 +09:00
committed by Yu Watanabe
parent 090b23e051
commit 8cc1748ddc
4 changed files with 34 additions and 1 deletions
+22 -1
View File
@@ -12,7 +12,9 @@
#include "fd-util.h"
#include "journal-authenticate.h"
#include "journal-file-util.h"
#include "journal-internal.h"
#include "log.h"
#include "log-ratelimit.h"
#include "set.h"
#include "string-util.h"
@@ -318,12 +320,25 @@ int journal_file_set_offline(JournalFile *f, bool wait) {
target_state = f->archive ? STATE_ARCHIVED : STATE_OFFLINE;
log_ratelimit_full(LOG_DEBUG,
JOURNAL_LOG_RATELIMIT,
"Journal file %s is %s transitioning to %s.",
f->path,
wait ? "synchronously" : "asynchronously",
f->archive ? "archived" : "offline");
/* An offlining journal is implicitly online and may modify f->header->state,
* we must also join any potentially lingering offline thread when already in
* the desired offline state.
*/
if (!journal_file_is_offlining(f) && f->header->state == target_state)
if (!journal_file_is_offlining(f) && f->header->state == target_state) {
log_ratelimit_full(LOG_DEBUG,
JOURNAL_LOG_RATELIMIT,
"Journal file %s is already %s, waiting for offlining thread.",
f->path,
f->archive ? "archived" : "offline");
return journal_file_set_offline_thread_join(f);
}
/* Restart an in-flight offline thread and wait if needed, or join a lingering done one. */
restarted = journal_file_set_offline_try_restart(f);
@@ -336,6 +351,12 @@ int journal_file_set_offline(JournalFile *f, bool wait) {
if (restarted)
return 0;
log_ratelimit_full(LOG_DEBUG,
JOURNAL_LOG_RATELIMIT,
"Starting new %s offlining operation for journal file %s.",
wait ? "synchronous" : "asynchronous",
f->path);
/* Initiate a new offline. */
f->offline_state = OFFLINE_SYNCING;