XLL+ Class Library (6.3)

Formatting patterns

A formatting pattern is a text string containing one or more symbols, which will be substituted into the formatted output text. The symbols are listed below.

Symbols

Symbol Description
%c Logger name.
%d Timestamp.
%F File name of originating source file.
%l Location of code that logged the event, including file name and line number. Equivalent to %F(%L).
%L Line number of code that logged the event.
%m Message
%n New line
%p Severity level (i.e. ERROR, WARN, etc)
%r Ticks - millisecs since originating computer was started.
%t Thread ID.
%% The percent symbol.

Width

Each symbol can be preceded by a width statement, in the form min or min.max where min and max are both integers, e.g.: %5p, %-10.20c, %7.7t The outputted field will be padded with spaces if it contains less than min characters. If min is negative, then the padding will be on the right - i.e. the field will be left-justified. If min is positive, then the padding will be on the left - i.e. the field will be right-justified. If the field contains more than max characters, it will be truncated.

Examples

%-5p %c - %m%n

Prints the severity level of the event, left-justified, padded to 5 characters, followed by the name of the logger that initially received the event, the message itself, and finally a new-line.

ERROR MyClass - Something went very wrong
WARN  MyOtherClass - Something untoward occurred

%-20.20d %-5p %c - %m [%l]%n

Prints the time the event was raised, the severity level of the event (left-justified, padded to 5 characters), the name of the logger that initially received the event, the message itself, the line of code where te event was raised and finally a new-line.

Sat Feb 07 11:05:17  INFO  RtdHandleServer.CTopicTable - CTopicTable: Remove topic {5ECBBA8B-EDF7-432E-B127-823F089FADF0}; count after = 0 [c:\source\topictable.h(166)]
Sat Feb 07 11:05:17  TRACE RtdHandleServer.CXllRtdHandleServer - CXllRtdHandleServer::DisconnectData() ends [c:\source\xllrtdhandleserver.cpp(248)]

Next: Hidden regions >>