Java Code Examples for org.slf4j.Marker#add()

The following examples show how to use org.slf4j.Marker#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Metadata.java    From ja-micro with Apache License 2.0 6 votes vote down vote up
public Marker getLoggingMarker() {
    // If we get more optional header fields, we should probably exclude them if they are empty.
    Marker messageMarker =
            append("messageId", messageId)
                    .and(append("partitionId", partitionId))
                    .and(append("partitioningKey", partitioningKey))
                    .and(append("offset", offset))
                    .and(append("messageId", messageId))
                    .and(append("correlationId", correlationId))
                    .and(append("requestCorrelationId", requestCorrelationId));


    // Nota bene: without the toString the marker tries to convert the object into Json, which produces strange results
    if (topic != null) {
        messageMarker.add(append("topic", topic.toString()));
    }
    if (replyTo != null) {
        messageMarker.add(append("replyTo", replyTo.toString()));
    }
    if (type != null) {
        messageMarker.add(append("messageType", type.toString()));
    }

    return messageMarker;
}
 
Example 2
Source File: TestAppLog.java    From cf-java-logging-support with Apache License 2.0 6 votes vote down vote up
@Test
public void testCategorties() {
    logMsg = "Running testCategories()";
    Marker cat0 = MarkerFactory.getMarker("cat0");

    LOGGER.info(cat0, logMsg);
    assertThat(getMessage(), is(logMsg));
    assertThat(getField(Fields.COMPONENT_ID), is("-"));
    assertThat(getField(Fields.COMPONENT_NAME), is("-"));
    assertThat(getField(Fields.COMPONENT_INSTANCE), is("0"));
    assertThat(getField(Fields.WRITTEN_TS), is(notNullValue()));
    assertThat(getList(Fields.CATEGORIES), contains(cat0.getName()));

    Marker cat1 = MarkerFactory.getMarker("cat1");
    cat1.add(cat0);

    LOGGER.info(cat1, logMsg);
    assertThat(getMessage(), is(logMsg));
    assertThat(getField(Fields.COMPONENT_ID), is("-"));
    assertThat(getField(Fields.COMPONENT_NAME), is("-"));
    assertThat(getField(Fields.COMPONENT_INSTANCE), is("0"));
    assertThat(getField(Fields.WRITTEN_TS), is(notNullValue()));
    assertThat(getList(Fields.CATEGORIES), contains(cat1.getName(), cat0.getName()));
}
 
Example 3
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void error(Marker marker, String msg) {
    marker.add(formatMessage(getMessage(msg)));
    root.error(marker, msg);
}
 
Example 4
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void warn(Marker marker, String msg) {
    marker.add(formatMessage(getMessage(msg)));
    root.warn(marker, msg);
}
 
Example 5
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void info(Marker marker, String format, Object... arguments) {
    marker.add(formatMessage(getMessage(format)));
    root.info(marker, format, arguments);
}
 
Example 6
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void warn(Marker marker, String format, Object... arguments) {
    marker.add(formatMessage(getMessage(format)));
    root.warn(marker, format, arguments);
}
 
Example 7
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void info(Marker marker, String format, Object arg) {
    marker.add(formatMessage(getMessage(format)));
    root.info(marker, format, arg);
}
 
Example 8
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void info(Marker marker, String msg) {
    marker.add(formatMessage(getMessage(msg)));
    root.info(marker, msg);
}
 
Example 9
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void debug(Marker marker, String msg, Throwable t) {
    marker.add(formatMessage(getMessage(msg)));
    root.debug(marker, msg, t);
}
 
Example 10
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void debug(Marker marker, String format, Object... arguments) {
    marker.add(formatMessage(getMessage(format)));
    root.debug(marker, format, arguments);
}
 
Example 11
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void error(Marker marker, String format, Object... arguments) {
    marker.add(formatMessage(getMessage(format)));
    root.error(marker, format, arguments);
}
 
Example 12
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void debug(Marker marker, String format, Object arg) {
    marker.add(formatMessage(getMessage(format)));
    root.debug(marker, format, arg);
}
 
Example 13
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void debug(Marker marker, String msg) {
    marker.add(formatMessage(getMessage(msg)));
    root.debug(marker, msg);
}
 
Example 14
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void warn(Marker marker, String format, Object arg1, Object arg2) {
    marker.add(formatMessage(getMessage(format)));
    root.warn(marker, format, arg1, arg2);
}
 
Example 15
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void error(Marker marker, String format, Object arg1, Object arg2) {
    marker.add(formatMessage(getMessage(format)));
    root.error(marker, format, arg1, arg2);
}
 
Example 16
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void trace(Marker marker, String format, Object arg1, Object arg2) {
    marker.add(formatMessage(getMessage(format)));
    root.trace(marker, format, arg1, arg2);
}
 
Example 17
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void trace(Marker marker, String format, Object arg) {
    marker.add(formatMessage(getMessage(format)));
    root.trace(marker, format, arg);
}
 
Example 18
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void trace(Marker marker, String msg) {
    marker.add(formatMessage(getMessage(msg)));
    root.trace(marker, msg);
}
 
Example 19
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void warn(Marker marker, String msg, Throwable t) {
    marker.add(formatMessage(getMessage(msg)));
    root.warn(marker, msg, t);
}
 
Example 20
Source File: MarkerAppendingLogger.java    From godaddy-logger with MIT License 4 votes vote down vote up
@Override
public void error(Marker marker, String msg, Throwable t) {
    marker.add(formatMessage(getMessage(msg)));
    root.error(marker, msg, t);
}