Previous Page | Next Page

Pattern Layout

Format Modifiers

A format modifier is an optional set of characters that controls the field width, padding, and justification of the specified data item in log output. Here are the supported format modifiers:

- (hyphen)

specifies left-justification of the data item that is defined by the conversion character.

Example: %-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

specified as 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)
Example: %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.

Tip: The value is never truncated. To specify a maximum width, use the maximum-field-width-modifier.
maximum-field-width-modifier

specified as 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.
Example: %.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".

Restriction: The behaviors of the 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.

Previous Page | Next Page | Top of Page