qDebug() doesn't show messages in Qt Creator/Application Output
-
It works after adding
QT_ASSUME_STDERR_HAS_CONSOLE=1in "Projects/Run Settings/Environment".
But I don't know why.https://bbs.archlinux.org/viewtopic.php?id=259035
Log from Qt Creator is redirected to systemd journal.
Maybe Arch Linux maintainers should change some build flag(s) for Qt Creator.I've checked
journalctl, the outputs are there.
It should be the cause of archlinux, not intuitive, and leaves unnecessary footprints. -
https://bbs.archlinux.org/viewtopic.php?id=259035
Log from Qt Creator is redirected to systemd journal.
Maybe Arch Linux maintainers should change some build flag(s) for Qt Creator.I've checked
journalctl, the outputs are there.
It should be the cause of archlinux, not intuitive, and leaves unnecessary footprints. -
J jronald has marked this topic as solved on
-
@jronald
That looks like it to me for Arch, well found! I can only say I always have Qt from Ubuntu repo and it works, you don't need to set an environment variable.@JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:
I can only say I always have Qt from Ubuntu repo and it works, you don't need to set an environment variable.
It's the default behaivor of Qt to output to journelctl on linux, https://doc.qt.io/qt-6/qtlogging.html#qDebug
qDebug(const char *format, ...) Logs debug message format to the central message handler.I think ubuntu has changed this in a good way.
-
@JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:
I can only say I always have Qt from Ubuntu repo and it works, you don't need to set an environment variable.
It's the default behaivor of Qt to output to journelctl on linux, https://doc.qt.io/qt-6/qtlogging.html#qDebug
qDebug(const char *format, ...) Logs debug message format to the central message handler.I think ubuntu has changed this in a good way.
@jronald said in qDebug() doesn't show messages in Qt Creator/Application Output:
It's the default behaivor of Qt to output to journelctl on linux, https://doc.qt.io/qt-6/qtlogging.html#qDebug
I do not see anything at that link or on that page which mentions
journalctlor the systemd journal. I think the "central message handler" in the docs refers to Qt's own QtMessageHandler qInstallMessageHandler(QtMessageHandler handler), which is howqDebug()etc. output their messages. When I Googled for your issue andQT_ASSUME_STDERR_HAS_CONSOLEit came across that this behaviour is specifically in the Arch pre-built. We would come across a lot more questions about this if it applied widely across Linuxes. -
@jronald said in qDebug() doesn't show messages in Qt Creator/Application Output:
It's the default behaivor of Qt to output to journelctl on linux, https://doc.qt.io/qt-6/qtlogging.html#qDebug
I do not see anything at that link or on that page which mentions
journalctlor the systemd journal. I think the "central message handler" in the docs refers to Qt's own QtMessageHandler qInstallMessageHandler(QtMessageHandler handler), which is howqDebug()etc. output their messages. When I Googled for your issue andQT_ASSUME_STDERR_HAS_CONSOLEit came across that this behaviour is specifically in the Arch pre-built. We would come across a lot more questions about this if it applied widely across Linuxes.@JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:
this behaviour is specifically in the Arch pre-built
But the build script is clean: https://gitlab.archlinux.org/archlinux/packaging/packages/qtcreator/-/blob/main/PKGBUILD?ref_type=heads
-
Then for all I know other non-Arch distros compile with
QT_ASSUME_STDERR_HAS_CONSOLE=1. Whatever, if you Google like I did it seems to me this is Arch but not typical Linux distro, that's all I know.FWIW, if you don't wish to recompile Qt itself and you don't wish to have to set environment variable
QT_ASSUME_STDERR_HAS_CONSOLEbefore running to get desired behaviour, be ware you might either:qputenv("QT_ASSUME_STDERR_HAS_CONSOLE", "1")as the very first statement inmain(), beforeQ[Core]Applicationcreation; or- Use
qInstallMessageHandler()to install your own message handler which does write to stderr or similar.
-
-
I have the same issue in Windows 11;
Qt Creator 18.0.0
Qt 6.10.1 (Desktop_Qt_6_10_1_MSVC2022_64bit)I tried the solution of adding:
QT_ASSUME_STDERR_HAS_CONSOLE =1Did so in:
- projects > run settings > environment
- edit > preferences > kits > (default) > environment (both)
Unfortunately, nothing is shown in the application output. Running a completely new project (Qt widget application) with the completely new project settings and only one line added:
qDebug() << "hi!";Any thoughts?
ps. Enabling the "run in terminal" checkbox in projects > run settings does not show me any output either in the terminal.
-
Hi, maybe you have a Visual Studio instance running (behind Qt Creator) that snatches the debug output?
A telltale sign is the text "Cannot retrieve debugging output." in Qt Creator's Application Output.@hskoglund thank you for the suggestion

