@@ -430,6 +430,9 @@ APP_EXPORT
430
430
#endif
431
431
int main ( int argc, char *argv[] )
432
432
{
433
+ // log messages written before creating QgsApplication
434
+ QStringList preApplicationLogMessages;
435
+
433
436
#ifdef Q_OS_MACX
434
437
// Increase file resource limits (i.e., number of allowed open files)
435
438
// (from code provided by Larry Biehl, Purdue University, USA, from 'MultiSpec' project)
@@ -866,11 +869,11 @@ int main( int argc, char *argv[] )
866
869
{
867
870
if ( !QgsSettings::setGlobalSettingsPath ( globalsettingsfile ) )
868
871
{
869
- QgsMessageLog::logMessage ( QObject::tr ( " Invalid globalsettingsfile path: %1" ).arg ( globalsettingsfile ), QStringLiteral ( " QGIS" ) );
872
+ preApplicationLogMessages << QObject::tr ( " Invalid globalsettingsfile path: %1" ).arg ( globalsettingsfile ), QStringLiteral ( " QGIS" );
870
873
}
871
874
else
872
875
{
873
- QgsMessageLog::logMessage ( QObject::tr ( " Successfully loaded globalsettingsfile path: %1" ).arg ( globalsettingsfile ), QStringLiteral ( " QGIS" ) );
876
+ preApplicationLogMessages << QObject::tr ( " Successfully loaded globalsettingsfile path: %1" ).arg ( globalsettingsfile ), QStringLiteral ( " QGIS" );
874
877
}
875
878
}
876
879
@@ -970,6 +973,10 @@ int main( int argc, char *argv[] )
970
973
971
974
QgsApplication myApp ( argc, argv, myUseGuiFlag );
972
975
976
+ // write the log messages written before creating QgsApplication
977
+ for ( const QString &preApplicationLogMessage : qgis::as_const ( preApplicationLogMessages ) )
978
+ QgsMessageLog::logMessage ( preApplicationLogMessage );
979
+
973
980
// Settings migration is only supported on the default profile for now.
974
981
if ( profileName == QLatin1String ( " default" ) )
975
982
{
0 commit comments