Setting LOG=1 in /etc/environment

You could use something more user-local like ~/.pam_environment or ~/.profile. These are practically the same approach as /etc/environment except they'll only affect your user. They could still affect other applications.

While ~/.profile is similar to other script files, ~/.pam_environment has a bit of a twitchy syntax that needs to be adhered to (or you'll break your login):

LOG DEFAULT=1

The other approach that may work is changing whatever launches notify-osd to pass the environment variable along directly. In this case, it seems to be part of some cross-platform DBUS cascade controlled from usr/share/dbus-1/services/org.freedesktop.Notifications.service

[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/lib/x86_64-linux-gnu/notify-osd

I wonder if the Exec line could be changed to read:

Exec=LOG=1 /usr/lib/x86_64-linux-gnu/notify-osd

Or if that throws syntax wobblies:

Exec=sh -c "LOG=1 /usr/lib/x86_64-linux-gnu/notify-osd"

If that works it has the obvious advantage of only affecting notify-osd (any anything it launches).


The NotifyOSD doc pages quotes:

(Note: logging to this file is enabled when the LOG environment variable is set to 1.)

In the Environmental Variable doc page, it has a list of common variables where "LOG" is not listed. It says:

Each application is free to define and use its own environment variables. Many manual pages include long lists of environment variables that can affect the behaviour of the application they describe. However, the most useful variables are common to many applications.

After googling for instances where LOG may be used, nothing comes up. "NOTIFYOSDLOG" would have been a more appropriate name. The use of LOG is completely dependent on applications so it's a mystery who does and doesn't use it. Since it isn't in the common variables list, it may be just a poorly named variable.