diff options
author | Mehdi Fekari <mfekari@rim.com> | 2013-01-28 15:27:02 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-01-28 16:15:16 +0100 |
commit | 37828fb1cc9b33543f5fab5a83f83e231dabc26d (patch) | |
tree | 0b0848915d56c2fe0865090f0da7ae9a48c0fe68 | |
parent | 31b135a4b127855db822cd1bf4fc8bf271ac3611 (diff) | |
download | qt-creator-37828fb1cc9b33543f5fab5a83f83e231dabc26d.tar.gz |
QNX: Fix logs output
Change-Id: I6841638341f80e2f13d14cc49190652be2bf82a0
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
-rw-r--r-- | src/plugins/qnx/blackberryapplicationrunner.cpp | 27 | ||||
-rw-r--r-- | src/plugins/qnx/blackberryapplicationrunner.h | 5 |
2 files changed, 27 insertions, 5 deletions
diff --git a/src/plugins/qnx/blackberryapplicationrunner.cpp b/src/plugins/qnx/blackberryapplicationrunner.cpp index 2f8438821f..8e93e5f37e 100644 --- a/src/plugins/qnx/blackberryapplicationrunner.cpp +++ b/src/plugins/qnx/blackberryapplicationrunner.cpp @@ -93,6 +93,7 @@ BlackBerryApplicationRunner::BlackBerryApplicationRunner(bool debugMode, BlackBe , m_stopProcess(0) , m_tailProcess(0) , m_testSlog2Process(0) + , m_launchDateTimeProcess(0) , m_runningStateTimer(new QTimer(this)) , m_runningStateProcess(0) { @@ -146,8 +147,9 @@ void BlackBerryApplicationRunner::start() void BlackBerryApplicationRunner::checkSlog2Info() { - // Not necessary to retest if slog2info exists. - if (!m_testSlog2Process) { + if (m_testSlog2Process) { + readLaunchTime(); + } else if (!m_testSlog2Process) { m_testSlog2Process = new QSsh::SshRemoteProcessRunner(this); connect(m_testSlog2Process, SIGNAL(processClosed(int)), this, SLOT(handleSlog2InfoFound())); @@ -270,7 +272,11 @@ void BlackBerryApplicationRunner::killTailProcess() void BlackBerryApplicationRunner::tailApplicationLog() { - // TODO: Reading the log using qconn instead? + QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender()); + QTC_ASSERT(process, return); + + m_launchDateTime = QDateTime::fromString(QString::fromLatin1(process->readAllStandardOutput()).trimmed(), + QString::fromLatin1("dd HH:mm:ss")); if (m_stopping || (m_tailProcess && m_tailProcess->isProcessRunning())) return; @@ -290,7 +296,7 @@ void BlackBerryApplicationRunner::tailApplicationLog() QString command; if (m_slog2infoFound) { - command = QString::fromLatin1("slog2info -w"); + command = QString::fromLatin1("slog2info -w -b ") + m_appId; } else { command = QLatin1String("tail -c +1 -f /accounts/1000/appdata/") + m_appId + QLatin1String("/logs/log"); @@ -308,6 +314,15 @@ void BlackBerryApplicationRunner::handleSlog2InfoFound() tailApplicationLog(); } +void BlackBerryApplicationRunner::readLaunchTime() +{ + m_launchDateTimeProcess = new QSsh::SshRemoteProcessRunner(this); + connect(m_launchDateTimeProcess, SIGNAL(processClosed(int)), + this, SLOT(tailApplicationLog())); + + m_launchDateTimeProcess->run("date +\"%d %H:%M:%S\"", m_sshParams); +} + void BlackBerryApplicationRunner::handleTailOutput() { QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender()); @@ -317,7 +332,9 @@ void BlackBerryApplicationRunner::handleTailOutput() if (m_slog2infoFound) { const QStringList multiLine = message.split(QLatin1Char('\n')); Q_FOREACH (const QString &line, multiLine) { - if ( line.contains(m_appId) ) { + QDateTime dateTime = QDateTime::fromString(line.split(m_appId).first().mid(4).trimmed(), + QString::fromLatin1("dd HH:mm:ss.zzz")); + if (dateTime >= m_launchDateTime) { QStringList validLineBeginnings; validLineBeginnings << QLatin1String("qt-msg 0 ") << QLatin1String("qt-msg* 0 ") diff --git a/src/plugins/qnx/blackberryapplicationrunner.h b/src/plugins/qnx/blackberryapplicationrunner.h index 2993eb09f3..dff0a67aaa 100644 --- a/src/plugins/qnx/blackberryapplicationrunner.h +++ b/src/plugins/qnx/blackberryapplicationrunner.h @@ -39,6 +39,7 @@ #include <QObject> #include <QProcess> +#include <QDateTime> namespace QSsh { class SshRemoteProcessRunner; @@ -89,6 +90,7 @@ private slots: void readRunningStateStandardOutput(); void handleSlog2InfoFound(); + void readLaunchTime(); private: void reset(); @@ -97,6 +99,8 @@ private: bool m_debugMode; bool m_slog2infoFound; + QDateTime m_launchDateTime; + qint64 m_pid; QString m_appId; @@ -114,6 +118,7 @@ private: QProcess *m_stopProcess; QSsh::SshRemoteProcessRunner *m_tailProcess; QSsh::SshRemoteProcessRunner *m_testSlog2Process; + QSsh::SshRemoteProcessRunner *m_launchDateTimeProcess; QTimer *m_runningStateTimer; QProcess *m_runningStateProcess; }; |