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 intBUF_SIZEstatic java.lang.StringDEFAULT_CONVERSION_PATTERNDefault pattern string for log output.private PatternConverterheadprotected intMAX_CAPACITYprivate java.lang.Stringpatternprivate java.lang.StringBuffersbufstatic java.lang.StringTTCC_CONVERSION_PATTERNA 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(java.lang.String pattern)Constructs a PatternLayout using the supplied conversion pattern.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateOptions()Does not do anything as options become effectiveprotected PatternParsercreatePatternParser(java.lang.String pattern)Returns PatternParser used to parse the conversion string.java.lang.Stringformat(LoggingEvent event)Produces a formatted string as specified by the conversion pattern.java.lang.StringgetConversionPattern()Returns the value of the ConversionPattern option.booleanignoresThrowable()The PatternLayout does not handle the throwable contained withinLoggingEvents.voidsetConversionPattern(java.lang.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 java.lang.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 java.lang.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
-
sbuf
private java.lang.StringBuffer sbuf
-
pattern
private java.lang.String pattern
-
head
private PatternConverter head
-
-
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(java.lang.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(java.lang.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 java.lang.String format(LoggingEvent event)
Produces a formatted string as specified by the conversion pattern.
-
getConversionPattern
public java.lang.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:
ignoresThrowablein classLayout- Returns:
- true if the Layout ignores Throwables.
- Since:
- 0.8.4
-
setConversionPattern
public void setConversionPattern(java.lang.String conversionPattern)
Set the ConversionPattern option. This is the string which controls formatting and consists of a mix of literal content and conversion specifiers.
-
-