# How to enable .xsession-errors file/log?



## userxbw (Sep 4, 2019)

Google gives me loads of people wanting to how to limit size, disable it, but I cannot find anything on how to get one. So I can check it when I need to.


----------



## PMc (Sep 4, 2019)

Maybe this helps:
/usr/local/etc/X11/xdm/Xsession


```
# redirect errors to a file in user's home directory if we can
errfile="$HOME/.xsession-errors"
if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null )
then
        exec > "$errfile" 2>&1
else
...
```


----------



## userxbw (Sep 4, 2019)

PMc said:


> Maybe this helps:
> /usr/local/etc/X11/xdm/Xsession
> 
> 
> ...


humm.. that is in here, but  I'm not doing xdm.








						xorg-xdm/Xsession.cpp at master · freedesktop/xorg-xdm
					

X Display Manager / XDMCP server. Contribute to freedesktop/xorg-xdm development by creating an account on GitHub.




					github.com
				




this is as far as my X11 goes.

```
$ ls /usr/local/etc/X11/
xinit       xorg.conf.d
[code]
```


----------



## PMc (Sep 4, 2019)

I might doubt if the .xsession-errors is being written without running an xsession (which is, according to the manpage, what xdm does).


----------



## userxbw (Sep 4, 2019)

even so, after I looked at your first post, a thought came to mind, I do not even think I installed the full xorg this time around. just min and its xfonts-pkg. I was thinking I could maybe use it for this one error I'm getting.

```
XIO:  fatal IO error 0 (No error: 0) on X server "unix:0.0"
      after 86 requests (85 known processed) with 0 events remaining.
```
I fixed this one program I wrote for Linux that now works in FreeBSD, but then I got that error and it killed my program after about 6 images being set to desktop.


----------



## ljboiler (Sep 5, 2019)

With minimal X and no X login manager, this is what I use to get the Xserver running with the i3 window manager:

```
startx ~/.xinitrc i3 >& ~/.xsession.log
```
My .xinitrc does nothing more than set some font paths and finally does an `exec $1`.


----------



## userxbw (Sep 5, 2019)

ljboiler said:


> With minimal X and no X login manager, this is what I use to get the Xserver running with the i3 window manager:
> 
> ```
> startx ~/.xinitrc i3 >& ~/.xsession.log
> ...


I'm using slim, this is what I put in .xinitrc

```
[userx@FreeBSD64ssd ~]$ cat .xinitrc
#!/usr/bin/env bash

echo "$(date) :-: $1" >> ~/started

errfile="$HOME/.xsession-errors"
if [ -z "$HOSTNAME" ]; then
    errfile="$HOME/.xsession-errors"
else
    errfile="$HOME/.xsession-errors-$HOSTNAME"
fi
exec $1
```

I do not know if it is working or not because I do not know if I get errors or not to check it. There is no .xsession-errors file though.


----------



## ljboiler (Sep 5, 2019)

You probably want to change the last line from 
	
	



```
exec $1
```
 to 
	
	



```
exec $1 &>> ${errfile}
```


----------



## userxbw (Sep 5, 2019)

ljboiler said:


> You probably want to change the last line from
> 
> 
> 
> ...


it's something

```
[userx@FreeBSD64ssd ~]$ cat .xsession-errors
/usr/local/bin/startxfce4: X server already running on display unix:0.0
console.log: WebExtensions: new intermediate certificate added
console.log: WebExtensions: signatures re-verified
Log warning: The log 'Services.Common.RESTRequest' is configured to use the preference 'services.common.log.logger.rest.request' - you must adjust the level by setting this preference, not by using the level setter
```

oh yeah no & after $1 . that puts it in the background....


----------



## ljboiler (Sep 5, 2019)

No space between the & and the > ...


----------

