Package org.apache.logging.log4j
Interface Marker
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
MarkerManager.Log4jMarker
Markers are objects that are used to add easily filterable information to log messages.
Markers can be hierarchical - each Marker may have a parent. This allows for broad categories being subdivided into
more specific categories. An example might be a Marker named "Error" with children named "SystemError" and
"ApplicationError".
-
Method Summary
Modifier and TypeMethodDescriptionaddParents(Marker... markers) Adds a Marker as a parent to this Marker.booleanReturns true if the given marker has the same name as this marker.getName()Returns the name of this Marker.Marker[]Returns a list of parents of this Marker.inthashCode()Returns a hash code value based on the name of this marker.booleanIndicates whether this Marker has references to any other Markers.booleanisInstanceOf(String name) Checks whether this Marker is an instance of the specified Marker.booleanChecks whether this Marker is an instance of the specified Marker.booleanRemoves the specified Marker as a parent of this Marker.setParents(Marker... markers) Replaces the set of parent Markers with the provided Markers.
-
Method Details
-
addParents
Adds a Marker as a parent to this Marker.- Parameters:
markers- The parent markers to add.- Returns:
- The current Marker object, thus allowing multiple adds to be concatenated.
- Throws:
IllegalArgumentException- if the argument isnull
-
equals
Returns true if the given marker has the same name as this marker. -
getName
String getName()Returns the name of this Marker.- Returns:
- The name of the Marker.
-
getParents
Marker[] getParents()Returns a list of parents of this Marker.- Returns:
- The parent Markers or
nullif this Marker has no parents.
-
hashCode
int hashCode()Returns a hash code value based on the name of this marker. Markers are equal if they have the same name. -
hasParents
boolean hasParents()Indicates whether this Marker has references to any other Markers.- Returns:
trueif the Marker has parent Markers
-
isInstanceOf
Checks whether this Marker is an instance of the specified Marker.- Parameters:
m- The Marker to check.- Returns:
trueif this Marker or one of its ancestors is the specified Marker,falseotherwise.- Throws:
IllegalArgumentException- if the argument isnull
-
isInstanceOf
Checks whether this Marker is an instance of the specified Marker.- Parameters:
name- The name of the Marker.- Returns:
trueif this Marker or one of its ancestors matches the specified name,falseotherwise.- Throws:
IllegalArgumentException- if the argument isnull
-
remove
Removes the specified Marker as a parent of this Marker.- Parameters:
marker- The marker to remove.- Returns:
trueif the marker was removed.- Throws:
IllegalArgumentException- if the argument isnull
-
setParents
Replaces the set of parent Markers with the provided Markers.- Parameters:
markers- The new set of parent Markers ornullto clear the parents.- Returns:
- The current Marker object.
-