Previous Page | Next Page

Pattern Layout

Conversion Characters

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:

c [ {precision-specifier} ]

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".
d [ {date conversion specifier} ]

reports the date of the log event.

Alias: date
Default: ISO8601 format, which is represented as yyyy-MM-dd HH:mm:ss,SSS.
Requirement: If the date conversion specifier is used, it must be surrounded with a pair of braces.
Interaction: Here are the supported date conversion specifiers:

ABSOLUTE

specifies the time in this format: HH:mm:ss,SSS. An example is 15:49:37,459

DATE

specifies the date and time in this format: dd MMM yyyy HH:mm:ss,SSS. An example is 06 Nov 2008 15:49:37,459

ISO8601

specifies the date and time in this format: yyyy-MM-dd HH:mm:ss,SSS. An example is 1999-11-27 15:49:37,459

Simple Date Format

specifies a date in the form of a string that can contain any of these sets of characters:

aa: AM/PM marker (string) FF: Day of week in month (numeric)
dd: Day in month (numeric) GG: Era designator (string "AD")
hh: Hour in AM/PM (numeric 1-12) HH: Hour in day (numeric 0-23)
mm: Minute in hour (numeric) KK: Hour in AM/PM (numeric 0-11)
ss: Second in minute (numeric) MM: Month in year (numeric 1-12)
yy: Two-digit year (numeric) MMM: Month in year (abbreviated string)
yyyy: Four-digit year (numeric) MMMM: Month in year (string)
z: Time zone (string) SSS: Millisecond (numeric)
DD: Day in year (numeric) Z: RFC 822 Time Zone (string)
EE: Day in week (abbreviated string) 'literal string within single quotation marks '
EEEE: Day in week (string)

Tip: The d conversion character formats three digits for the precision of milliseconds, regardless of the number of S simple date format characters that are specified, and regardless of the machine precision of the timing that is available.
Examples: d{ABSOLUTE}
d{EEEE MMMM yyyy HH:mm:ss,SSS 'Ship date'}
F

reports the name of the file in the application that generated the log event.

Alias: file
L

reports the line number in the application that generated the log event.

Alias: line
m [ {prefix-identifier} ]

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:

HYPHEN

inserts a hyphen (-) before each message.

PLUS

inserts a plus sign (+) before each message.

Requirement: If the prefix identifier is used, it must be surrounded with a pair of braces.
n [ {newline-prefix-identifier} ]

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:

HYPHEN

inserts a hyphen (-) before each message.

PLUS

inserts a plus sign (+) before each message.

Requirement: If the prefix identifier is used, it must be surrounded with a pair of braces.
p

reports the level of the log event.

Alias: level
Valid values: Here are the supported levels:
TRACE
DEBUG
INFO
WARN
ERROR
FATAL
r

reports the number of milliseconds that elapsed between the start of the application and the creation of the log event.

Alias: relative
S {key}

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:
App.Log

reports the filename that is specified by the LOG= system option when SAS starts. Otherwise, these actions occur:

  • If the LOG= system option does not specify a filename, but a filename is specified by the SYSIN= system option, the filename that is specified by the SYSIN= option is used. The file extension is changed to .log.

  • If the filename that is specified by the SYSIN= system option lacks a full pathname, the path of the current working directory is prepended to the filename.

App.Name

reports the value of the LOGAPPLNAME= system option.

App.Sysin

reports the filename that is specified by the SYSIN= system option.

model_name

reports the name of the manufacturer of the computer hardware. Examples are HP, SUN, and IBM.

model_num

reports the model number of the computer hardware. Examples are Itanium, X86, RS/6000, SPARC, and 9000/800.

host_name | hostname

reports the node name that is assigned to the computer hardware. An example is apex.com.

serial

reports the serial number of the operating system.

os_name

reports the name of the operating system. Examples are LINUX, HP-UX, SUNOS, and XP_HOME.

os_version

reports the version of the operating system.

os_release

reports the release number of the operating system. Examples are Linux2.6, Linux 5, Linux 9, and Linux 11.22.

os_family

reports the family of operating system. Examples are LINUX ITANIUM, LINUX, SUN 64, HP IPF, and WIN.

jobid | pid

reports the job ID or the process ID, as appropriate.

user_name | username

reports the user name in the appropriate form.

Note:   The user_name is the identity that owns the process rather than the client identity that is associated with the current thread.   [cautionend]

For more information, see the u conversion character.
startup_cmd

reports the arguments that are specified when the application was started.

version

reports either of these versions: TK_BASE_MAJOR or TK_BASE_MINOR.

system_desc

reports a description of the hardware and software environment. Examples are X86_64 Linux, HP Itanium Processor Family, and Sun Sparc 64-bit.

build_date

reports the date on which the kernel for threaded processing was built.

build_time

reports the time at which the kernel for threaded processing was built.

sup_ver

reports the version number of the SAS supervisor.

sup_ver_long2

reports the version number of the SAS supervisor that is Y2K compliant.

Example: %S{os_family}
sn

reports the sequence number of the log event.

Alias: sequenceNumber
t

reports the identifier of the thread that generated the log event.

Alias: thread
u

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}
x

reports the NDC (nested diagnostic context) that is associated with the thread that generated the log event.

Alias: ndc
X {key}

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.

Previous Page | Next Page | Top of Page