This file is a simplified example of encapsulated Log4cxx configuration.
#include "com/foo/config.h"
namespace com { namespace foo {
auto getLogger(
const std::string& name) ->
LoggerPtr {
static struct log4cxx_initializer {
log4cxx_initializer() {
BasicConfigurator::configure();
}
~log4cxx_initializer() {
LogManager::shutdown();
}
} initAndShutdown;
return name.empty()
? LogManager::getRootLogger()
: LogManager::getLogger(name);
}
} }
Definition: appender.h:27
std::shared_ptr< Logger > LoggerPtr
Definition: defaultloggerfactory.h:26