Package org.apache.log4j.pattern
Class PatternConverter
- java.lang.Object
-
- org.apache.log4j.pattern.PatternConverter
-
- Direct Known Subclasses:
IntegerPatternConverter
,LoggingEventPatternConverter
public abstract class PatternConverter extends java.lang.Object
PatternConverter is an abstract class that provides the formatting functionality that derived classes need.
Conversion specifiers in a conversion patterns are parsed to individual PatternConverters. Each of which is responsible for converting an object in a converter specific manner.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PatternConverter(java.lang.String name, java.lang.String style)
Create a new pattern converter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
format(java.lang.Object obj, java.lang.StringBuffer toAppendTo)
Formats an object into a string buffer.java.lang.String
getName()
This method returns the name of the conversion pattern.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.
-
-
-
Method Detail
-
format
public abstract void format(java.lang.Object obj, java.lang.StringBuffer toAppendTo)
Formats an object into a string buffer.- Parameters:
obj
- event to format, may not be null.toAppendTo
- string buffer to which the formatted event will be appended. May not be null.
-
getName
public final java.lang.String getName()
This method returns the name of the conversion pattern. The name can be useful to certain Layouts such as HTMLLayout.- Returns:
- the name of the conversion pattern
-
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.- Parameters:
e
- null values are accepted- Returns:
- the name of the conversion pattern
-
-