User Tools

Site Tools


wiki:development:debugging

Debugging X2Go Components

Log File Watching

If you want to track down problems with the server-side components of X2Go, it is possible to enable output of debug information into the systems syslog facility (normally /var/log/syslog).

The default log levels for x2goserver and cups-x2go are set to notice. Available log levels are: emerg, crit, alert, err, warning, notice, info, debug.

While testing e.g. your X2Go server, you can open another terminal on the server and watch the syslog file:

root@x2goserver:~$ tail -f /var/log/syslog | grep x2go

Other logging locations apart from the system's log are:

  • X2Go Server: /var/log/syslog
  • X2Go Client: stderr (use --debug)
  • PyHoca-GUI: stderr (use --libdebug --debug)
  • Xsession itself: $HOME/.xsession-x2go-errors
  • NX (server-side): $HOME/.x2go/C-<sessionid>/session.*
  • NX (client-side): $HOME/.x2go/S-<sessionid>/session.*

Enable Debug Output

Debugging X2Go Server

The x2goserver log level can be set by editing:

root@x2goserver:~$ editor /etc/x2go/x2goserver.conf

Debugging cups-x2go

For debugging cups-x2go there are two files to look at:

  • /var/log/cups/error_log - in case cups-x2go code has a bug (e.g. a syntax error) or fails otherhow
  • /var/log/syslog - in case anything goes wrong while cups-x2go is processing a print job

For setting the log level of your CUPS server, please investigate the cupsd.conf man page:

$ man cupsd.conf

The cups-x2go log level can be set by editing:

root@printserver:~$ editor /etc/cups/cups-x2go

Debugging X2Go Session Broker

The x2gobroker debug mode can be enabled in:

root@broker:~$ editor /etc/default/python-x2gobroker

The log files normally get written to /var/log/x2gobroker/*.log

You can also run

root@broker:~$ x2gobroker-daemon-debug

as user root. This is equivalent to running the broker daemon provided by the package x2gobroker-daemon, but you will see all output piped to stderr while the X2Go Session Broker daemon runs in foreground mode.

Python X2Go / PyHoca Debugging

The PyHoca clients both have a --libdebug option. Run pyhoca-gui or pyhoca-cli from the command line with that option enabled and you get blasted with debug output.

Customizing Debug Messages

All X2go server scripts are ready for syslogging, though not all of them actually do log to syslog. If you want to add your own syslog messages for debugging purposes, please take a look at the code of files that already do report to syslog.\

Here is a little howto that explains how to add extra log output to X2go server scripts:

Logging in X2Go Server's Perl Scripts

Whereever you want to write a line to syslog from an X2Go Server's Perl script, place this command:

syslog('debug', '<My message to syslog...>');

Logging in X2Go Server's Shell/Bash Scripts

Whereever you want to write a line to syslog from an X2Go Shell/Bash script, place this command:

$X2GO_LIB_PATH/x2gosyslog "$0" "debug" "<My message to syslog...>"

Logging in X2Go Session Broker's Python Module

Whereever you want to write a line to /var/log/x2gobroker/broker.log from one of the python-x2gobroker module files, place this command:

# at the top of the module file:
from x2gobroker.loggers import logger_broker
# [...] then further below, wherever needed:
logger_broker.debug('<your message>')

Debugging x2goclient on Windows

This is a bit tricky. You need to run the debug version of x2goclient in a cmd window. The debug version is part of the xgoclient installation package for Windows and is called x2goclient.debug.exe. If it is not available on you machine re-run the installer.

Run <path_to_your_installation>\x2goclient –debug –libssh-debug –libssh-packetlog 2>logfile.txt (+ further options you might require) and run your session as usual. The session log file logfile.txt will be created in the current directory and can be opened e.g. with notepad.

Run x2goclient –help for available options.

important The options are always prefixed by two -, your browser might display them as one!
wiki/development/debugging.txt · Last modified: 2024/07/01 17:36 by uli42