public class EnhancedPropertyConverter extends ClassicConverter
PropertyConverter
with the option to specify a default
value to use when the property does not exist instead of returning null
as does
the original Logback implementation.
The default value is optional and can be specified using the :-
operator as
in Bash shell. For example, assuming the property "foo" is not defined, %property{foo:-bar}
will return bar
.
If no optional value is declared, the converter returns an empty string instead of null
if the property is not defined.
The property resolution mechanism is the same as the Logback implementation. The property is first looked up in the context associated with the logging event. If not found, the property is searched in the System environment.
started
Constructor and Description |
---|
EnhancedPropertyConverter() |
Modifier and Type | Method and Description |
---|---|
String |
convert(ILoggingEvent event) |
void |
start() |
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getFirstOption, getOptionList, isStarted, setContext, setOptionList, stop
getFormattingInfo, setFormattingInfo, write
public void start()
start
in interface LifeCycle
start
in class DynamicConverter<ILoggingEvent>
public String convert(ILoggingEvent event)
convert
in class Converter<ILoggingEvent>
Copyright © 2013–2022. All rights reserved.