mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Daemon: added formatting for console logger.
This commit is contained in:
parent
fb1e8d8b75
commit
e673533a0b
@ -108,6 +108,7 @@ void Daemon::reloadConfiguration()
|
||||
void Daemon::buildLoggers()
|
||||
{
|
||||
Poco::ScopedRWLock lock(*this);
|
||||
std::string format("%Y.%m.%d %H:%M:%S [ %I ] <%p> %s: %t");
|
||||
|
||||
try
|
||||
{
|
||||
@ -120,9 +121,6 @@ void Daemon::buildLoggers()
|
||||
// splitter
|
||||
SplitterChannel *split = new SplitterChannel();
|
||||
|
||||
// format
|
||||
std::string format("%Y.%m.%d %H:%M:%S [ %I ] <%p> %s: %t");
|
||||
|
||||
// set up two channel chains
|
||||
PatternFormatter *pf = new PatternFormatter(format);
|
||||
pf->setProperty("times", "local");
|
||||
@ -163,8 +161,13 @@ void Daemon::buildLoggers()
|
||||
{
|
||||
// Выводим на консоль
|
||||
ConsoleChannel * file = new ConsoleChannel();
|
||||
PatternFormatter * pf = new PatternFormatter(format);
|
||||
pf->setProperty("times", "local");
|
||||
FormattingChannel * log = new FormattingChannel(pf);
|
||||
log->setChannel(file);
|
||||
|
||||
logger().close();
|
||||
logger().setChannel( file );
|
||||
logger().setChannel(log);
|
||||
logger().warning("Logging to console");
|
||||
}
|
||||
}
|
||||
@ -172,8 +175,13 @@ void Daemon::buildLoggers()
|
||||
{
|
||||
// Выводим на консоль
|
||||
ConsoleChannel * file = new ConsoleChannel();
|
||||
PatternFormatter * pf = new PatternFormatter(format);
|
||||
pf->setProperty("times", "local");
|
||||
FormattingChannel * log = new FormattingChannel(pf);
|
||||
log->setChannel(file);
|
||||
|
||||
logger().close();
|
||||
logger().setChannel( file );
|
||||
logger().setChannel(log);
|
||||
logger().warning("Can't log to file. Logging to console");
|
||||
throw;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user