After Alex Bikadorov added a -d parameter that to Krusader, after reading what Jan Lepper wrote in https://bugs.kde.org/show_bug.cgi?id=281917#c7, and after reading the comments of "Bug 384653 - [zip kioslave] Journal spammed with “kf5.kio.core: error() called twice! Please fix the KIO slave”: The KrDebugLogger system was adapted and improved, and some related changes were made.
Two use cases:
a) Alice has made some changes in krarc.cpp, and because debugging a kioslave is difficult, at least she can execute:
export KDE_FORK_SLAVES=true; krusader -d
press the right arrow on a file, and see in the command line that error messages appear before finishing kio_krarcProtocol::stat():
[...] 11:23:18.046-debug default unknown@0 # key event= QKeyEvent(KeyPress, Key_Right) [...] trying to load "/usr/lib/x86_64-linux-gnu/qt5/plugins/kio_krarc.so" from "/usr/lib/x86_64-linux-gnu/qt5/plugins/kio_krarc.so" Pid:30112 ┏kio_krarcProtocol(147) Pid:30112 ┗kio_krarcProtocol Pid:30112 ┏stat(664) Pid:30112 stat(665): / Pid:30112 ┏setArcFile(877) Pid:30112 setArcFile(878): Pid:30112 ┗setArcFile kf5.kio.core: error() called twice! Please fix the "" KIO slave Pid:30112 ┗stat Pid:30112 ┏stat(664) Pid:30112 stat(665): /media Pid:30112 ┏setArcFile(877) Pid:30112 setArcFile(878): media Pid:30112 ┗setArcFile kf5.kio.core: error() called twice! Please fix the "" KIO slave Pid:30112 ┗stat [...]
With that information, Alice can add more code so that more messages are written in the trace log.
b) Bob has made changes to kiso.cpp, and he has inspected his code, but Bob wants to compare the working of the new code with the working of the old one. To help himself, he creates a trace log of a session working with the old code, and a trace log of a session working with the new code, and compares those trace logs:
$ # Note: To compare compare two trace logs: it's better not to write some data to the trace logs (because otherwise a lot of false positives would be seen) $ export KRDEBUG_BRIEF=true $ $ export KDE_FORK_SLAVES=true; krusader -d > traceNewCode.txt 2>&1 $ [...] $ kompare traceNewCode.txt traceOldCode.txt`
Finally, Bob sees that, using the new code, KIso::readParams() has not been used (but previously it was), and so Bob realizes that there's a problem.