mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Ability to set logger level for loggers that have non allowed in xml tags symbols
This commit is contained in:
parent
9ff0aaac9c
commit
f767309574
@ -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)
|
||||
|
@ -12,15 +12,34 @@
|
||||
<count>10</count>
|
||||
<!-- <console>1</console> --> <!-- Default behavior is autodetection (log to console if not daemon mode and is tty) -->
|
||||
|
||||
<!-- Per level overrides:
|
||||
<!-- 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 -->
|
||||
|
Loading…
Reference in New Issue
Block a user