How to hide  console window in QT without affecting the application logging

HPFE455
HPFE455 used Ask the Experts™
on
My QT application is opening and closing  console window ( command prompt) while starting the application.

 I  have hidden the console window by  removing the below  config from the project.pro file.
CONFIG   += console

But this will affecting the application logging.

Environment: QT 4.7.3/ Windows
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
jkr
Top Expert 2012

Commented:
What are you using for logging purposes?

Author

Commented:
qDebug(), qWarning()
Top Expert 2012
Commented:
What about writing to a file then? I.e.

QFile qf("debuglog.txt");
QDebug qd(&qf);

// ...

Open in new window


or alternatively the method described at http://www.developer.nokia.com/Community/Wiki/How_to_redirect_qDebug_output_to_a_file ("How to redirect qDebug output to a file")
qDebug() can print the log in IDE out put tab without having console open, this will be good for your development env but when you deploy your application you have no other choice but to use QFile for logging,
I can think of one more way of showing this data in some of your application window, like you mame a connection when ever you want to print any Qdegug() to one of you slot and write this debug data in some QTextWidget or something and keep this widget hidden unless you dont want to see this

Author

Commented:
Thanks jkr
My logging implementation is similar to the above link. But if  I disable the console,  the
message handler function is not getting called. It never hitting the break point.  The qInstallMsgHandler is implemented in a separate class.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial