@Plugin(name="maxLength", category="Converter") public final class MaxLengthConverter extends LogEventPatternConverter
"%maxLen{[AppName, ${hostName}, ${web:contextPath}] %p: %c{1} - %m%notEmpty{ =>%ex{short}}}{160}"
Modifier and Type | Field and Description |
---|---|
private java.util.List<PatternFormatter> |
formatters |
private int |
maxLength |
LOGGER
CATEGORY
Modifier | Constructor and Description |
---|---|
private |
MaxLengthConverter(java.util.List<PatternFormatter> formatters,
int maxLength)
Construct the converter.
|
Modifier and Type | Method and Description |
---|---|
void |
format(LogEvent event,
java.lang.StringBuilder toAppendTo)
Formats an event into a string buffer.
|
static MaxLengthConverter |
newInstance(Configuration config,
java.lang.String[] options)
Gets an instance of the class.
|
format, handlesThrowable, isVariable
getName, getStyleClass
private final java.util.List<PatternFormatter> formatters
private final int maxLength
private MaxLengthConverter(java.util.List<PatternFormatter> formatters, int maxLength)
formatters
- The PatternFormatters to generate the text to manipulate.maxLength
- The max. length of the resulting string. Ellipsis ("...") is appended on shorted string, if greater than 20.public static MaxLengthConverter newInstance(Configuration config, java.lang.String[] options)
config
- The current Configuration.options
- pattern options, an array of two elements: pattern, max length (defaults to 100 on invalid value).public void format(LogEvent event, java.lang.StringBuilder toAppendTo)
LogEventPatternConverter
format
in class LogEventPatternConverter
event
- event to format, may not be null.toAppendTo
- string buffer to which the formatted event will be appended. May not be null.