diff options
Diffstat (limited to 'log_manager.cpp')
-rw-r--r-- | log_manager.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/log_manager.cpp b/log_manager.cpp index d587ec4..6ae59fd 100644 --- a/log_manager.cpp +++ b/log_manager.cpp @@ -32,6 +32,15 @@ void Manager::commit(uint64_t transactionId, std::string errMsg) // Length of 'TRANSACTION_ID=' string. constexpr const auto transactionIdVarOffset = transactionIdVarSize + 1; + // Flush all the pending log messages into the journal via Synchronize + constexpr auto JOURNAL_BUSNAME = "org.freedesktop.journal1"; + constexpr auto JOURNAL_PATH = "/org/freedesktop/journal1"; + constexpr auto JOURNAL_INTERFACE = "org.freedesktop.journal1"; + auto bus = sdbusplus::bus::new_default(); + auto method = bus.new_method_call(JOURNAL_BUSNAME, JOURNAL_PATH, + JOURNAL_INTERFACE, "Synchronize"); + bus.call_noreply(method); + sd_journal *j = nullptr; int rc = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY); if (rc < 0) |