Log4j Format Specification: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 16: Line 16:


The pattern layout is defined by a ''pattern string'', where various element of a log event can be specified and the way they are intended to be displayed in a log file described. The format of the result depends on the ''conversion pattern'', which is closely related to the conversion pattern of the [[printf]] function in C. The conversion pattern is composed of:
The pattern layout is defined by a ''pattern string'', where various element of a log event can be specified and the way they are intended to be displayed in a log file described. The format of the result depends on the ''conversion pattern'', which is closely related to the conversion pattern of the [[printf]] function in C. The conversion pattern is composed of:
* literal text - which may include special characters (\t, \n \r \f).
* [[#Literal_Text|literal text]]
* conversion specifiers
* [[#Conversion_Specifier|conversion specifiers]]
 
==Literal Text==
 
Literal text may include special characters (\t, \n \r \f).
 
==Conversion Specifier==


==Format Modifier==
==Format Modifier==


A ''format modifier'' modifies how the data generated by the pattern layout element
A ''format modifier'' modifies how the data generated by the pattern layout element

Revision as of 17:41, 15 November 2017

External

Internal

Overview

log4j calls its output format layout. Most commonly used is the pattern layout.

Pattern Layout

http://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout

The pattern layout is defined by a pattern string, where various element of a log event can be specified and the way they are intended to be displayed in a log file described. The format of the result depends on the conversion pattern, which is closely related to the conversion pattern of the printf function in C. The conversion pattern is composed of:

Literal Text

Literal text may include special characters (\t, \n \r \f).

Conversion Specifier

Format Modifier

A format modifier modifies how the data generated by the pattern layout element