use of org.slf4j.Marker in project logging-log4j2 by apache.
the class LoggerTest method supportsCustomSLF4JMarkers.
/**
* @see <a href="https://issues.apache.org/jira/browse/LOG4J2-793">LOG4J2-793</a>
*/
@Test
public void supportsCustomSLF4JMarkers() {
final Marker marker = new CustomFlatMarker("TEST");
logger.debug(marker, "Test");
verify("List", "o.a.l.s.LoggerTest Test MDC{}" + Strings.LINE_SEPARATOR);
}
use of org.slf4j.Marker in project logging-log4j2 by apache.
the class Log4jMarkerFactory method convertMarker.
private static org.apache.logging.log4j.Marker convertMarker(final Marker original, final Collection<Marker> visited) {
final org.apache.logging.log4j.Marker marker = MarkerManager.getMarker(original.getName());
if (original.hasReferences()) {
final Iterator<Marker> it = original.iterator();
while (it.hasNext()) {
final Marker next = it.next();
if (visited.contains(next)) {
LOGGER.warn("Found a cycle in Marker [{}]. Cycle will be broken.", next.getName());
} else {
visited.add(next);
marker.addParents(convertMarker(next, visited));
}
}
}
return marker;
}
Aggregations