void LoggerUtil::configure() { #ifdef HAVE_LOG4CXX LoggerPtr rootLogger = Logger::getRootLogger(); rootLogger->removeAllAppenders(); rootLogger->addAppender(new ConsoleAppender(new PatternLayout("%d [%t] %-5p %c - %m%n"))); #endif }
void Hierarchy::shutdown() { LoggerPtr root = getRootLogger(); // begin by closing nested appenders root->closeNestedAppenders(); LoggerList loggers = getCurrentLoggers(); LoggerList::iterator it, itEnd = loggers.end(); for (it = loggers.begin(); it != itEnd; it++) { LoggerPtr& logger = *it; logger->closeNestedAppenders(); } // then, remove all appenders root->removeAllAppenders(); for (it = loggers.begin(); it != itEnd; it++) { LoggerPtr& logger = *it; logger->removeAllAppenders(); } }