Integration with quill logging library#77107
Conversation
|
@maxknv why aren't my changes in |
because of fasttest's build script design. if module is required for fasttest build you need to add it into this array: https://github.com/ClickHouse/ClickHouse/blob/master/tests/docker_scripts/fasttest_runner.sh#L122 |
49c8353 to
a77707c
Compare
a77707c to
76c07c7
Compare
cbafe29 to
c0f77b4
Compare
Algunenano
left a comment
There was a problem hiding this comment.
Leaving a few comments now but I'll continue reviewing
| ${LIBRARY_DIR}/include/quill/backend/TransitEventBuffer.h | ||
| ${LIBRARY_DIR}/include/quill/backend/BackendUtilities.h | ||
|
|
||
| ${LIBRARY_DIR}/include/quill/bundled/fmt/args.h |
There was a problem hiding this comment.
I wonder if this won't cause issues with our own bundled fmt if/when the versions don't match exactly
There was a problem hiding this comment.
Quill bundles libfmt under a custom namespace and uses its header-only version internally.
There shouldn't be any issues if you're using a different libfmt external version. The only potential for ABI incompatibilities arises if you reuse existing fmt formatters for custom types with Quill (see external fmt formatter specializations).
However, I didn’t see that being used in this PR, so you should be fine.
There was a problem hiding this comment.
We use custom formatters that AFAIK we format everything before passing it to Quill (at least we do for other loggers). But maybe @antonio2368 can confirm this is still the case.
There was a problem hiding this comment.
fmt is still used in background thread regardless where we do the main formatting.
| { | ||
| queue.reserve(settings.reserved_size_rows); | ||
|
|
||
| if (settings.turn_off_logger) |
There was a problem hiding this comment.
Why? Is this missing / removed?
Algunenano
left a comment
There was a problem hiding this comment.
Some minor stuff. Still need to review some large diffs (the logger changes themselves 😄), understand the cmake changes and the tests changes too
| /// This wrapper helps to avoid too frequent and noisy log messages. | ||
| /// For each pair (logger_name, format_string) it remembers when such a message was logged the last time. | ||
| /// The message will not be logged again if less than min_interval_s seconds passed since the previously logged message. | ||
| class LogFrequencyLimiterImpl |
There was a problem hiding this comment.
Maybe we can move this and LogSeriesLimiter to a different file to remove deps from Logger.h? I know it was in a bad place already.
Algunenano
left a comment
There was a problem hiding this comment.
Final batch of comments. Great job
| LoggerPtr getLogger(std::string name, LoggerComponent component = LoggerComponent::Root); | ||
|
|
||
| template <size_t n> | ||
| LoggerPtr getLogger(const char (&name)[n]) |
There was a problem hiding this comment.
Maybe we can put getLogger into Logger_fwd.h since it seems it's what most includes for Common/Logger.h are for. That way we avoid including some heavy headers
| __LINE__, \ | ||
| _format_string, \ | ||
| _format_string_args); \ | ||
| DB::ExtendedLogMessage _msg_ext = DB::ExtendedLogMessage::getFrom(_poco_message); \ |
There was a problem hiding this comment.
_msg_ext should be built after _should_log so we don't build it unnecessarily under LogFrequency or LogSeries
There was a problem hiding this comment.
We need it for text log also later
src/Loggers/Loggers.cpp
Outdated
|
|
||
| auto current_logger = config.getString("logger", ""); | ||
| if (config_logger.has_value() && *config_logger == current_logger) | ||
| if (config_logger.has_value())// && *config_logger == current_logger) |
There was a problem hiding this comment.
This seems odd and maybe a leftover. Does this mean we can't change the config of the logger at runtime and, for example, change the log level?
There was a problem hiding this comment.
This was a hack, so I added initialized flag.
We can't change loggers at runtime, we can only change levels but this is handled by function updateLevels below.
src/Loggers/Loggers.cpp
Outdated
| error_log_file = std::static_pointer_cast<DB::RotatingFileSink>(sink); | ||
| } | ||
|
|
||
| // if (config.getBool("logger.use_syslog", false)) |
There was a problem hiding this comment.
I think it's ok to delete this code and drop syslog support as part of this PR.
src/Loggers/Loggers.cpp
Outdated
| } | ||
| } | ||
| } | ||
| // // Set level and channel to all already created loggers |
| } | ||
| } | ||
| } | ||
| getRootLogger()->setLogLevel(min_log_level); |
| #ifndef WITHOUT_TEXT_LOG | ||
| auto logs_queue = CurrentThread::getInternalTextLogsQueue(); | ||
|
|
||
| /// Log to "TCP queue" if message is not too noisy |
There was a problem hiding this comment.
What's TCP queue? Is it for client logs?
There was a problem hiding this comment.
Guessing this comes and replaces OwnSplitChannel
ef7daba to
3ccdeea
Compare
3ccdeea to
8eb58a5
Compare
|
Dear @antonio2368, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
|
Dear @antonio2368, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
1 similar comment
|
Dear @antonio2368, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
|
Not relevant after @Algunenano improved the logger. |
Changelog category (leave one):
https://github.com/odygrd/quill
There are some things still missing like
syslogbut most of the functionalities should be supported as before.Documentation entry for user-facing changes