Logging - neutrinolabs/xrdp GitHub Wiki

Logging functions

xrdp uses the following macros to emit log messages:

LOG : Logging macro for messages that are for a system administrator to configure and run xrdp on their machine.

LOG_DEVEL : Logging macro for messages that are for an xrdp developer to understand and debug xrdp code.

LOG_DEVEL_HEXDUMP : Logging macro for logging the contents of a byte array using a hex dump format.

Note: LOG, LOG_DEVEL, and LOG_DEVEL_HEXDUMP add the source code file name, line number, and function name as a prefix to the log message when XRDP is compiled with XRDP_DEBUG defined.

Note: LOG_DEVEL and LOG_DEVEL_HEXDUMP only emit log messages when xrdp is compiled with XRDP_DEBUG defined.

The logging macros above should be used instead of the log_message, log_message_with_location, and log_hexdump_with_location functions to ensure consistency of the logging features for all log messages.

For more details see the code of the logging macros

Log levels

Level Purpose
ERROR for describing non-recoverable error states in a request or method

Note: all errors which results in a session disconnection should be logged with LOG(ERROR,)
to ensure that user provided error reports contain the error messages.
WARNING for describing recoverable error states in a request or method
INFO for low verbosity and high level descriptions of normal operations
DEBUG for medium verbosity and low level descriptions of normal operations
TRACE for high verbosity and low level descriptions of normal operations (eg. method or wire tracing)

Logging outputs

xrdp supports logging to the following outputs:

  • console
  • syslog
  • log file

The logging outputs are configured independently for xrdp, xrdp-sesman, xrdp-chansrv in xrdp.ini and sesman.ini respectively, and documented in the xrdp.ini.5 and sesman.ini.5 man pages.

The console output is only usable when xrdp is run with --no-daemon. This is because when xrdp is run as a daemon then stdout and stderr are redirected to /dev/null.

Log files

Process Name Default Log File Multiplicity
xrdp xrdp.log 1 per server
xrdp-sesman xrdp-sesman.log 1 per server
xrdp-chansrv xrdp-chansrv.%d.log 1 per user display

The directories containing the log files are OS dependent and can be found in the xrdp.ini man pages.

The xrdp and xrdp-sesman processes fork upon receiving connections and runs as multiple process. Therefore the log file is opened using O_APPEND to allow the multiple processes to write to the same file without corrupting the log messages.

⚠️ **GitHub.com Fallback** ⚠️