Change-Id: I83d64f1b0071517d06d2b24e8a6c0ef48a720435
static void mymsghandler(QtMsgType,const QMessageLogContext&, const QString&msg)
{
if(mylogFile){
- QByteArray data=
- QDateTime::currentDateTime().toString("yyyy-MM-dd hh.mm.ss.zzz").toLatin1() +" "+
- msg.toLatin1()+"\n";
+ QByteArray data;
+ //QDateTime::toString requires an active app object, otherwise it crashes
+ if(qApp)
+ data=QDateTime::currentDateTime().toString("yyyy-MM-dd hh.mm.ss.zzz").toLatin1() +" ";
+ data+=msg.toLatin1()+"\n";
mylogFile->write(data);
mylogFile->flush();
}