https://bugs.kde.org/show_bug.cgi?id=461289

            Bug ID: 461289
           Summary: plasmashell should give each launched app its own
                    labelled systemd-journald stream
    Classification: Plasma
           Product: plasmashell
           Version: 5.26.2
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: wishlist
          Priority: NOR
         Component: general
          Assignee: plasma-b...@kde.org
          Reporter: s...@collabora.com
                CC: k...@davidedmundson.co.uk
  Target Milestone: 1.0

SUMMARY

On systems that use systemd, whenever Plasma starts an app that is not
DBusActivatable, log messages in the systemd journal will "blame" `plasmashell`
for its output. They should show the .desktop file name instead, so users can
attribute messages to apps.

STEPS TO REPRODUCE

1. journalctl -f
2. Have an app that is *not* DBusActivatable=true, and logs distinctive
messages to stdout/stderr. I used Steam.
3. Launch the app from an icon on the desktop (from the application menu or an
applet would probably have similar behaviour)

OBSERVED RESULT

Messages with plasmashell as their "syslog identifier", like this:

$date $HOSTNAME plasmashell[12345]: steam.sh[12345]: running Steam on arch
rolling 64-bit
$date $HOSTNAME plasmashell[12345]: Installing breakpad exception handler blah
blah blah

EXPECTED RESULT

Messages with the .desktop filename or app ID as their "syslog identifier",
similar to what GNOME Shell does:

$date $HOSTNAME steam.desktop[12345]: steam.sh[12345]: running Steam on ubuntu
22.04 64-bit
$date $HOSTNAME steam.desktop[12345]: Installing breakpad exception handler
blah blah blah

SOFTWARE/OS VERSIONS

Linux: Arch Linux rolling release as of 2022-11-01
KDE Plasma Version: 5.26.2
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.7

ADDITIONAL INFORMATION

The easiest way to implement this is to link to libsystemd, call
sd_journal_stream_fd() to open new streams, and use dup2() to make them
overwrite launched apps' stdout and stderr, like dbus does:
https://gitlab.freedesktop.org/dbus/dbus/-/blob/dbus-1.14.4/dbus/dbus-spawn-unix.c#L1392

If linking to libsystemd is undesirable, it is fairly straightforward to
reimplement sd_journal_stream_fd(), like GLib does:
https://github.com/GNOME/glib/blob/2.74.1/gio/gio-launch-desktop.c

Plasma could either do this unconditionally (like dbus does), or only when it
detects that stdout/stderr are already pointing to the Journal (like GLib does,
sample implementation:
https://github.com/GNOME/glib/blob/2.74.1/glib/gjournal-private.c)

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to