If you start an application from a terminal you can see the output to stdout and stderr, but if an application is started from the window manager, where does the output to these files typically go? To /dev/null?
Where does the output from an application started from the window manager go
logsstdoutxorg
Best Answer
The output of an application started from the window manager goes to the same place as the output from the window manager itself. (Unless the application redirects it, but typical GUI applications don't.)
You can find out where the WM's output goes by looking at what it has open on file descriptor 1 (standard output) and file descriptor 2 (standard error); typically both will go to the same file. Find out the process ID of your window manager (try e.g.
pgrep metacity
orpidof metacity
if Metacity is your window manager — if you don't know the process name for your window manager, look at the root of one of the process trees reported byps f
orpstree
). Supposing the process ID of your window manager is 1234, runand look for the lines corresponding to file descriptors 1 and 2, or
or
You can automate the filtering of the relevant file descriptors:
(Note: all the commands above are for Linux.
pgrep
is common among other unices, andlsof
can be installed pretty much anywhere;ps
options and/proc
contents are different across different unices.)In the common situation where you're running commands from a shell running in a terminal emulator (xterm, konsole, gnome-terminal, etc., but not when used across screen or tmux), then you can easily check where the terminal emulator's output is going, as the terminal emulator is the parent process of your shell. This doesn't work if the terminal emulator is running with additional privileges, which happens on some systems to allow the terminal emulator to write to the logged-in user list (utmp).
Many distributions direct the output of the X session to
~/.xsession-errors
.