Class LevelPatternConverter
- java.lang.Object
-
- org.apache.logging.log4j.core.pattern.AbstractPatternConverter
-
- org.apache.logging.log4j.core.pattern.LogEventPatternConverter
-
- org.apache.logging.log4j.core.pattern.LevelPatternConverter
-
- All Implemented Interfaces:
PatternConverter
- Direct Known Subclasses:
LevelPatternConverter.LevelMapLevelPatternConverter,LevelPatternConverter.SimpleLevelPatternConverter
@Plugin(name="LevelPatternConverter", category="Converter") public class LevelPatternConverter extends LogEventPatternConverter
Returns the event's level in a StringBuilder.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classLevelPatternConverter.LevelMapLevelPatternConverterprivate static classLevelPatternConverter.SimpleLevelPatternConverter
-
Field Summary
Fields Modifier and Type Field Description private static LevelPatternConverterINSTANCESingleton.private static java.lang.StringOPTION_LENGTHprivate static java.lang.StringOPTION_LOWER-
Fields inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter
LOGGER
-
Fields inherited from interface org.apache.logging.log4j.core.pattern.PatternConverter
CATEGORY
-
-
Constructor Summary
Constructors Modifier Constructor Description privateLevelPatternConverter()Private constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidformat(LogEvent event, java.lang.StringBuilder output)Formats an event into a string buffer.java.lang.StringgetStyleClass(java.lang.Object e)This method returns the CSS style class that should be applied to the LoggingEvent passed as parameter, which can be null.private static java.lang.Stringleft(Level level, int length)Returns the leftmost chars of the level name for the given level.static LevelPatternConverternewInstance(java.lang.String[] options)Obtains an instance of pattern converter.-
Methods inherited from class org.apache.logging.log4j.core.pattern.LogEventPatternConverter
format, handlesThrowable, isVariable
-
Methods inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter
getName
-
-
-
-
Field Detail
-
OPTION_LENGTH
private static final java.lang.String OPTION_LENGTH
- See Also:
- Constant Field Values
-
OPTION_LOWER
private static final java.lang.String OPTION_LOWER
- See Also:
- Constant Field Values
-
INSTANCE
private static final LevelPatternConverter INSTANCE
Singleton.
-
-
Method Detail
-
newInstance
public static LevelPatternConverter newInstance(java.lang.String[] options)
Obtains an instance of pattern converter.- Parameters:
options- options, may be null. May contain a list of level names and The value that should be displayed for the Level.- Returns:
- instance of pattern converter.
-
left
private static java.lang.String left(Level level, int length)
Returns the leftmost chars of the level name for the given level.- Parameters:
level- The levellength- How many chars to return- Returns:
- The abbreviated level name, or the whole level name if the
lengthis greater than the level name length,
-
format
public void format(LogEvent event, java.lang.StringBuilder output)
Formats an event into a string buffer.- Specified by:
formatin classLogEventPatternConverter- Parameters:
event- event to format, may not be null.output- string buffer to which the formatted event will be appended. May not be null.
-
getStyleClass
public java.lang.String getStyleClass(java.lang.Object e)
This method returns the CSS style class that should be applied to the LoggingEvent passed as parameter, which can be null.This information is currently used only by HtmlLayout.
- Specified by:
getStyleClassin interfacePatternConverter- Overrides:
getStyleClassin classAbstractPatternConverter- Parameters:
e- null values are accepted- Returns:
- the name of the conversion pattern
-
-