No process with "visual" in the name according to the task manager.
Nothing in the application output either... -
Just to be sure, could you rebuild Test3 in Release mode (instead of Debug mode) and check that there's no output
@hskoglund said in qDebug() doesn't show messages in Qt Creator/Application Output:
Just to be sure, could you rebuild Test3 in Release mode (instead of Debug mode) and check that there's no output
Unfortunately, no output
-
@MHMart_asc
...And further to @hskoglund's post --- which you should try --- I believe DebugView should still work these days(?), if you download that does your output appear inside it when you run it? Not saying you will have to stick with that, just trying to track down where your messages are going.... -
If you try the same Windows API call that Qt uses; add
#include "windows.h"
and
OutputDebugString(L"Hello there");
does that text show up in the Appliction Output?@hskoglund said in qDebug() doesn't show messages in Qt Creator/Application Output:
If you try the same Windows API call that Qt uses; add
#include "windows.h"
and
OutputDebugString(L"Hello there");
does that text show up in the Appliction Output?Hi @hskoglund , thanks once more for helping. Unfortunately, nope this doesn't show in the application output.
@JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:
@MHMart_asc
...And further to @hskoglund's post --- which you should try --- I believe DebugView should still work these days(?), if you download that does your output appear inside it when you run it? Not saying you will have to stick with that, just trying to track down where your messages are going....Thanks to you as well. Tried this, the debug is not shown there either but I do get this:

-
@hskoglund said in qDebug() doesn't show messages in Qt Creator/Application Output:
If you try the same Windows API call that Qt uses; add
#include "windows.h"
and
OutputDebugString(L"Hello there");
does that text show up in the Appliction Output?Hi @hskoglund , thanks once more for helping. Unfortunately, nope this doesn't show in the application output.
@JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:
@MHMart_asc
...And further to @hskoglund's post --- which you should try --- I believe DebugView should still work these days(?), if you download that does your output appear inside it when you run it? Not saying you will have to stick with that, just trying to track down where your messages are going....Thanks to you as well. Tried this, the debug is not shown there either but I do get this:

@MHMart_asc
Hmm, I don't know what that means/shows, never seen it. Might be because you are running inside debugger/VS? I don't use Windows/MSVC/VS so not sure what is going on....One thing: that message says error in LldbEngine. Now, like I said I am not Windows/MSVC, but what is that doing here? So far as I know lldb is to do with Linux, why is it appearing in your Windows setup?
LLDB is part of the LLVM framework, and was created to work alongside of clang++, which is the LLVM C++ compiler
-
@MHMart_asc
Hmm, I don't know what that means/shows, never seen it. Might be because you are running inside debugger/VS? I don't use Windows/MSVC/VS so not sure what is going on....One thing: that message says error in LldbEngine. Now, like I said I am not Windows/MSVC, but what is that doing here? So far as I know lldb is to do with Linux, why is it appearing in your Windows setup?
LLDB is part of the LLVM framework, and was created to work alongside of clang++, which is the LLVM C++ compiler
@JonB said in qDebug() doesn't show messages in Qt Creator/Application Output:
@MHMart_asc
Hmm, I don't know what that means/shows, never seen it. Might be because you are running inside debugger/VS? I don't use Windows/MSVC/VS so not sure what is going on....One thing: that message says error in LldbEngine. Now, like I said I am not Windows/MSVC, but what is that doing here? So far as I know lldb is to do with Linux, why is it appearing in your Windows setup?
LLDB is part of the LLVM framework, and was created to work alongside of clang++, which is the LLVM C++ compiler
What would your suggestion be for things that I could try to test and repair?