diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc index fd54cc580..16ff1c5f4 100644 --- a/src/libutil/logging.cc +++ b/src/libutil/logging.cc @@ -344,12 +344,13 @@ std::unique_ptr makeJSONLogger(const std::filesystem::path & path, bool void applyJSONLogger() { if (!loggerSettings.jsonLogPath.get().empty()) { + std::vector> loggers; try { - std::vector> loggers; loggers.push_back(std::move(logger)); loggers.push_back(makeJSONLogger(std::filesystem::path(loggerSettings.jsonLogPath.get()), false)); logger = makeTeeLogger(std::move(loggers)); } catch (...) { + logger = std::move(loggers[0]); ignoreExceptionExceptInterrupt(); } }