Results 1 to 10 of 10

Thread: Cannot see debug messages in a unix environment

Hybrid View

Previous Post Previous Post   Next Post Next Post
  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 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 15:55.
    Life without passion is death in disguise

  2. #2
    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)

  3. 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, 04:28
  2. Replies: 5
    Last Post: 16th February 2011, 15:16
  3. QFile locks debug environment in QThread
    By nickolais in forum Qt Programming
    Replies: 1
    Last Post: 12th February 2009, 07:20
  4. qt3 to qt4 conversion: debug messages
    By hugo vanwoerkom in forum Qt Programming
    Replies: 3
    Last Post: 15th October 2007, 19:08
  5. Qt4 no debug messages
    By TheKedge in forum Newbie
    Replies: 3
    Last Post: 23rd January 2006, 17: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
  •  
Qt is a trademark of The Qt Company.