High Performance OPC UA Server SDK  1.1.1.177
Trace Module

The trace module is important for analyzing problems.

It can be disabled at compile time to strip out all trace strings in situation where not enough RAM/ROM is available, but this is not recommended.

At runtime you can configure the trace information by setting the trace level and trace facility. By default the level TRACE_LEVEL_ERROR should always be enabled. For debugging you can enable more trace levels. The trace facility can be used to filter the trace output for a certain software module, e.g. TRACE_FAC_MEMORY. By default the facility filter should be disabled by using TRACE_FAC_ALL. The application can configure this by calling trace_openlog.

Note that both trace facility and trace level are bitmasks. This allows better control for filtering the trace output than simple <,> comparisons.

STDERR Backend

This is a generic C implementation which uses fprintf and vfprintf to print nicely formatted trace information with timestamps to console (stderr). On Linux it also supports colored output which is nice to read.

On embedded systems putc() can also be redirected to UART, so that all printf calls can be sent to a terminal application on a PC.

If this is not possible you can create you own trace backend.

File Backend

This is a very simple implementation which writes all traces into a file. By default it will create a filename "log.<pid>.<num>", where pid is the current process id and num is a number that gets incremented when a new file is created. This module will create a new file reaches the configured maximum number of lines (default=10000).

It does not remove any old files. So to avoid writing the disk full other tools like logrotate should be used to maintain the log files.

Syslog Backend

This module is designed for Linux. It uses the syslog API to write all traces into the system log files, which is the expected behaviour of Linux system administrators.

See https://linux.die.net/man/3/syslog for more information.