There are a few raw calls to fprintf() in tl-session.c, rather than the more appropriate logprint(). This causes the lines to end up in vsmagent.log without the proper format (e.g. lacking timestamp).
On the same theme: the subprocess function from tl-session-common should also include the program name at the start of the logged line, so it's easier to see from where the error comes. It's easy to get confused about where the error occurs when there's a problem executing tl-xinit.
We also have some direct calls to perror() instead of myperror().
Most of these issues are for very extreme situations, so they are difficult to test. But two possible scenarios are: 1. Rename the user session root directory for a running session, e.g. mv /var/opt/thinlinc/session/user /var/opt/thinlinc/sessions/foofoo, gives you this log on logout: > tl-session: unable to change working directory: No such file or directory 2. Hard kill tl-xinit, i.e. killall -9 tl-xinit, gives you this: > tl-session: tl-xinit was terminated by signal 9
Works well now. All lines from tl-session should now be properly prefixed with a timestamp.
Tested the fix on RHEL8 and could reproduce with tl-4.12.1 as described in comment 5. Works fine!