mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
Add filter channel to LocalServer.cpp and BaseDaemon.cpp
This commit is contained in:
parent
d5605c55fb
commit
4741c5341d
@ -34,6 +34,7 @@
|
||||
#include <Common/randomSeed.h>
|
||||
#include <Common/ThreadPool.h>
|
||||
#include <Common/CurrentMetrics.h>
|
||||
#include <Loggers/OwnFilteringChannel.h>
|
||||
#include <Loggers/OwnFormattingChannel.h>
|
||||
#include <Loggers/OwnPatternFormatter.h>
|
||||
#include <IO/ReadBufferFromFile.h>
|
||||
@ -611,10 +612,14 @@ void LocalServer::processConfig()
|
||||
|
||||
if (getClientConfiguration().has("server_logs_file"))
|
||||
{
|
||||
std::string pos_pattern = getClientConfiguration().getRawString("logger.message_regexp", "");
|
||||
std::string neg_pattern = getClientConfiguration().getRawString("logger.message_regexp_negative", "");
|
||||
Poco::AutoPtr<OwnFilteringChannel> filter_channel = new OwnFilteringChannel(new Poco::SimpleFileChannel(server_logs_file), nullptr, pos_pattern, neg_pattern);
|
||||
|
||||
auto poco_logs_level = Poco::Logger::parseLevel(level);
|
||||
Poco::Logger::root().setLevel(poco_logs_level);
|
||||
Poco::AutoPtr<OwnPatternFormatter> pf = new OwnPatternFormatter;
|
||||
Poco::AutoPtr<OwnFormattingChannel> log = new OwnFormattingChannel(pf, new Poco::SimpleFileChannel(server_logs_file));
|
||||
Poco::AutoPtr<OwnFormattingChannel> log = new OwnFormattingChannel(pf, filter_channel);
|
||||
Poco::Logger::root().setChannel(log);
|
||||
}
|
||||
else
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include "Loggers/OwnFilteringChannel.h"
|
||||
#pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
|
||||
#include <base/defines.h>
|
||||
@ -625,7 +626,12 @@ void BaseDaemon::setupWatchdog()
|
||||
pf = new OwnJSONPatternFormatter(config());
|
||||
else
|
||||
pf = new OwnPatternFormatter;
|
||||
Poco::AutoPtr<OwnFormattingChannel> log = new OwnFormattingChannel(pf, new Poco::ConsoleChannel(std::cerr));
|
||||
|
||||
// Apply regexp filtering after receiving the formatting channel
|
||||
std::string pos_pattern = config().getRawString("logger.message_regexp", "");
|
||||
std::string neg_pattern = config().getRawString("logger.message_regexp_negative", "");
|
||||
Poco::AutoPtr<OwnFilteringChannel> filter_channel = new OwnFilteringChannel(new Poco::ConsoleChannel(std::cerr), nullptr, pos_pattern, neg_pattern);
|
||||
Poco::AutoPtr<OwnFormattingChannel> log = new OwnFormattingChannel(pf, filter_channel);
|
||||
logger().setChannel(log);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user