Important: Please read the Qt Code of Conduct -

Is it ok to leave the debugging messages once a program is ready to be released

  • Hi,

    Is it ok to leave the debugging messages in your final program or they need to be deleted once the programs is released for distribution?

    What do you guys do?

    Does leaving the debugging messages causes any issues?

    I usually delete them but I want to hear from the experts because if this doesn't have any impact on the performance I would rather leave them.


  • Lifetime Qt Champion


    You seem to have a copy/paste issue…

    It all depends on the messages. Messages that are only there to debug/understand what the code does should be removed (even before release). However you can have other class of messages that can show misbehavior/exceptional conditions/failures etc… You should keep them maybe even offer the possibility to log them so users can send you the logs/reports when your application is crashing.

  • If you log the debug messages with qDebug() << xy you can avoid the logging by defining "QT_NO_DEBUG_OUTPUT" in your project file for the Release build.
    I think that the Define will avoid the actual compilation of the qDebug calls and therefore leaving the qDebug lines in the code will not affect the performance in the Release build.

  • Thank you for your replies.

    These logs are strictly for debugging purposes while in development to understand what the code is doing/outputting.

    It looks like it would be better to remove them. I will try “QT_NO_DEBUG_OUTPUT”

    Thanks a lot

Log in to reply