parent
34e33f4aa6
commit
b4326788d7
|
@ -37,7 +37,7 @@ ELSE()
|
|||
ENDIF()
|
||||
|
||||
|
||||
PROJECT(AusweisApp2 VERSION 1.16.0 LANGUAGES ${LANGUAGES})
|
||||
PROJECT(AusweisApp2 VERSION 1.16.1 LANGUAGES ${LANGUAGES})
|
||||
|
||||
# Set TWEAK if not defined in PROJECT_VERSION above to
|
||||
# have a valid tweak version without propagating it
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
AusweisApp2 1.16.1
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
**Releasedatum:** 21. Dezember 2018
|
||||
|
||||
|
||||
|
||||
Anwender
|
||||
""""""""
|
||||
- Deaktivieren der automatischen Bereinigung von alten Log-Dateien, da
|
||||
diese in 1.16.0 zu einem Programmabsturz führen kann.
|
||||
|
||||
|
||||
Entwickler
|
||||
""""""""""
|
|
@ -4,6 +4,7 @@ Release Notes
|
|||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
1.16.1
|
||||
1.16.0
|
||||
announce
|
||||
issues
|
||||
|
|
|
@ -6,6 +6,7 @@ Versionszweig 1.16
|
|||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
1.16.1
|
||||
1.16.0
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ def j = new Review
|
|||
name: 'FreeBSD',
|
||||
libraries: ['FreeBSD'],
|
||||
label: 'FreeBSD',
|
||||
artifacts: 'tmp/*.log',
|
||||
artifacts: 'tmp/AusweisApp2.*.log',
|
||||
allowEmptyArtifacts: true,
|
||||
xunit: true,
|
||||
).generate(this)
|
||||
|
|
|
@ -7,7 +7,7 @@ def j = new Review
|
|||
name: 'Linux',
|
||||
libraries: ['Linux'],
|
||||
label: 'Linux',
|
||||
artifacts: 'tmp/*.log',
|
||||
artifacts: 'tmp/AusweisApp2.*.log',
|
||||
allowEmptyArtifacts: true,
|
||||
xunit: true,
|
||||
jobType: JobType.Matrix
|
||||
|
|
|
@ -6,7 +6,7 @@ def j = new Review
|
|||
name: 'MacOS',
|
||||
libraries: ['MacOS'],
|
||||
label: 'MacOS',
|
||||
artifacts: 'tmp/*.log',
|
||||
artifacts: 'tmp/AusweisApp2.*.log',
|
||||
allowEmptyArtifacts: true,
|
||||
xunit: true
|
||||
).generate(this)
|
||||
|
|
|
@ -6,7 +6,7 @@ def j = new Review
|
|||
name: 'Win32_GNU',
|
||||
libraries: ['Win32_GNU'],
|
||||
label: 'Windows',
|
||||
artifacts: 'tmp/*.log',
|
||||
artifacts: 'tmp/AusweisApp2.*.log',
|
||||
allowEmptyArtifacts: true,
|
||||
xunit: true
|
||||
).generate(this)
|
||||
|
|
|
@ -5,7 +5,7 @@ def j = new Review
|
|||
name: 'Win32_MSVC',
|
||||
libraries: ['Win32_MSVC_dev'],
|
||||
label: 'MSVC',
|
||||
artifacts: 'tmp/*.log',
|
||||
artifacts: 'tmp/AusweisApp2.*.log',
|
||||
allowEmptyArtifacts: true,
|
||||
xunit: true
|
||||
).generate(this)
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
#include "BreakPropertyBindingDiagnosticLogFilter.h"
|
||||
#include "SingletonHelper.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace governikus;
|
||||
|
||||
|
@ -28,7 +26,8 @@ LogHandler::LogHandler()
|
|||
, mBacklogPosition(0)
|
||||
, mMessagePattern(QStringLiteral("%{category} %{time yyyy.MM.dd hh:mm:ss.zzz} %{if-debug} %{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif} %{function}(%{file}:%{line}) %{message}"))
|
||||
, mDefaultMessagePattern(QStringLiteral("%{if-category}%{category}: %{endif}%{message}")) // as defined in qlogging.cpp
|
||||
, mLogFile(getLogFileTemplate())
|
||||
, mLogFileTemplate(QDir::tempPath() + QStringLiteral("/AusweisApp2.XXXXXX.log")) // if you change value you need to adjust getOtherLogfiles()
|
||||
, mLogFile(mLogFileTemplate)
|
||||
, mHandler(nullptr)
|
||||
, mFilePrefix("/src/")
|
||||
, mMutex()
|
||||
|
@ -51,13 +50,6 @@ LogHandler& LogHandler::getInstance()
|
|||
}
|
||||
|
||||
|
||||
QString LogHandler::getLogFileTemplate()
|
||||
{
|
||||
// if you change value you need to adjust getOtherLogfiles()
|
||||
return QDir::tempPath() % QLatin1Char('/') % QCoreApplication::applicationName() % QStringLiteral(".XXXXXX.log");
|
||||
}
|
||||
|
||||
|
||||
void LogHandler::reset()
|
||||
{
|
||||
const QMutexLocker mutexLocker(&mMutex);
|
||||
|
@ -79,7 +71,6 @@ void LogHandler::init()
|
|||
mLogFile.open();
|
||||
}
|
||||
mHandler = qInstallMessageHandler(&LogHandler::messageHandler);
|
||||
removeOldLogfiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,7 +287,7 @@ QFileInfoList LogHandler::getOtherLogfiles() const
|
|||
QDir tmpPath = QDir::temp();
|
||||
tmpPath.setSorting(QDir::Time);
|
||||
tmpPath.setFilter(QDir::Files);
|
||||
tmpPath.setNameFilters(QStringList({QCoreApplication::applicationName() + QStringLiteral(".*.log")}));
|
||||
tmpPath.setNameFilters(QStringList({QStringLiteral("AusweisApp2.*.log")}));
|
||||
|
||||
QFileInfoList list = tmpPath.entryInfoList();
|
||||
list.removeAll(mLogFile);
|
||||
|
@ -305,20 +296,6 @@ QFileInfoList LogHandler::getOtherLogfiles() const
|
|||
}
|
||||
|
||||
|
||||
void LogHandler::removeOldLogfiles()
|
||||
{
|
||||
const auto& threshold = QDateTime::currentDateTime().addDays(-14);
|
||||
const QFileInfoList& logfileInfos = getOtherLogfiles();
|
||||
for (const QFileInfo& entry : logfileInfos)
|
||||
{
|
||||
if (entry.fileTime(QFileDevice::FileModificationTime) < threshold)
|
||||
{
|
||||
qDebug() << "Auto-remove old log file:" << entry.absoluteFilePath() << '|' << QFile::remove(entry.absoluteFilePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool LogHandler::removeOtherLogfiles()
|
||||
{
|
||||
const auto otherLogFiles = getOtherLogfiles();
|
||||
|
@ -339,7 +316,7 @@ void LogHandler::setLogfile(bool pEnable)
|
|||
{
|
||||
if (!mLogFile.isOpen())
|
||||
{
|
||||
mLogFile.setFileTemplate(getLogFileTemplate());
|
||||
mLogFile.setFileTemplate(mLogFileTemplate);
|
||||
mLogFile.open();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,12 +33,11 @@ class LogHandler
|
|||
friend class ::test_LogHandler;
|
||||
|
||||
private:
|
||||
static QString getLogFileTemplate();
|
||||
|
||||
const bool mEnvPattern;
|
||||
const int mFunctionFilenameSize;
|
||||
qint64 mBacklogPosition;
|
||||
const QString mMessagePattern, mDefaultMessagePattern;
|
||||
const QString mLogFileTemplate;
|
||||
QTemporaryFile mLogFile;
|
||||
QtMessageHandler mHandler;
|
||||
const QByteArray mFilePrefix;
|
||||
|
@ -52,7 +51,6 @@ class LogHandler
|
|||
|
||||
QString getPaddedLogMsg(const QMessageLogContext& pContext, const QString& pMsg);
|
||||
void handleMessage(QtMsgType pType, const QMessageLogContext& pContext, const QString& pMsg);
|
||||
void removeOldLogfiles();
|
||||
|
||||
static void messageHandler(QtMsgType pType, const QMessageLogContext& pContext, const QString& pMsg);
|
||||
friend QDebug operator<<(QDebug, const LogHandler&);
|
||||
|
|
|
@ -8,12 +8,6 @@
|
|||
|
||||
#include <QtTest>
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <utime.h>
|
||||
#endif
|
||||
|
||||
using namespace governikus;
|
||||
|
||||
class test_LogHandler
|
||||
|
@ -21,26 +15,6 @@ class test_LogHandler
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
void fakeLastModifiedAndLastAccessTime(const QString& pPath)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
Q_UNUSED(pPath);
|
||||
#else
|
||||
struct timeval tv[2];
|
||||
|
||||
struct timeval& accessTime = tv[0];
|
||||
gettimeofday(&accessTime, nullptr);
|
||||
|
||||
struct timeval& modifyTime = tv[1];
|
||||
gettimeofday(&modifyTime, nullptr);
|
||||
|
||||
time_t fiveteenDays = 60 * 60 * 24 * 15;
|
||||
modifyTime.tv_sec -= fiveteenDays;
|
||||
utimes(pPath.toLatin1().constData(), tv);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase()
|
||||
{
|
||||
|
@ -194,32 +168,6 @@ class test_LogHandler
|
|||
}
|
||||
|
||||
|
||||
void removeUpOldLogfiles()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QSKIP("File time stamp mocking unimplemented on windows");
|
||||
#endif
|
||||
|
||||
const auto& logger = Env::getSingleton<LogHandler>();
|
||||
|
||||
const auto& initialFiles = logger->getOtherLogfiles();
|
||||
QTemporaryFile tmp(LogHandler::getLogFileTemplate());
|
||||
QVERIFY(tmp.open());
|
||||
tmp.fileName(); // touch it
|
||||
const auto& filesWithMock = logger->getOtherLogfiles();
|
||||
QVERIFY(filesWithMock.size() > initialFiles.size());
|
||||
|
||||
logger->removeOldLogfiles();
|
||||
QVERIFY(tmp.exists());
|
||||
QCOMPARE(filesWithMock.size(), logger->getOtherLogfiles().size());
|
||||
|
||||
fakeLastModifiedAndLastAccessTime(tmp.fileName());
|
||||
logger->removeOldLogfiles();
|
||||
QCOMPARE(initialFiles.size(), logger->getOtherLogfiles().size());
|
||||
QVERIFY(!tmp.exists());
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
QTEST_GUILESS_MAIN(test_LogHandler)
|
||||
|
|
Loading…
Reference in New Issue