This commit is contained in:
kssenii 2022-03-29 13:33:17 +02:00
parent a1a4552740
commit 95565b45d6

View File

@ -455,16 +455,13 @@ void LocalServer::processConfig()
auto logging = (config().has("logger.console")
|| config().has("logger.level")
|| config().has("log-level")
|| config().has("send_logs_level")
|| config().has("logger.log"));
auto file_logging = config().has("server_logs_file");
if (is_interactive && logging && !file_logging)
throw Exception("For interactive mode logging is allowed only with --server_logs_file option",
ErrorCodes::BAD_ARGUMENTS);
auto level = Poco::Logger::parseLevel(config().getString("log-level", config().getString("send_logs_level", "trace")));
if (file_logging)
if (config().has("server_logs_file"))
{
auto level = Poco::Logger::parseLevel(config().getString("log-level", "trace"));
Poco::Logger::root().setLevel(level);
Poco::Logger::root().setChannel(Poco::AutoPtr<Poco::SimpleFileChannel>(new Poco::SimpleFileChannel(server_logs_file)));
}
@ -472,6 +469,7 @@ void LocalServer::processConfig()
{
// force enable logging
config().setString("logger", "logger");
Poco::Logger::root().setLevel(level);
// sensitive data rules are not used here
buildLoggers(config(), logger(), "clickhouse-local");
}
@ -712,6 +710,8 @@ void LocalServer::processOptions(const OptionsDescription &, const CommandLineOp
config().setString("logger.log", options["logger.log"].as<std::string>());
if (options.count("logger.level"))
config().setString("logger.level", options["logger.level"].as<std::string>());
if (options.count("send_logs_level"))
config().setString("send_logs_level", options["send_logs_level"].as<std::string>());
}
}