Where is qDebug q located? By default is qCritical and qFatal log defaults to Qt?

When starting my Qt5 application on linux, I see no way out of qDebug, qWarning, qCritical or qFatal. I know what I can use qInstallMsgHandlerto set up a message handler and view them, but it's pretty heavy.

I just want to check the qWarning log to see if there is any signal that is not connected properly. Is there any way to watch this magazine? Special command line parameter, environment variable?

I think I remember that in the past everything was printed on stderr, is it possible that a change to Qt5?

0
source share
4 answers

, , , qDebug, qWarning, qCritical qFatal . .

Qt . , 5.4 . . .

TL; :

Qt >= 5.4:

  • stderr, QT_LOGGING_TO_CONSOLE 1.
  • stderr, QT_LOGGING_TO_CONSOLE 0 ( ).
  • QT_LOGGING_TO_CONSOLE , , , TTY ( UNIX) ( Windows).

Qt < 5.4, .

  • Qt (, SLOG2, journald, Android- ..),
  • UNIX stderr
  • Windows OutputDebugString stderr , .

-5.4- , f.i. Unix IDE , Qt journald. , journald, IDE. 5.4 .

+10

- .

, , Qt Creator, .

+2

Arch Linux, Qt -journald, systemd ( journalctl).

You can override this behavior by specifying QT_LOGGING_TO_CONSOLE=1as an environment variable.

+2
source

If you are using visual studio, qDebug, etc. printed in the output window in the IDE.

0
source

All Articles