From 23880df80b59f00499143f26eaacc34105cc7194 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Wed, 17 Jan 2024 09:39:17 -0500 Subject: reinstate formatter settings for file sink (#631) fixes issue introduced in #615 --- CHANGELOG.md | 1 + src/zenutil/logging.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c388f263a..3e8d9df2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Improvement: Removed use of in stats, for better performance (runtime as well as build) - Improvement: Separated cache RPC handling code from general structured cache HTTP code - Bugfix: RPC recording would not release memory as early as intended which resulted in memory buildup during long recording sessions. Previously certain memory was only released when recording stopped, now it gets released immediately when a segment is complete and written to disk. +- Bugfix: File log format now contains dates again (PR #631) ## 0.2.38 - Bugfix: Cache RPC recording would drop data when it reached 4GB of inline chunk data in a segment diff --git a/src/zenutil/logging.cpp b/src/zenutil/logging.cpp index 64230ea81..eef6a59ce 100644 --- a/src/zenutil/logging.cpp +++ b/src/zenutil/logging.cpp @@ -182,6 +182,15 @@ FinishInitializeLogging(const LoggingOptions& LogOptions) spdlog::set_formatter( std::make_unique(LogOptions.LogId, std::chrono::system_clock::now())); // default to duration prefix + if (LogOptions.AbsLogFile.extension() == ".json") + { + g_FileSink->set_formatter(std::make_unique(LogOptions.LogId)); + } + else + { + g_FileSink->set_formatter(std::make_unique(LogOptions.LogId)); // this will have a date prefix + } + const std::string StartLogTime = zen::DateTime::Now().ToIso8601(); spdlog::apply_all([&](auto Logger) { Logger->info("log starting at {}", StartLogTime); }); -- cgit v1.2.3