You are not logged in.

#1 2021-01-10 19:44:29

lambdarch
Member
Registered: 2021-01-10
Posts: 75

[SOLVED] Automatic redirection of apps logs to the systemd journal

Hello everyone,

A few years ago I was using Ubuntu with Xfce and I remember that all logs of all Xfce components were redirected to the systemd journal (so much so that it was sometimes overwhelmed by GLib-Critical or GTK-Critical coming from a particular component).

On Arch Linux, still with Xfce, these logs seem to be redirected to /dev/null. If I launch in a terminal a particular component that I know it emits a warning, I can see this warning. If I use for example systemd-cat to redirect its output to the systemd journal, it is well redirected. But there is no automatic redirection of all the outputs of all the components.

So my question is: do you know how to make such a redirection happen? Thank you.

PS: I don't think this question is specific to Xfce, or even to Glib/GTK, but I couldn't find a more suitable section than this one.

Last edited by lambdarch (2021-01-12 09:48:05)

Offline

#2 2021-01-10 22:28:31

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: [SOLVED] Automatic redirection of apps logs to the systemd journal

I'm not sure if Glib error are caught like this, I'm not that much of an Gnome/GTK or even X specialist;)
What if you start you session like this, I know for sure GTK warnings are logged on i3 which is what I use..:

xfce)       exec xfce >~/.config/xfce/logs/xfcelog-"$(date +'%F-%k-%M-%S')" 2>&1 ;;

Offline

#3 2021-01-11 17:15:24

lambdarch
Member
Registered: 2021-01-10
Posts: 75

Re: [SOLVED] Automatic redirection of apps logs to the systemd journal

I tried to see in which script I could use this kind of redirection (or use systemd-cat) without success for the moment.
I think I'll try to see how Xubuntu is configured at this level to see how to fix it.

Offline

#4 2021-01-11 17:51:05

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: [SOLVED] Automatic redirection of apps logs to the systemd journal

xinitrc? at least that is where I activate this logging, it should last as long as the duration of your session(X)

Offline

#5 2021-01-11 22:41:00

lambdarch
Member
Registered: 2021-01-10
Posts: 75

Re: [SOLVED] Automatic redirection of apps logs to the systemd journal

Yes, I tried to put the redirection in several scripts, including xinitrc, without success. Moreover, I just tested Xubuntu 20.04 in a virtual machine, and I actually get the same behavior as on Arch.

But when I was using Xfce on Ubuntu, I started from a standard installation to which I added Xfce, I was not using Xubuntu. As a consequence, I probably wasn't using lightdm but gdm, and it seems that gdm redirects the logs to systemd by default. So I think I'll try to go through gdm to see if that's it.

Offline

#6 2021-01-12 02:03:25

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: [SOLVED] Automatic redirection of apps logs to the systemd journal

Hmm, could be gdm is doing it's thing .. personally I dislike using this tool and use a simple script as DM.
Using OpenBox, i3 and other WM's, the ones I tried at least, all log fine this way.
BTW. did you create the dir 'logs' in '~/.config/xfce'? It won't create itself...;)

Offline

#7 2021-01-12 09:44:40

lambdarch
Member
Registered: 2021-01-10
Posts: 75

Re: [SOLVED] Automatic redirection of apps logs to the systemd journal

I was finally able to redirect the logs in the Xubuntu 20.04 virtual machine, replacing xfce4-session with systemd-cat xfce4-session in /etc/xdg/xfce4/xinitrc.

I didn't try it because it didn't work on Arch, but there is a difference: on Arch, I have Xfce 4.16, while on Xubuntu, I have Xfce 4.14.
But there has been a change in Xfce 4.16 that re-parents processes to init (probably closing their file descriptors), whereas before, there was a process hierarchy that went up to xfce4-session (and beyond to lightdm): see https://gitlab.xfce.org/xfce/xfce4-panel/-/issues/300.

Now I just have to hack a little libxfce4ui (where the new API has been added) to get back to the old behavior and that's it, so I consider the issue resolved. Thanks qinohe!

NB: To be complete, and in case it could be useful to someone, you just have to replace 'daemon (1, 0)' by 'daemon (1, 1)' here: https://gitlab.xfce.org/xfce/libxfce4ui … awn.c#L273 (as soon as you've also done something to redirect the logs, as seen above).

Last edited by lambdarch (2021-01-12 16:03:11)

Offline

Board footer

Powered by FluxBB