Index: sources/storage/logger.cpp =================================================================== diff -u -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a -rae97f70129df818530bcb70c934c42fa28eb6034 --- sources/storage/logger.cpp (.../logger.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) +++ sources/storage/logger.cpp (.../logger.cpp) (revision ae97f70129df818530bcb70c934c42fa28eb6034) @@ -65,10 +65,13 @@ */ bool Logger::init(QThread &vThread) { + // coco begin validated: Application is not running in multi-threaded mode for testing + // it has been tested and works perfectly fine in normal run. if ( ! init() ) return false; initThread(vThread); return true; } +// coco end /*! * \brief Logger quit @@ -79,6 +82,7 @@ { // coco begin validated: Application termination is not correctly done in coco!!! // it has been tested and works perfectly fine in normal run. + qDebug() << "void Logger::quit()"; quitThread(); } // coco end @@ -112,6 +116,8 @@ */ void Logger::initThread(QThread &vThread) { + // coco begin validated: Application is not running in multi-threaded mode for testing + // it has been tested and works perfectly fine in normal run. // runs in main thread Q_ASSERT_X(QThread::currentThread() == qApp->thread() , __func__, "The Class initialization must be done in Main Thread" ); _thread = &vThread; @@ -120,7 +126,7 @@ _thread->start(); moveToThread(_thread); } - +// coco end /*! * \brief Logger::quitThread * \details Moves this object to main thread to be handled by QApplicaiton @@ -130,7 +136,6 @@ { // coco begin validated: Application termination is not correctly done in coco!!! // it has been tested and works perfectly fine in normal run. - if (! _thread) return; // runs in thread @@ -145,7 +150,10 @@ void Logger::checkLogPath() { setLogBasePath(); // try to use /media/sd_card on device + // coco begin validated: It can only happen if the file system is readonly for any reson. + // it has been tested and works perfectly fine in normal run. if (! setLogPath()) { // check and create log folders & if unsuccessful then + // coco end setLogBasePath(true); // try to use application folder setLogPath ( ); // check and create log folders // Note: it may require to check for write access regarding device setup } @@ -176,9 +184,9 @@ bool Logger::setLogPath() { bool ok = true; - ok = ok && setLogPath(LogType::eLogEvent); - ok = ok && setLogPath(LogType::eLogError); - ok = ok && setLogPath(LogType::eLogDatum); + if ( ! setLogPath(LogType::eLogEvent) ) ok = false; + if ( ! setLogPath(LogType::eLogError) ) ok = false; + if ( ! setLogPath(LogType::eLogDatum) ) ok = false; return ok; } @@ -227,12 +235,17 @@ LOG_ERROR(tr("Incorrect type of logging").arg(vLogType)); } - mContent += _logPrefix[vLogType]; + QString logPrefix = _logPrefix[vLogType]; + if (logPrefix.isEmpty()) logPrefix = _logPrefix[LogType::eLogError]; + mContent += logPrefix; mContent += _prefixSeparator; mContent += QTime::currentTime().toString(_timeFormat); mContent += _timeSeparator + vContent; QString fileName = date + _dateSeparator + Log_File_Name; - _logFileName = _logPathNames[vLogType] + fileName; + QString logPathName = _logPathNames[vLogType]; + if (logPathName.isEmpty()) + logPathName = _logPathNames[LogType::eLogError]; + _logFileName = logPathName + fileName; FileHandler::write(_logFileName, mContent + "\r\n", true); if (vLogType == eLogError) { #ifdef QT_DEBUG