public class Slf4jProperties extends Object
| Constructor and Description |
|---|
Slf4jProperties()
Constructs an empty set of slf4j properties, with most values being set to
null, 0, or empty
(depending on the type of the property). |
Slf4jProperties(Slf4jProperties properties)
Creates a set of slf4j properties from an existing set of slf4j properties, making a defensive copy.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,String> |
getAdditionalProperties() |
String |
getAuditStreamFieldName() |
String |
getMarker() |
String |
getMdcFieldNameSeparator() |
String |
getMdcFields() |
String |
getMdcFieldSeparator() |
String |
getSerializedEventFieldName() |
String |
getStringEncoding() |
void |
setAdditionalProperties(Map<String,String> additionalProperties)
Any additional properties which have not been parsed, and for which no getter/setter exists, but are to be
stored in this object nevertheless.
|
void |
setAuditStreamFieldName(String auditStreamFieldName)
Set the name to use for the audit stream field in the MDC
|
void |
setMarker(String marker)
Set the marker to identify serialized audit events in slf4j.
|
void |
setMdcFieldNameSeparator(String mdcFieldNameSeparator)
Set the field name separator character used in
setMdcFields(String)} to separate field
names in the MDC from the event field name. |
void |
setMdcFields(String mdcFields)
Set the fields to be included in the MDC, if the underlying logger supports MDC.
|
void |
setMdcFieldSeparator(String mdcFieldSeparator)
Set the MDC field separator character used in
setMdcFields(String)}. |
void |
setSerializedEventFieldName(String serializedEventFieldName)
Set the name to use for the serialized event field in the MDC
|
void |
setStringEncoding(String stringEncoding)
Set the String encoding to use when converting bytes to a String
|
public Slf4jProperties()
null, 0, or empty
(depending on the type of the property). Usually this constructor is used if this configuration POJO is populated
in an automated fashion (e.g. injection). If you need to build them manually (possibly with defaults), use or
create a properties builder.
You can change the defaults with the setters.
public Slf4jProperties(Slf4jProperties properties)
properties - The set of properties to copyNullPointerException - When properties is null()public final String getMarker()
setMarker(String)public final void setMarker(String marker)
The marker is used as a prefix that will be added to all events logged to slf4j.
marker - The marker used to mark audit message in slf4jNullPointerException - When the marker is nullIllegalArgumentException - When the marker is emptypublic final String getStringEncoding()
setStringEncoding(String)public final void setStringEncoding(String stringEncoding)
stringEncoding - The String encoding to useNullPointerException - When the stringEncoding is nullIllegalArgumentException - When the stringEncoding is emptypublic final String getAuditStreamFieldName()
setAuditStreamFieldName(String)public final void setAuditStreamFieldName(String auditStreamFieldName)
auditStreamFieldName - The name of the audit stream fieldNullPointerException - When the stringEncoding is nullIllegalArgumentException - When the stringEncoding is emptypublic final String getSerializedEventFieldName()
setSerializedEventFieldName(String)public final void setSerializedEventFieldName(String serializedEventFieldName)
serializedEventFieldName - The name of the serialized event fieldNullPointerException - When the stringEncoding is nullIllegalArgumentException - When the stringEncoding is emptypublic final String getMdcFields()
null or empty if no MDC fields have been configuredsetMdcFields(String)public final void setMdcFields(String mdcFields)
Provide a list of fields that is separated with the separation character specified in
setMdcFieldSeparator(java.lang.String). Define a mapping of
Event field names to MDC field names (i.e. names under which the
provided Event field will be made known to the MDC) as shown in the
example below, using the character specified in the setMdcFieldNameSeparator(java.lang.String).
Note that the mapping of an event field name to an MDC field name is optional. If no MDC field names separator is used for a specific field, then the event field name is used to store the field in the MDC.
Set this to null or empty if none of the event fields should be included in the MDC.
This example uses , as the MDC fields separator, and : as the MDC field names separator.
Example: eventActor:mdcActor,eventSubject,eventObject:mdcObject
mdcFields - The list of fields to be included in the MDCpublic final String getMdcFieldSeparator()
setMdcFieldSeparator(String)public final void setMdcFieldSeparator(String mdcFieldSeparator)
setMdcFields(String)}.
The length of this parameter must be equal to 1.
mdcFieldSeparator - The character used to separate fieldsNullPointerException - When the mdcFieldSeparator is nullIllegalArgumentException - When the mdcFieldSeparator is empty or its length is not 1public final String getMdcFieldNameSeparator()
setMdcFieldNameSeparator(String)public final void setMdcFieldNameSeparator(String mdcFieldNameSeparator)
setMdcFields(String)} to separate field
names in the MDC from the event field name. This allows using a different field name in the MDC than in the
event.
The length of this parameter must be equal to 1.
mdcFieldNameSeparator - The character used to separate field names in the MDC from the event field nameNullPointerException - When the mdcFieldSeparator is nullIllegalArgumentException - When the mdcFieldSeparator is empty or its length is not 1public final Map<String,String> getAdditionalProperties()
setAdditionalProperties(Map)public final void setAdditionalProperties(Map<String,String> additionalProperties)
This property is commonly used to preserve original properties from upstream components that are to be passed on to downstream components unchanged. This properties set may or may not include properties that have been extracted from the map, and been made available through this POJO.
Note that these additional properties may be null or empty, even in a fully populated POJO where
other properties commonly have values assigned to.
additionalProperties - The additional properties to storeCopyright © 2015–2016 Michael Beiter