adding file channel for request logger

This commit is contained in:
Dario 2019-10-18 12:27:33 +02:00
parent 24f2db475e
commit 781c52ec53

View File

@ -17,6 +17,7 @@
#include "Poco/AsyncChannel.h" #include "Poco/AsyncChannel.h"
#include "Poco/SimpleFileChannel.h" #include "Poco/SimpleFileChannel.h"
#include "Poco/ConsoleChannel.h" #include "Poco/ConsoleChannel.h"
#include "Poco/SplitterChannel.h"
#include "MySQL/Poco/Connector.h" #include "MySQL/Poco/Connector.h"
@ -138,7 +139,13 @@ int Gradido_LoginServer::main(const std::vector<std::string>& args)
// logging for request handling // logging for request handling
Poco::AutoPtr<Poco::ConsoleChannel> requestLogConsoleChannel(new Poco::ConsoleChannel); Poco::AutoPtr<Poco::ConsoleChannel> requestLogConsoleChannel(new Poco::ConsoleChannel);
Poco::AutoPtr<Poco::AsyncChannel> requestLogAsyncChannel(new Poco::AsyncChannel(requestLogConsoleChannel)); Poco::AutoPtr<Poco::SimpleFileChannel> requestLogFileChannel(new Poco::SimpleFileChannel("requestLog.txt"));
Poco::AutoPtr<Poco::SplitterChannel> requestLogSplitter(new Poco::SplitterChannel);
requestLogSplitter->addChannel(requestLogConsoleChannel);
requestLogSplitter->addChannel(requestLogFileChannel);
Poco::AutoPtr<Poco::AsyncChannel> requestLogAsyncChannel(new Poco::AsyncChannel(requestLogSplitter));
Poco::Logger& requestLog = Poco::Logger::get("requestLog"); Poco::Logger& requestLog = Poco::Logger::get("requestLog");
requestLog.setChannel(requestLogAsyncChannel); requestLog.setChannel(requestLogAsyncChannel);
requestLog.setLevel("information"); requestLog.setLevel("information");