mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #10542 from azat/logger.levels.logger
Ability to set logger level for loggers that have non allowed in xml tags symbols
This commit is contained in:
commit
cef5f12186
@ -166,12 +166,29 @@ void Loggers::buildLoggers(Poco::Util::AbstractConfiguration & config, Poco::Log
|
||||
logger.root().setChannel(logger.getChannel());
|
||||
|
||||
// Explicitly specified log levels for specific loggers.
|
||||
Poco::Util::AbstractConfiguration::Keys levels;
|
||||
config.keys("logger.levels", levels);
|
||||
{
|
||||
Poco::Util::AbstractConfiguration::Keys loggers_level;
|
||||
config.keys("logger.levels", loggers_level);
|
||||
|
||||
if (!levels.empty())
|
||||
for (const auto & level : levels)
|
||||
logger.root().get(level).setLevel(config.getString("logger.levels." + level, "trace"));
|
||||
if (!loggers_level.empty())
|
||||
{
|
||||
for (const auto & key : loggers_level)
|
||||
{
|
||||
if (key == "logger" || key.starts_with("logger["))
|
||||
{
|
||||
const std::string name(config.getString("logger.levels." + key + ".name"));
|
||||
const std::string level(config.getString("logger.levels." + key + ".level"));
|
||||
logger.root().get(name).setLevel(level);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Legacy syntax
|
||||
const std::string level(config.getString("logger.levels." + key, "trace"));
|
||||
logger.root().get(key).setLevel(level);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Loggers::closeLogs(Poco::Logger & logger)
|
||||
|
@ -11,7 +11,37 @@
|
||||
<size>1000M</size>
|
||||
<count>10</count>
|
||||
<!-- <console>1</console> --> <!-- Default behavior is autodetection (log to console if not daemon mode and is tty) -->
|
||||
|
||||
<!-- Per level overrides (legacy):
|
||||
|
||||
For example to suppress logging of the ConfigReloader you can use:
|
||||
NOTE: levels.logger is reserved, see below.
|
||||
-->
|
||||
<!--
|
||||
<levels>
|
||||
<ConfigReloader>none</ConfigReloader>
|
||||
</levels>
|
||||
-->
|
||||
|
||||
<!-- Per level overrides:
|
||||
|
||||
For example to suppress logging of the RBAC for default user you can use:
|
||||
(But please note that the logger name maybe changed from version to version, even after minor upgrade)
|
||||
-->
|
||||
<!--
|
||||
<levels>
|
||||
<logger>
|
||||
<name>ContextAccess (default)</name>
|
||||
<level>none</level>
|
||||
</logger>
|
||||
<logger>
|
||||
<name>DatabaseOrdinary (test)</name>
|
||||
<level>none</level>
|
||||
</logger>
|
||||
</levels>
|
||||
-->
|
||||
</logger>
|
||||
|
||||
<!--display_name>production</display_name--> <!-- It is the name that will be shown in the client -->
|
||||
<http_port>8123</http_port>
|
||||
<tcp_port>9000</tcp_port>
|
||||
|
Loading…
Reference in New Issue
Block a user