Package org.apache.log4j
Class PatternLayout
- java.lang.Object
-
- org.apache.log4j.Layout
-
- org.apache.log4j.PatternLayout
-
public class PatternLayout extends Layout
-
-
Field Summary
Fields Modifier and Type Field Description protected int
BUF_SIZE
static String
DEFAULT_CONVERSION_PATTERN
Default pattern string for log output.protected int
MAX_CAPACITY
static String
TTCC_CONVERSION_PATTERN
A conversion pattern equivalent to the TTCCCLayout.-
Fields inherited from class org.apache.log4j.Layout
LINE_SEP, LINE_SEP_LEN
-
-
Constructor Summary
Constructors Constructor Description PatternLayout()
Constructs a PatternLayout using the DEFAULT_LAYOUT_PATTERN.PatternLayout(String pattern)
Constructs a PatternLayout using the supplied conversion pattern.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateOptions()
Does not do anything as options become effectiveprotected PatternParser
createPatternParser(String pattern)
Returns PatternParser used to parse the conversion string.String
format(LoggingEvent event)
Produces a formatted string as specified by the conversion pattern.String
getConversionPattern()
Returns the value of the ConversionPattern option.boolean
ignoresThrowable()
The PatternLayout does not handle the throwable contained withinLoggingEvents
.void
setConversionPattern(String conversionPattern)
Set the ConversionPattern option.-
Methods inherited from class org.apache.log4j.Layout
getContentType, getFooter, getHeader
-
-
-
-
Field Detail
-
DEFAULT_CONVERSION_PATTERN
public static final String DEFAULT_CONVERSION_PATTERN
Default pattern string for log output. Currently set to the string "%m%n" which just prints the application supplied message.- See Also:
- Constant Field Values
-
TTCC_CONVERSION_PATTERN
public static final String TTCC_CONVERSION_PATTERN
A conversion pattern equivalent to the TTCCCLayout. Current value is "%r [%t] %p %c %x - %m%n"- See Also:
- Constant Field Values
-
BUF_SIZE
protected final int BUF_SIZE
- See Also:
- Constant Field Values
-
MAX_CAPACITY
protected final int MAX_CAPACITY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PatternLayout
public PatternLayout()
Constructs a PatternLayout using the DEFAULT_LAYOUT_PATTERN. The default pattern just produces the application supplied message.
-
PatternLayout
public PatternLayout(String pattern)
Constructs a PatternLayout using the supplied conversion pattern.
-
-
Method Detail
-
activateOptions
public void activateOptions()
Does not do anything as options become effective
-
createPatternParser
protected PatternParser createPatternParser(String pattern)
Returns PatternParser used to parse the conversion string. Subclasses may override this to return a subclass of PatternParser which recognize custom conversion characters.- Since:
- 0.9.0
-
format
public String format(LoggingEvent event)
Produces a formatted string as specified by the conversion pattern.
-
getConversionPattern
public String getConversionPattern()
Returns the value of the ConversionPattern option.
-
ignoresThrowable
public boolean ignoresThrowable()
The PatternLayout does not handle the throwable contained withinLoggingEvents
. Thus, it returnstrue
.- Specified by:
ignoresThrowable
in classLayout
- Returns:
- true if the Layout ignores Throwables.
- Since:
- 0.8.4
-
setConversionPattern
public void setConversionPattern(String conversionPattern)
Set the ConversionPattern option. This is the string which controls formatting and consists of a mix of literal content and conversion specifiers.
-
-