Ignore text_log for Keeper

This commit is contained in:
Antonio Andelic 2024-05-22 13:18:51 +02:00
parent 9b9f37a4f1
commit 5c47b09114
6 changed files with 17 additions and 6 deletions

View File

@ -182,6 +182,11 @@ std::string Keeper::getDefaultConfigFileName() const
return "keeper_config.xml";
}
bool Keeper::allowTextLog() const
{
return false;
}
void Keeper::handleCustomArguments(const std::string & arg, [[maybe_unused]] const std::string & value) // NOLINT
{
if (arg == "force-recovery")

View File

@ -65,6 +65,8 @@ protected:
std::string getDefaultConfigFileName() const override;
bool allowTextLog() const override;
private:
Poco::Net::SocketAddress socketBindListen(Poco::Net::ServerSocket & socket, const std::string & host, UInt16 port, [[maybe_unused]] bool secure = false) const;

View File

@ -263,7 +263,7 @@ void Loggers::buildLoggers(Poco::Util::AbstractConfiguration & config, Poco::Log
}
}
#ifndef WITHOUT_TEXT_LOG
if (config.has("text_log"))
if (allowTextLog() && config.has("text_log"))
{
String text_log_level_str = config.getString("text_log.level", "trace");
int text_log_level = Poco::Logger::parseLevel(text_log_level_str);

View File

@ -23,6 +23,10 @@ public:
/// Close log files. On next log write files will be reopened.
void closeLogs(Poco::Logger & logger);
virtual ~Loggers() = default;
protected:
virtual bool allowTextLog() const { return true; }
private:
Poco::AutoPtr<Poco::FileChannel> log_file;

View File

@ -107,6 +107,10 @@ void OwnSplitChannel::logSplit(const Poco::Message & msg)
[[maybe_unused]] bool push_result = logs_queue->emplace(std::move(columns));
}
auto text_log_locked = text_log.lock();
if (!text_log_locked)
return;
/// Also log to system.text_log table, if message is not too noisy
auto text_log_max_priority_loaded = text_log_max_priority.load(std::memory_order_relaxed);
if (text_log_max_priority_loaded && msg.getPriority() <= text_log_max_priority_loaded)
@ -146,10 +150,7 @@ void OwnSplitChannel::logSplit(const Poco::Message & msg)
#undef SET_VALUE_IF_EXISTS
std::shared_ptr<SystemLogQueue<TextLogElement>> text_log_locked{};
text_log_locked = text_log.lock();
if (text_log_locked)
text_log_locked->push(std::move(elem));
text_log_locked->push(std::move(elem));
}
#endif
}

View File

@ -1,7 +1,6 @@
#pragma once
#include <atomic>
#include <vector>
#include <map>
#include <Poco/AutoPtr.h>
#include <Poco/Channel.h>