Add debug output for all network requests
ClosedPublic

Authored by habacker on Jun 26 2018, 8:02 AM.

Details

Summary

Only get requests had a debug output

Test Plan

compiled an verifies with test app

Diff Detail

Repository
R235 Attica
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
habacker created this revision.Jun 26 2018, 8:02 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptJun 26 2018, 8:02 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
habacker requested review of this revision.Jun 26 2018, 8:02 AM
leinir requested changes to this revision.Jun 27 2018, 8:32 AM

Straight-up qDebug would cause quite a lot of spam... I'd be much happier if this was done using qCDebug (which is already used in other parts of the code, so just need to include attica_debug.h and swap for qDebug for qCDebug(ATTICA))

This revision now requires changes to proceed.Jun 27 2018, 8:32 AM

Unfortunally changing to qCDebug will not show any debug messages in the provider test app.

I can only see debug messages if I change in the top level CMakeLists.txt the line

ecm_qt_declare_logging_category(attica_SRCS HEADER attica_debug.h IDENTIFIER ATTICA CATEGORY_NAME org.kde.attica)

to

ecm_qt_declare_logging_category(attica_SRCS HEADER attica_debug.h IDENTIFIER ATTICA CATEGORY_NAME org.kde.attica DEFAULT_SEVERITY Debug)

Any hint how to do that programmatically in the provider test app ? http://doc.qt.io/qt-5/qloggingcategory.html#details gave no usable hint

bruns added a subscriber: bruns.Jun 27 2018, 4:37 PM

Unfortunally changing to qCDebug will not show any debug messages in the provider test app.

Any hint how to do that programmatically in the provider test app ? http://doc.qt.io/qt-5/qloggingcategory.html#details gave no usable hint

Actually, it does. You have to enable logging explicitly for the per default excluded levels:
org.kde.attica.debug=true

http://doc.qt.io/qt-5/qloggingcategory.html#configuring-categories
http://doc.qt.io/qt-5/qloggingcategory.html#setFilterRules

habacker added a comment.EditedJun 27 2018, 5:37 PM

Actually, it does. You have to enable logging explicitly for the per default excluded levels:
org.kde.attica.debug=true

http://doc.qt.io/qt-5/qloggingcategory.html#configuring-categories
http://doc.qt.io/qt-5/qloggingcategory.html#setFilterRules

Thanks for this pointer. After looking at http://blog.qt.io/blog/2014/03/11/qt-weekly-1-categorized-logging/, which shows a an example for an application I got this working.

Straight-up qDebug would cause quite a lot of spam... I'd be much happier if this was done using qCDebug (which is already used in other parts of the code, so just need to include attica_debug.h and swap for qDebug for qCDebug(ATTICA))

Will fix that.

BTW:You are aware, that there are still much usage of qDebug in attica code ?

~/src/attica> grep -rn qDebug\(\) | wc -l
82 

~/src/attica/src> grep -rn qDebug\(\) | wc -l
40

org.kde.attica.debug=true

Just on question relating the category: Is there something comparable to KDebugDialog and kdebug.areas from KDE4 times https://cgit.kde.org/kdelibs.git/tree/kdecore/kdebug.areas?h=KDE/4.14, which did make it easy to enable/disable debug message for multiple components. I'm asking because, if not, with having `ecm_qt_declare_logging_category``` it would be easy to create and install a related file, which could be used by a KF5 related KF5DebugDialog.

kdebugsettings is what you are looking for, it works for all Qt applications. You can specify the rules directly, or use the available .categories file to quickly select some levels.

Many applications by KDE exports a .categories file. There was an effort to automatically generate it but was dropped: https://phabricator.kde.org/D9446

habacker updated this revision to Diff 36848.Jun 28 2018, 6:10 PM
  • use qcDebug
  • enable debug display in providertest
leinir accepted this revision.Jun 28 2018, 6:12 PM

Sorted! Good digging, nice work :)

This revision is now accepted and ready to land.Jun 28 2018, 6:12 PM
This revision was automatically updated to reflect the committed changes.