From 0f289e25520176e7990aaf48c6765c59bec09a51 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 28 Mar 2018 05:01:07 -0400 Subject: [PATCH] [calamares]: Improve startup logging - Don't bother with the address of the main thread - Do put a marker on restart into the log file - Do put the Calamares version into the log file (previously, the version was printed through cDebug() before the log file was opened, so it was lost to the on-disk log). --- src/calamares/CalamaresApplication.cpp | 3 --- src/libcalamares/utils/Logger.cpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp index f606bb78b..601f6b388 100644 --- a/src/calamares/CalamaresApplication.cpp +++ b/src/calamares/CalamaresApplication.cpp @@ -65,9 +65,6 @@ CalamaresApplication::CalamaresApplication( int& argc, char* argv[] ) void CalamaresApplication::init() { - cDebug() << "CalamaresApplication thread:" << thread(); - - //TODO: Icon loader Logger::setupLogfile(); setQuitOnLastWindowClosed( false ); diff --git a/src/libcalamares/utils/Logger.cpp b/src/libcalamares/utils/Logger.cpp index fe95ad36b..85a05d22b 100644 --- a/src/libcalamares/utils/Logger.cpp +++ b/src/libcalamares/utils/Logger.cpp @@ -31,6 +31,7 @@ #include #include "utils/CalamaresUtils.h" +#include "CalamaresVersion.h" #define LOGFILE_SIZE 1024 * 256 @@ -145,9 +146,18 @@ setupLogfile() } } + // Since the log isn't open yet, this probably only goes to stdout cDebug() << "Using log file:" << logFile(); + // Lock while (re-)opening the logfile + { + QMutexLocker lock( &s_mutex ); logfile.open( logFile().toLocal8Bit(), std::ios::app ); + if ( logfile.tellp() ) + logfile << "\n\n" << std::endl; + logfile << "=== START CALAMARES " << CALAMARES_VERSION << std::endl; + } + qInstallMessageHandler( CalamaresLogHandler ); }