This file is an example of how to use the Qt event loop to monitor the Log4cxx configuration file.
#include "config-qt.h"
#include <QCoreApplication>
#include <QVector>
#include <QFileInfo>
#include <QDir>
namespace com { namespace foo {
void ConfigureLogging() {
static struct log4cxx_finalizer {
~log4cxx_finalizer() {
}
} finaliser;
QFileInfo app{QCoreApplication::applicationFilePath()};
QString basename{app.baseName()};
QVector<QString> paths =
{ QString(".")
, app.absoluteDir().absolutePath()
};
QVector<QString> names =
{ QString(basename + ".xml")
, QString(basename + ".properties")
, QString("MyApp.properties")
, QString("log4cxx.xml")
, QString("log4cxx.properties")
, QString("log4j.xml")
, QString("log4j.properties")
};
#if defined(_DEBUG)
#endif
auto selectedPath = QString();
}
auto getLogger(const QString& name) -> LoggerPtr {
return name.isEmpty()
}
auto getLogger(const char* name) -> LoggerPtr {
return name
}
} }
static void configure(const LayoutPtr &layout=LayoutPtr())
Add a ConsoleAppender to the root logger that formats output using layout.
static LoggerPtr getRootLogger()
Retrieve the root logger from the LoggerRepository.
static LoggerPtr getLogger(const std::string &name)
Retrieve the name Logger instance from the LoggerRepository using DefaultLoggerFactory to create it i...
static void shutdown()
Safely close and remove all appenders in all loggers including the root logger.
static void setInternalDebugging(bool enabled)
Use the value of enabled as the new internal debug logging state.
static std::tuple< log4cxx::spi::ConfigurationStatus, QString > configureFromFileAndWatch(const QVector< QString > &directories, const QVector< QString > &filenames)
Configure Log4cxx and watch the file for changes.