Package org.apache.logging.log4j
Interface Marker
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
MarkerManager.Log4jMarker
public interface Marker extends java.io.SerializableMarkers 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MarkeraddParents(Marker... markers)Adds a Marker as a parent to this Marker.booleanequals(java.lang.Object obj)Returns true if the given marker has the same name as this marker.java.lang.StringgetName()Returns the name of this Marker.Marker[]getParents()Returns a list of parents of this Marker.inthashCode()Returns a hash code value based on the name of this marker.booleanhasParents()Indicates whether this Marker has references to any other Markers.booleanisInstanceOf(java.lang.String name)Checks whether this Marker is an instance of the specified Marker.booleanisInstanceOf(Marker m)Checks whether this Marker is an instance of the specified Marker.booleanremove(Marker marker)Removes the specified Marker as a parent of this Marker.MarkersetParents(Marker... markers)Replaces the set of parent Markers with the provided Markers.
-
-
-
Method Detail
-
addParents
Marker addParents(Marker... markers)
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:
java.lang.IllegalArgumentException- if the argument isnull
-
equals
boolean equals(java.lang.Object obj)
Returns true if the given marker has the same name as this marker.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the reference object with which to compare.- Returns:
- true if the given marker has the same name as this marker.
- Since:
- 2.4
-
getName
java.lang.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.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the computed hash code
- Since:
- 2.4
-
hasParents
boolean hasParents()
Indicates whether this Marker has references to any other Markers.- Returns:
trueif the Marker has parent Markers
-
isInstanceOf
boolean isInstanceOf(Marker m)
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:
java.lang.IllegalArgumentException- if the argument isnull
-
isInstanceOf
boolean isInstanceOf(java.lang.String name)
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:
java.lang.IllegalArgumentException- if the argument isnull
-
remove
boolean remove(Marker marker)
Removes the specified Marker as a parent of this Marker.- Parameters:
marker- The marker to remove.- Returns:
trueif the marker was removed.- Throws:
java.lang.IllegalArgumentException- if the argument isnull
-
-