Package org.apache.log4j
Class PatternLayout
java.lang.Object
org.apache.log4j.Layout
org.apache.log4j.PatternLayout
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int
static final String
Default pattern string for log output.private PatternConverter
protected final int
private String
private StringBuffer
static final String
A conversion pattern equivalent to the TTCCCLayout.Fields inherited from class org.apache.log4j.Layout
LINE_SEP, LINE_SEP_LEN
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a PatternLayout using the DEFAULT_LAYOUT_PATTERN.PatternLayout
(String pattern) Constructs a PatternLayout using the supplied conversion pattern. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Does not do anything as options become effectiveprotected PatternParser
createPatternParser
(String pattern) Returns PatternParser used to parse the conversion string.format
(LoggingEvent event) Produces a formatted string as specified by the conversion pattern.Returns the value of the ConversionPattern option.boolean
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 Details
-
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:
-
TTCC_CONVERSION_PATTERN
A conversion pattern equivalent to the TTCCCLayout. Current value is "%r [%t] %p %c %x - %m%n"- See Also:
-
BUF_SIZE
protected final int BUF_SIZE- See Also:
-
MAX_CAPACITY
protected final int MAX_CAPACITY- See Also:
-
sbuf
-
pattern
-
head
-
-
Constructor Details
-
PatternLayout
public PatternLayout()Constructs a PatternLayout using the DEFAULT_LAYOUT_PATTERN. The default pattern just produces the application supplied message. -
PatternLayout
Constructs a PatternLayout using the supplied conversion pattern.
-
-
Method Details
-
activateOptions
public void activateOptions()Does not do anything as options become effective -
createPatternParser
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
Produces a formatted string as specified by the conversion pattern. -
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
Set the ConversionPattern option. This is the string which controls formatting and consists of a mix of literal content and conversion specifiers.
-