in src/main/cpp/defaultconfigurator.cpp [51:128]
void DefaultConfigurator::configure(LoggerRepositoryPtr repository)
{
repository->setConfigured(true);
const LogString configuratorClassName(getConfiguratorClass());
LogString configurationFileName = DefaultConfiguratorPath;
if (configurationFileName.empty())
configurationFileName = getConfigurationFileName();
Pool pool;
File configuration;
if (configurationFileName.empty())
{
LogString names[4] =
{ LOG4CXX_STR("log4cxx.xml")
, LOG4CXX_STR("log4cxx.properties")
, LOG4CXX_STR("log4j.xml")
, LOG4CXX_STR("log4j.properties")
};
for (int i = 0; i < 4; i++)
{
File candidate(names[i]);
if (LogLog::isDebugEnabled())
{
LogString debugMsg = LOG4CXX_STR("Checking file ");
debugMsg.append(names[i]);
LogLog::debug(debugMsg);
}
if (candidate.exists(pool))
{
configuration = candidate;
break;
}
}
}
else
{
configuration.setPath(configurationFileName);
}
if (configuration.exists(pool))
{
if (LogLog::isDebugEnabled())
{
LogString msg(LOG4CXX_STR("Using configuration file ["));
msg += configuration.getPath();
msg += LOG4CXX_STR("] for automatic log4cxx configuration");
LogLog::debug(msg);
}
LoggerRepositoryPtr repo(repository);
OptionConverter::selectAndConfigure(
configuration,
configuratorClassName,
repo,
0 < DefaultConfiguratorWatchSeconds
? DefaultConfiguratorWatchSeconds * MillisecondsPerSecond
: getConfigurationWatchDelay()
);
}
else if (LogLog::isDebugEnabled())
{
if (configurationFileName.empty())
{
LogLog::debug(LOG4CXX_STR("Could not find default configuration file."));
}
else
{
LogString msg(LOG4CXX_STR("Could not find configuration file: ["));
msg += configurationFileName;
msg += LOG4CXX_STR("].");
LogLog::debug(msg);
}
}
}