Overview
WLog is a configurable and flexible logging system used throughout WinPR and FreeRDP. The primary concept is a hierarchy of loggers that can be configured independently. Each logger is identified by a dotted name (e.g.,core.channel, com.freerdp.client.x11) and inherits settings from its parent unless overridden.
Configuration is done entirely through environment variables — no source changes are required.
Log levels
Levels are cumulative: setting a level includes all levels below it in the hierarchy.| Level | Description |
|---|---|
TRACE | Print everything, including packet dumps |
DEBUG | Debug messages |
INFO | General information |
WARN | Warnings |
ERROR | Errors |
FATAL | Fatal problems |
OFF | Completely disable WLog output |
Environment variables
Core variables
| Variable | Description |
|---|---|
WLOG_LEVEL | The minimum level to output. Applies globally unless overridden by WLOG_FILTER. |
WLOG_FILTER | Comma-separated list of <logger>:<level> pairs. Only matching loggers at the specified level are printed. |
WLOG_PREFIX | Format string controlling the prefix of every log line. See Format specifiers. |
WLOG_APPENDER | Selects the output target. See Appenders. |
File appender variables
| Variable | Description |
|---|---|
WLOG_FILEAPPENDER_OUTPUT_FILE_PATH | Directory in which the log file is written. |
WLOG_FILEAPPENDER_OUTPUT_FILE_NAME | Name of the output log file. |
Journald appender variable
| Variable | Description |
|---|---|
WLOG_JOURNALD_ID | Identifier used with the journal (defaults to the executable name). |
UDP appender variable
| Variable | Description |
|---|---|
WLOG_UDP_TARGET | Target in host:port format. Defaults to 127.0.0.1:20000. |
Format specifiers
TheWLOG_PREFIX variable controls what appears before each log message. Specifiers are prefixed with %.
| Specifier | Description |
|---|---|
%lv | Log level |
%mn | Module name |
%fl | File name |
%fn | Function name |
%ln | Line number |
%pid | Process ID |
%tid | Thread ID |
%yr | Year |
%mo | Month |
%dw | Day of week |
%hr | Hour |
%mi | Minute |
%se | Second |
%ml | Millisecond |
A maximum of 16 specifiers can be used in a single format string.
Example prefix
Appenders
An appender defines where log output is written. Select one withWLOG_APPENDER.
CONSOLE
CONSOLE
Writes to the console. On Android,
log_print is used instead.outputstream option values:stdout— write everything to stdoutstderr— write everything to stderrdefault— errors and fatal messages go to stderr; everything else to stdoutdebug— use debug output (Windows only; behaves likedefaulton other platforms)
FILE
FILE
Writes textual log output to a file.
BINARY
BINARY
Writes log data in a binary format file.
UDP
UDP
Sends log messages to a remote host over UDP. The default target is Receive messages with netcat in a second terminal:
127.0.0.1:20000.SYSLOG
SYSLOG
Outputs log messages to syslog. No additional options are available.
Syslog support is optional and depends on build-time configuration.
JOURNALD
JOURNALD
Outputs log messages to the systemd journal.Read the journal:
Journald support is optional. It requires building with
-DWITH_LIBSYSTEMD=ON.Filtering specific modules
UseWLOG_FILTER to restrict output to particular loggers and levels. The format is a comma-separated list of <logger>:<level> pairs.
WLOG_LEVEL.
