Package org.apache.logging.slf4j
Class Log4jMarkerFactory
java.lang.Object
org.apache.logging.slf4j.Log4jMarkerFactory
- All Implemented Interfaces:
org.slf4j.IMarkerFactory
Log4j/SLF4J bridge to create SLF4J Markers based on name or based on existing SLF4J Markers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Logger
private final ConcurrentMap<String,
org.slf4j.Marker> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.slf4j.Marker
addMarkerIfAbsent
(String name, Marker log4jMarker) private static Marker
convertMarker
(org.slf4j.Marker original) private static Marker
convertMarker
(org.slf4j.Marker original, Collection<org.slf4j.Marker> visited) boolean
detachMarker
(String name) Log4j does not support detached Markers.boolean
Returns true if the Marker exists.org.slf4j.Marker
getDetachedMarker
(String name) Log4j does not support detached Markers for performance reasons.org.slf4j.Marker
Returns a Log4j Marker that is compatible with SLF4J.org.slf4j.Marker
getMarker
(org.slf4j.Marker marker) Returns a Log4j Marker converted from an existing custom SLF4J Marker.
-
Field Details
-
LOGGER
-
markerMap
-
-
Constructor Details
-
Log4jMarkerFactory
public Log4jMarkerFactory()
-
-
Method Details
-
getMarker
Returns a Log4j Marker that is compatible with SLF4J.- Specified by:
getMarker
in interfaceorg.slf4j.IMarkerFactory
- Parameters:
name
- The name of the Marker.- Returns:
- A Marker.
-
addMarkerIfAbsent
-
getMarker
public org.slf4j.Marker getMarker(org.slf4j.Marker marker) Returns a Log4j Marker converted from an existing custom SLF4J Marker.- Parameters:
marker
- The SLF4J Marker to convert.- Returns:
- A converted Log4j/SLF4J Marker.
- Since:
- 2.1
-
convertMarker
-
convertMarker
private static Marker convertMarker(org.slf4j.Marker original, Collection<org.slf4j.Marker> visited) -
exists
Returns true if the Marker exists.- Specified by:
exists
in interfaceorg.slf4j.IMarkerFactory
- Parameters:
name
- The Marker name.- Returns:
true
if the Marker exists,false
otherwise.
-
detachMarker
Log4j does not support detached Markers. This method always returns false.- Specified by:
detachMarker
in interfaceorg.slf4j.IMarkerFactory
- Parameters:
name
- The Marker name.- Returns:
false
-
getDetachedMarker
Log4j does not support detached Markers for performance reasons. The returned Marker is attached.- Specified by:
getDetachedMarker
in interfaceorg.slf4j.IMarkerFactory
- Parameters:
name
- The Marker name.- Returns:
- The named Marker (unmodified).
-