Format Modifiers

Controls the field width, padding, and justification of the specified data item in log output.

Syntax

- (hyphen)
minimum-field-width-modifier
maximum-field-width-modifier

Format Modifier Descriptions

- (hyphen)
specifies left-justification of the data item that is defined by the conversion character.
Examples %-p
The p conversion character reports the level that is specified by the log event. For example, the text of the level, "WARN" is left-justified within its field in the log event.
minimum-field-width-modifier
specifies a decimal constant to indicate the minimum width of the field for the data item that is specified by the conversion character. If the data item is smaller than the minimum field width, the field is padded on either the left or the right until the minimum width is reached. The padding character is a space. If the data item exceeds the minimum field width, the field is expanded to accommodate the data item.
Default Pad on the right (left-justify)
Examples %10p
The constant value, 10, provides a minimum width for the data item that is specified by the p conversion character. For example, the text of the level, "WARN", is left-justified and is padded to the right with six spaces.
maximum-field-width-modifier
specifies a period (.) and a decimal constant to indicate the maximum width of the field for the data item that is specified by the conversion character.
Default If the data item exceeds the maximum field width, characters are left-truncated rather than right-truncated.
Restriction The behaviors of maximum-field-width-modifier in the SAS logging facility and in the C language PRINTF statement are different. The PRINTF statement uses right-truncation rather than left-truncation.
Examples %.3p is the pattern layout. "DEBUG" is the data item. "BUG" is the generated output.
The constant value, 3, provides a maximum width for the data item that is specified by the p conversion character. For example, the text of the level, "DEBUG" is left-truncated to form "BUG".

Example

Here are examples of format modifiers that are used with the c conversion character. The c conversion character reports the name of the logger.
Examples of Format Modifiers
Format Modifier
Left Justification
Minimum Width
Maximum Width
Explanation
%20c
no
20
none
If the data item occupies fewer than 20 characters, pad to the left, using spaces.
%-20c
yes
20
none
If the data item occupies fewer than 20 characters, pad to the right, using spaces.
%.30c
not applicable
none
30
If the data item exceeds 30 characters, left-truncate the data item.
%20.30c
no
20
30
If the data item occupies fewer than 20 characters, pad to the left, using spaces. If the data item exceeds 30 characters, left-truncate the data item.
%-20.30c
yes
20
30
If the data item occupies fewer than 20 characters, pad to the right, using spaces. If the data item exceeds 30 characters, left-truncate the data item.