Class AbstractStyleNameConverter
java.lang.Object
org.apache.logging.log4j.core.pattern.AbstractPatternConverter
org.apache.logging.log4j.core.pattern.LogEventPatternConverter
org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter
- All Implemented Interfaces:
PatternConverter
- Direct Known Subclasses:
AbstractStyleNameConverter.Black,AbstractStyleNameConverter.Blue,AbstractStyleNameConverter.Cyan,AbstractStyleNameConverter.Green,AbstractStyleNameConverter.Magenta,AbstractStyleNameConverter.Red,AbstractStyleNameConverter.White,AbstractStyleNameConverter.Yellow
Style pattern converter. Adds ANSI color styling to the result of the enclosed pattern.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBlack style pattern converter.static final classBlue style pattern converter.static final classCyan style pattern converter.static final classGreen style pattern converter.static final classMagenta style pattern converter.static final classRed style pattern converter.static final classWhite style pattern converter.static final classYellow style pattern converter. -
Field Summary
Fields inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter
LOGGERFields inherited from interface org.apache.logging.log4j.core.pattern.PatternConverter
CATEGORY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractStyleNameConverter(String name, List<PatternFormatter> formatters, String styling) Constructs the converter. -
Method Summary
Modifier and TypeMethodDescriptionvoidformat(LogEvent event, StringBuilder toAppendTo) Formats an event into a string buffer.booleanTests whether this pattern converter is renders aThrowable.protected static <T extends AbstractStyleNameConverter>
TnewInstance(Class<T> asnConverterClass, String name, Configuration config, String[] options) Gets an instance of the class (called via reflection).Methods inherited from class org.apache.logging.log4j.core.pattern.LogEventPatternConverter
emptyVariableOutput, format, isVariableMethods inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter
getName, getStyleClass
-
Constructor Details
-
AbstractStyleNameConverter
protected AbstractStyleNameConverter(String name, List<PatternFormatter> formatters, String styling) Constructs the converter.- Parameters:
formatters- The PatternFormatters to generate the text to manipulate.styling- The styling that should encapsulate the pattern.
-
-
Method Details
-
newInstance
protected static <T extends AbstractStyleNameConverter> T newInstance(Class<T> asnConverterClass, String name, Configuration config, String[] options) Gets an instance of the class (called via reflection).- Parameters:
config- The current Configuration.options- The pattern options, may be null. If the first element is "short", only the first line of the throwable will be formatted.- Returns:
- new instance of class or null
-
format
Formats an event into a string buffer.- Specified by:
formatin classLogEventPatternConverter- Parameters:
event- event to format, may not be null.toAppendTo- string buffer to which the formatted event will be appended. May not be null.
-
handlesThrowable
public boolean handlesThrowable()Description copied from class:LogEventPatternConverterTests whether this pattern converter is renders aThrowable.The
PatternParserchecks this flag when processing thealwaysWriteExceptionsoption: if no converter in the pattern handles throwables, the parser automatically appends a converter to ensure exceptions are still written.- Overrides:
handlesThrowablein classLogEventPatternConverter- Returns:
trueif this converter consumes and renders aThrowable,falseotherwise
-