summaryrefslogtreecommitdiff
path: root/daemon/daemon.cpp
diff options
context:
space:
mode:
authorTomasz Sterna <tomek@xiaoka.com>2014-12-12 20:57:07 +0100
committerTomasz Sterna <tomek@xiaoka.com>2014-12-12 20:57:07 +0100
commit80cf5c3c0b779c869e61dca0da9eec18b962c8ce (patch)
treeafaccaf434d4bab5d4941103ec3dce662292010b /daemon/daemon.cpp
parent8e8c5da2d50ce71bd795803154636e0b6d30912b (diff)
Replaced Log4Qt with Qt 5.2+ QLoggingCategory
Diffstat (limited to 'daemon/daemon.cpp')
-rw-r--r--daemon/daemon.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp
index 9d89980..69bcbe6 100644
--- a/daemon/daemon.cpp
+++ b/daemon/daemon.cpp
@@ -34,8 +34,7 @@
#include <QFile>
#include <QDir>
#include <QFileInfo>
-#include <Log4Qt/LogManager>
-#include <Log4Qt/PropertyConfigurator>
+#include <QLoggingCategory>
void signalhandler(int sig)
{
@@ -49,33 +48,16 @@ void signalhandler(int sig)
}
}
-void initLogging()
-{
- // Sailfish OS-specific locations for the app settings files and app's own files
- const QString logConfigFilePath(QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).at(0)
- + "pebble/log4qt.conf");
- const QString fallbackLogConfigPath("/usr/share/pebble/log4qt.conf");
-
- const QString& usedConfigFile = QFile::exists(logConfigFilePath) ? logConfigFilePath : fallbackLogConfigPath;
- Log4Qt::PropertyConfigurator::configure(usedConfigFile);
-
- // For capturing qDebug() and console.log() messages
- // Note that console.log() might fail in Sailfish OS device builds. Not sure why, but it seems like
- // console.log() exactly in Sailfish OS device release builds doesn't go through the same qDebug() channel
- Log4Qt::LogManager::setHandleQtMessages(true);
-
- qDebug() << "Using following log config file:" << usedConfigFile;
-}
-
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
- // Init logging should be called after app object creation as initLogging() will examine
- // QCoreApplication for determining the .conf files locations
- initLogging();
+ // Init logging should be called after app object creation
+ QLoggingCategory::setFilterRules("*.debug=false\n"
+ "fc.io.debug=true");
- Log4Qt::Logger::logger(QLatin1String("Main Logger"))->info() << argv[0] << APP_VERSION;
+ QLoggingCategory l("main");
+ qCDebug(l) << argv[0] << APP_VERSION;
Settings settings;
watch::WatchConnector watch;