[Differential] [Request, 417 lines] D2295: improve logging for kscreen
sebas (Sebastian Kügler)
noreply at phabricator.kde.org
Wed Jul 27 02:36:09 UTC 2016
sebas created this revision.
sebas added a reviewer: Plasma.
Restricted Application added a project: Plasma.
Restricted Application added a subscriber: plasma-devel.
REVISION SUMMARY
Debugging kscreen is generally really hard since it's spread across different
processes, not all of which are easy to look into.
With this change, we collect all of kscreen's debug output (from kcm, kded
and backendlauncher) and write them to a log file.
This means that we can look into one log file, and see exactly what's going
on, and in which component. It makes collecting debug info much easier.
This is implemented in the form of a QMessageHandler, hooking into the
qCDebug calls. This is a pretty neat solution, since:
- we can make use of the stream operators from qDebug
- we don't need to rewrite all the debug statements
- normal debug is otherwise still working
The general idea is that we cache file names and initialization from the
env vars on first creation, allow subsequent context changes. The log file
is opened and closed right away, since other processes may want to also
write to it.
We don't do any file-locking to keep things simple. The logging isn't
mission-critical, but rather a debugging tool for users. If we end up
with corrupt logs, that's bad luck (but can happen due to multi-process
race conditions). More advanced multi-process locking and delayed
writing is just going to give us headaches, so we avoid that at the
price of logs not being 100% reliably formatted.
Also:
- disable logging for most autotests
- all messages are then passed to the previously installed messagehandler.
TEST PLAN
new code comes with autotests
REPOSITORY
rLIBKSCREEN KScreen Library
BRANCH
sebas/log
REVISION DETAIL
https://phabricator.kde.org/D2295
AFFECTED FILES
autotests/CMakeLists.txt
autotests/testbackendloader.cpp
autotests/testconfigmonitor.cpp
autotests/testinprocess.cpp
autotests/testkwaylandbackend.cpp
autotests/testkwaylandconfig.cpp
autotests/testlog.cpp
autotests/testqscreenbackend.cpp
autotests/testscreenconfig.cpp
src/CMakeLists.txt
src/backendlauncher/main.cpp
src/backendmanager.cpp
src/getconfigoperation.cpp
src/log.cpp
src/log.h
EMAIL PREFERENCES
https://phabricator.kde.org/settings/panel/emailpreferences/
To: sebas, #plasma
Cc: plasma-devel, jensreuterberg, abetts, sebas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160727/2baa7d33/attachment.html>
More information about the Plasma-devel
mailing list