improve logging for kscreen

Authored by sebas on Jul 27 2016, 2:28 AM.

Description

improve logging for kscreen

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

Reviewers: Plasma

Subscribers: plasma-devel

Tags: Plasma

Differential Revision: https://phabricator.kde.org/D2295

Details

Committed
sebasJul 27 2016, 2:36 AM
Differential Revision
D2295: improve logging for kscreen
Parents
R110:f4d3e52e2e24: Make sure that the logger is installed
Branches
Unknown
Tags
Unknown