Pattern Layout |
A conversion character defines a data item to include in the message. Some conversion characters also contain optional specifiers. Here are the supported conversion characters:
reports the name of the logger that generates the log event.
Alias: | logger |
Default: | Complete logger name; for example, "Logging.Appender.IOMCallContext". |
Requirement: |
If the precision specifier is used,
it must be surrounded with a pair of braces.
The precision specifier is represented as a decimal constant. |
Interaction: | If the precision specifier is used, only the corresponding number of right-most components of the logger name are included in the output. |
Example: | For the logger name "Logging.Appender.IOMCallContext", the pattern %c{2} generates this output: "Appender.IOMCallContext". |
reports the date of the log event.
reports the name of the file in the application that generated the log event.
Alias: | file |
reports the line number in the application that generated the log event.
Alias: | line |
writes the messages that are associated with the log event. When the message is more than one line long, all lines are written. When a prefix identifier is specified, all lines after the first line are preceded by the prefix identifier.
Alias: | message |
Default: | None |
Valid values: |
Here are the supported prefix-identifiers:
|
Requirement: | If the prefix identifier is used, it must be surrounded with a pair of braces. |
enables you to supply discretionary newline characters among the data items that compose the log event.
Default: | None |
Valid values: |
Here are the supported prefix-identifiers:
|
Requirement: | If the prefix identifier is used, it must be surrounded with a pair of braces. |
reports the level of the log event.
Alias: | level |
Valid values: |
Here are the supported
levels: TRACE DEBUG INFO WARN ERROR FATAL |
reports the number of milliseconds that elapsed between the start of the application and the creation of the log event.
Alias: | relative |
delivers various system information to the log event.
Alias: | systemInfo |
Requirement: | The S conversion character must be followed by the specified value, which is also referred to as a key, and must be surrounded with a pair of braces. |
Valid values: |
Here are the supported keys and values:
|
Example: | %S{os_family} |
reports the sequence number of the log event.
Alias: | sequenceNumber |
reports the identifier of the thread that generated the log event.
Alias: | thread |
reports the client identity that is associated with the current thread or task. If the current thread or task does not have an associated identity, the identity that owns the current process is reported to the log event.
Alias: | username |
See Also: | S {user_name} |
reports the NDC (nested diagnostic context) that is associated with the thread that generated the log event.
Alias: | ndc |
reports the MDC (mapped diagnostic context) that is associated with the thread that generated the log event. MDC is used to distinguish interleaved log output from different sources. Log output is typically interleaved when a server manages multiple clients in parallel. The MDC is managed on a per-thread basis.
The X conversion character must be followed by the key for the map. The value in the MDC that corresponds to the key is reported.
Alias: | properties |
Requirement: | The key must be surrounded with a pair of braces. An example is %X{clientNumber}, where clientNumber is the key. |
enables you to specify a literal percent sign symbol in a text string of a conversion pattern. A single percent sign is interpreted as a conversion specifier. Two percent signs are interpreted as literal text, which is delivered as a single percent sign in the log event.
Example: |
<param name="ConversionPattern" value="%d;text%%text;%m"/>
Here is sample output: 2008-06-25-10:24:22,234; text%text;Numeric maximum was larger than 8, am setting to 8. |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.