Search in sources :

Example 16 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project killbill by killbill.

the class SpyLogger method formatAndSave.

private void formatAndSave(String logLevel, String format, Object arg1, Object arg2) {
    FormattingTuple tp = MessageFormatter.format(format, arg1, arg2);
    save(logLevel, tp.getMessage(), tp.getThrowable());
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 17 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project jfinal by jfinal.

the class Slf4jLog method error.

public void error(String format, Object... args) {
    if (isErrorEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, args);
        log.log(null, callerFQCN, LocationAwareLogger.ERROR_INT, ft.getMessage(), NULL_ARGS, ft.getThrowable());
    }
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 18 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project new-cloud by xie-summer.

the class SimpleLogger method entry.

/**
 * Log method entry.
 *
 * @param argArray supplied parameters
 */
public void entry(Object... argArray) {
    if (instanceofLAL && logger.isTraceEnabled(ENTRY_MARKER)) {
        String messagePattern = null;
        if (argArray.length < ENTRY_MESSAGE_ARRAY_LEN) {
            messagePattern = ENTRY_MESSAGE_ARRAY[argArray.length];
        } else {
            messagePattern = buildMessagePattern(argArray.length);
        }
        FormattingTuple tp = MessageFormatter.arrayFormat(messagePattern, argArray);
        ((LocationAwareLogger) logger).log(ENTRY_MARKER, FQCN, LocationAwareLogger.TRACE_INT, tp.getMessage(), argArray, tp.getThrowable());
    }
}
Also used : LocationAwareLogger(org.slf4j.spi.LocationAwareLogger) FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 19 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project new-cloud by xie-summer.

the class JsonLogger method entry.

/**
 * Log method entry.
 *
 * @param argArray
 *           supplied parameters
 */
public void entry(Object... argArray) {
    if (instanceofLAL && logger.isTraceEnabled(ENTRY_MARKER)) {
        String messagePattern = null;
        if (argArray.length < ENTRY_MESSAGE_ARRAY_LEN) {
            messagePattern = ENTRY_MESSAGE_ARRAY[argArray.length];
        } else {
            messagePattern = buildMessagePattern(argArray.length);
        }
        FormattingTuple tp = MessageFormatter.arrayFormat(messagePattern, argArray);
        ((LocationAwareLogger) logger).log(ENTRY_MARKER, FQCN, LocationAwareLogger.TRACE_INT, tp.getMessage(), argArray, tp.getThrowable());
    }
}
Also used : LocationAwareLogger(org.slf4j.spi.LocationAwareLogger) FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 20 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project gradle by gradle.

the class BuildOperationAwareLogger method log.

private void log(LogLevel logLevel, Throwable throwable, String format, Object[] args) {
    FormattingTuple tuple = MessageFormatter.arrayFormat(format, args);
    Throwable loggedThrowable = throwable == null ? tuple.getThrowable() : throwable;
    log(logLevel, loggedThrowable, tuple.getMessage());
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Aggregations

FormattingTuple (org.slf4j.helpers.FormattingTuple)61 LocationAwareLogger (org.slf4j.spi.LocationAwareLogger)5 LogRecord (java.util.logging.LogRecord)4 LogTask (alien4cloud.topology.task.LogTask)3 LogCapture (org.opendaylight.infrautils.testutils.LogCapture)2 DolphinLoggerBridge (com.canoo.platform.logging.spi.DolphinLoggerBridge)1 LogMessage (com.canoo.platform.logging.spi.LogMessage)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 JsonObject (javax.json.JsonObject)1 Test (org.junit.Test)1