Results 1 to 10 of 10

Thread: Cannot see debug messages in a unix environment

  1. #1
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Cannot see debug messages in a unix environment

    Hey all,

    I'm using Qt creator 3.3.1 under linux with Qt 5.4.1. I had been using an earlier version of Qt creator for quite a while with no issues, but I took a long break and when I came back, I updated my environment (creator updated to 3.3.1, Qt updated from 5.3.x to 5.4.1). Under this environment, all messages routed through qDebug(), qWarning, and qFatal() are not shown in the application output tab, where they had worked fine earlier. I see lots of messages about this problem being limited to Windows and to install some Windows debugging tools, but I'm not in a Windows environment. This is really slowing down my development, as I use these messages to track the state of my applications for debugging purposes (both with and without the debugger). How is everyone else working around this issue?
    Life without passion is death in disguise

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cannot see debug messages in a unix environment

    There is no such issue for everyone else
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2012
    Posts
    10
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Cannot see debug messages in a unix environment

    This might be a stupid question but are you absolutely certain no other instances of Creator are running in the background (perhaps stuck)? Use ps to be sure.

    Do you see anything in the console at all when you run your program? What about the initial "Starting" message when you run?

  4. #4
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Cannot see debug messages in a unix environment

    Quote Originally Posted by JasonC View Post
    This might be a stupid question but are you absolutely certain no other instances of Creator are running in the background (perhaps stuck)? Use ps to be sure.

    Do you see anything in the console at all when you run your program? What about the initial "Starting" message when you run?
    I don't have any other instances running. I only get the following in the "Application Output" tab when running my application:
    Qt Code:
    1. Starting /home/rich/build/evilrpg/src/client/evilrpg...
    2. /home/rich/build/evilrpg/src/client/evilrpg exited with code 0
    To copy to clipboard, switch view to plain text mode 
    If I manually run the app in a console, I get all my debug messages.
    Life without passion is death in disguise

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cannot see debug messages in a unix environment

    Does your program actually do what it is supposed to? It looks like it just exits.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Feb 2012
    Posts
    10
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Cannot see debug messages in a unix environment

    Try creating a new project that does nothing but print a debug message. If it works then you can narrow it down to something specific to your evilrpg program. If it doesn't work at least you'll have a minimal test case to work from.

  7. #7
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Cannot see debug messages in a unix environment

    Does your program require any command line arguments to run and if so, are you passing those on the Project->Run settings for your project?

  8. #8
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cannot see debug messages in a unix environment

    One reason I can think of is that the new Qt detected your system is using journald for logging and directed the output there.
    You can force logging to the console by setting QT_LOGGING_TO_CONSOLE=1, e.g. in the project's run environment.

    Cheers,
    _

  9. The following user says thank you to anda_skoa for this useful post:

    KShots (6th March 2015)

  10. #9
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Cannot see debug messages in a unix environment

    Quote Originally Posted by wysota View Post
    Does your program actually do what it is supposed to? It looks like it just exits.
    Yeah, it does. It spawns a gui, connects to a remote server, and if I run it in a console, it tells me all about the various stages it's going through with the network traffic. When run in Qt-Creator, the above is all I get (with the application itself running).


    Added after 4 minutes:


    Quote Originally Posted by anda_skoa View Post
    One reason I can think of is that the new Qt detected your system is using journald for logging and directed the output there.
    You can force logging to the console by setting QT_LOGGING_TO_CONSOLE=1, e.g. in the project's run environment.

    Cheers,
    _
    I had almost forgotten about that. I built it from the gentoo ebuild, which may or may not have redirected the log to journald (I do run systemd). That appears to have resolved it, though. Thanks!

    [EDIT]

    I'm rather confused why this worked. Why am I getting output in my consoles without the environment variable? I was under the impression that nothing would hit stdout/stderr if journald was used, yet I have messages in my console. Am I misunderstanding how the journald interface works?
    Last edited by KShots; 6th March 2015 at 16:55.
    Life without passion is death in disguise

  11. #10
    Join Date
    Feb 2012
    Posts
    10
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Cannot see debug messages in a unix environment

    Quote Originally Posted by KShots View Post
    I'm rather confused why this worked. Why am I getting output in my consoles without the environment variable? I was under the impression that nothing would hit stdout/stderr if journald was used, yet I have messages in my console. Am I misunderstanding how the journald interface works?
    When QT_LOGGING_TO_CONSOLE is not specified, Qt essentially tries to guess if you're running in a terminal or not to determine where to send the logs. Terminal = stderr, anything else = whatever your Qt installation is configured to support (e.g. journald).

    Afaict, this behavior was introduced in Qt 5.4. See https://codereview.qt-project.org/#/c/89357/, in particular:

    This commit adds logic similar to Windows's: if the application has a controlling TTY, we'll use stderr. Otherwise, we'll use the system log. This is technically a change in behavior: previously, we would always use the system log, unless the environment variable told us not to.
    The environment variable can always be specified to force one or the other, but if it's not specified, a choice is made automatically.

    For more information see:
    http://lists.qt-project.org/pipermai...ly/017588.html (discussion with some rationale for above change)
    http://stackoverflow.com/questions/2...-default-on-qt (a mostly good summary)

  12. The following user says thank you to JasonC for this useful post:

    KShots (12th March 2015)

Similar Threads

  1. Remote Debugging Debug Build in Production Environment
    By brogrammer in forum Installation and Deployment
    Replies: 0
    Last Post: 6th September 2014, 05:28
  2. Replies: 5
    Last Post: 16th February 2011, 16:16
  3. QFile locks debug environment in QThread
    By nickolais in forum Qt Programming
    Replies: 1
    Last Post: 12th February 2009, 08:20
  4. qt3 to qt4 conversion: debug messages
    By hugo vanwoerkom in forum Qt Programming
    Replies: 3
    Last Post: 15th October 2007, 20:08
  5. Qt4 no debug messages
    By TheKedge in forum Newbie
    Replies: 3
    Last Post: 23rd January 2006, 18:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.