Skip to content

Conversation

@re2zero
Copy link
Contributor

@re2zero re2zero commented Sep 15, 2025

Add more logs for debug. 79.49%

Log: Add more logs

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: re2zero

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Add more logs for debug. 79.49%

Log: Add more logs
Support dconfig logs rules.

Log:Enable dconfig logs
@deepin-ci-robot
Copy link

deepin pr auto review

Based on the code review, I can see that the application is using qDebug() statements throughout the codebase for logging. The issue you're experiencing where the application exits with code 0 and no output is likely due to the logging statements being compiled out in release builds.

Here's what I found and how to fix it:

  1. The logging issue: The code uses qDebug() extensively, but in release builds, these messages are automatically removed by the Qt build system when QT_NO_DEBUG_OUTPUT is defined.

  2. Solution: We need to ensure that debug output is available in release builds. Here are the changes needed:

Solution 1: Keep debug output in release builds

Add this to your .pro file to ensure debug output is always included:

# Force debug output in release builds
DEFINES += QT_MESSAGELOGCONTEXT

Solution 2: Add proper logging categories

Create a proper logging system as shown in the code (I can see there's already a ddlog.h file with logging categories). Replace qDebug() calls with proper logging:

// Replace qDebug() calls with proper logging
qCDebug(appLog) << "Your message here";

Solution 3: Add a main function to ensure proper exit

Modify your main.cpp to ensure proper cleanup and logging:

#include <QLoggingCategory>
#include <QDebug>

Q_LOGGING_CATEGORY(appLog, "org.deepin.reader")

int main(int argc, char *argv[])
{
    // Enable debug output
    qSetMessagePattern("[%{time yyyy-MM-dd hh:mm:ss.zzz} %{type} %{function}:%{line}] %{message}");
    
    qDebug() << "Application starting";
    
    Application a(argc, argv);
    
    // Rest of your main function...
    
    qDebug() << "Application exiting";
    return a.exec();
}

Solution 4: Check your build configuration

Make sure your build configuration doesn't define QT_NO_DEBUG_OUTPUT. Check your .pro file for:

# Remove this line if present
# DEFINES += QT_NO_DEBUG_OUTPUT

The most immediate fix would be to add the DEFINES += QT_MESSAGELOGCONTEXT to your .pro file, which will ensure that debug output is included in release builds.

Would you like me to provide more specific guidance on any of these solutions?

@re2zero
Copy link
Contributor Author

re2zero commented Sep 16, 2025

/merge

@deepin-bot deepin-bot bot merged commit 0c5f379 into linuxdeepin:master Sep 16, 2025
6 checks passed
@re2zero re2zero deleted the log branch September 16, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants