diff options
| author | Stefan Boberg <[email protected]> | 2023-11-06 14:24:31 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-06 14:24:31 +0100 |
| commit | 98dfe4e7f8d0ed05f959b5cb0685d144c5462032 (patch) | |
| tree | f69beef950e1596204d4ac15a92180bb56beef4e | |
| parent | reduce cachebucket mem (#509) (diff) | |
| download | zen-98dfe4e7f8d0ed05f959b5cb0685d144c5462032.tar.xz zen-98dfe4e7f8d0ed05f959b5cb0685d144c5462032.zip | |
fixed issue where file log sink would get the wrong pattern assigned (#513)
this made the file log emit relative timing instead of an absolute timestamp prefix
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zenutil/logging.cpp | 24 |
2 files changed, 13 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index bf73ae47b..3024e5777 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Feature: New garbage collection implementation, still in evaluation mode. Enabled by `--gc-v2` command line option - Improvement: Multithread init and flush of cache bucket for faster startup and exit - Bugfix: Build script now sets up arch properly when running tests on MacOS +- Bugfix: Server log files were using the wrong log line prefix due to a mistake when consolidating logging setup code - Improvement: Reduce memory consumption in cache disk layer ## 0.2.30 diff --git a/src/zenutil/logging.cpp b/src/zenutil/logging.cpp index 3cd72eac9..4d8dcbca6 100644 --- a/src/zenutil/logging.cpp +++ b/src/zenutil/logging.cpp @@ -116,18 +116,6 @@ BeginInitializeLogging(const LoggingOptions& LogOptions) } #endif - if (FileSink) - { - if (LogOptions.AbsLogFile.extension() == ".json") - { - FileSink->set_formatter(std::make_unique<logging::json_formatter>(LogOptions.LogId)); - } - else - { - FileSink->set_pattern("[%C-%m-%d.%e %T] [%n] [%l] %v"); - } - } - spdlog::set_error_handler([](const std::string& msg) { if (msg == std::bad_alloc().what()) { @@ -182,6 +170,18 @@ FinishInitializeLogging(const LoggingOptions& LogOptions) spdlog::flush_every(std::chrono::seconds{2}); spdlog::set_formatter(std::make_unique<logging::full_formatter>(LogOptions.LogId, std::chrono::system_clock::now())); + if (g_FileSink) + { + if (LogOptions.AbsLogFile.extension() == ".json") + { + g_FileSink->set_formatter(std::make_unique<logging::json_formatter>(LogOptions.LogId)); + } + else + { + g_FileSink->set_pattern("[%C-%m-%d.%e %T] [%n] [%l] %v"); + } + } + const std::string StartLogTime = zen::DateTime::Now().ToIso8601(); spdlog::apply_all([&](auto Logger) { Logger->info("log starting at {}", StartLogTime); }); |