use of org.apache.logging.log4j.Marker in project logging-log4j2 by apache.
the class PatternLayoutBenchmark method createLogEvent.
private static LogEvent createLogEvent() {
final Marker marker = null;
final String fqcn = "com.mycom.myproject.mypackage.MyClass";
final Level level = Level.DEBUG;
final Message message = new SimpleMessage(STR);
final Throwable t = null;
final Map<String, String> mdc = null;
final ContextStack ndc = null;
final String threadName = null;
final StackTraceElement location = null;
final long timestamp = 12345678;
return //
Log4jLogEvent.newBuilder().setLoggerName(//
"name(ignored)").setMarker(//
marker).setLoggerFqcn(//
fqcn).setLevel(//
level).setMessage(//
message).setThrown(//
t).setContextMap(//
mdc).setContextStack(//
ndc).setThreadName(//
threadName).setSource(//
location).setTimeMillis(//
timestamp).build();
}
use of org.apache.logging.log4j.Marker in project logging-log4j2 by apache.
the class GelfLayoutBenchmark method createLogEvent.
private static LogEvent createLogEvent() {
final Marker marker = null;
final String fqcn = "com.mycom.myproject.mypackage.MyClass";
final org.apache.logging.log4j.Level level = org.apache.logging.log4j.Level.DEBUG;
final Message message = new SimpleMessage(MESSAGE);
final Throwable t = null;
final Map<String, String> mdc = null;
final ThreadContext.ContextStack ndc = null;
final String threadName = null;
final StackTraceElement location = null;
final long timestamp = 12345678;
return //
Log4jLogEvent.newBuilder().setLoggerName(//
"name(ignored)").setMarker(//
marker).setLoggerFqcn(//
fqcn).setLevel(//
level).setMessage(//
message).setThrown(//
t).setContextMap(//
mdc).setContextStack(//
ndc).setThreadName(//
threadName).setSource(//
location).setTimeMillis(//
timestamp).build();
}
use of org.apache.logging.log4j.Marker in project logging-log4j2 by apache.
the class MarkerTest method testRemoveNullMarker.
@Test
public void testRemoveNullMarker() {
final String childMakerName = CHILD_MAKER_NAME + "-CM";
final String parentMakerName = PARENT_MARKER_NAME + "-CM";
final org.slf4j.Marker slf4jMarker = org.slf4j.MarkerFactory.getMarker(childMakerName);
final org.slf4j.Marker slf4jParent = org.slf4j.MarkerFactory.getMarker(parentMakerName);
slf4jMarker.add(slf4jParent);
final Marker log4jParent = MarkerManager.getMarker(parentMakerName);
final Marker log4jMarker = MarkerManager.getMarker(childMakerName);
final Log4jMarker log4jSlf4jParent = new Log4jMarker(log4jParent);
final Log4jMarker log4jSlf4jMarker = new Log4jMarker(log4jMarker);
final org.slf4j.Marker nullMarker = null;
Assert.assertFalse(log4jSlf4jParent.remove(nullMarker));
Assert.assertFalse(log4jSlf4jMarker.remove(nullMarker));
}
use of org.apache.logging.log4j.Marker in project logging-log4j2 by apache.
the class MarkerTest method testContainsNullString.
@Test
public void testContainsNullString() {
final String childMarkerName = CHILD_MAKER_NAME + "-CS";
final String parentMakerName = PARENT_MARKER_NAME + "-CS";
final org.slf4j.Marker slf4jMarker = org.slf4j.MarkerFactory.getMarker(childMarkerName);
final org.slf4j.Marker slf4jParent = org.slf4j.MarkerFactory.getMarker(parentMakerName);
slf4jMarker.add(slf4jParent);
final Marker log4jParent = MarkerManager.getMarker(parentMakerName);
final Marker log4jMarker = MarkerManager.getMarker(childMarkerName);
final Log4jMarker log4jSlf4jParent = new Log4jMarker(log4jParent);
final Log4jMarker log4jSlf4jMarker = new Log4jMarker(log4jMarker);
final String nullStr = null;
Assert.assertFalse(log4jSlf4jParent.contains(nullStr));
Assert.assertFalse(log4jSlf4jMarker.contains(nullStr));
}
use of org.apache.logging.log4j.Marker in project logging-log4j2 by apache.
the class MarkerTest method testEquals.
@Test
public void testEquals() {
final String childMarkerName = CHILD_MAKER_NAME + "-ASM";
final String parentMakerName = PARENT_MARKER_NAME + "-ASM";
final org.slf4j.Marker slf4jMarker = org.slf4j.MarkerFactory.getMarker(childMarkerName);
final org.slf4j.Marker slf4jMarker2 = org.slf4j.MarkerFactory.getMarker(childMarkerName);
final org.slf4j.Marker slf4jParent = org.slf4j.MarkerFactory.getMarker(parentMakerName);
slf4jMarker.add(slf4jParent);
final Marker log4jParent = MarkerManager.getMarker(parentMakerName);
final Marker log4jMarker = MarkerManager.getMarker(childMarkerName);
final Marker log4jMarker2 = MarkerManager.getMarker(childMarkerName);
assertEquals(log4jParent, log4jParent);
assertEquals(log4jMarker, log4jMarker);
assertEquals(log4jMarker, log4jMarker2);
assertEquals(slf4jMarker, slf4jMarker2);
assertNotEquals(log4jParent, log4jMarker);
assertNotEquals(log4jMarker, log4jParent);
}
Aggregations