Search in sources :

Example 26 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project knime-core by knime.

the class NodeLoggerLoggerAdapter method warn.

/**
 * Log a message at the WARN level according to the specified format and
 * arguments.
 *
 * <p>
 * This form avoids superfluous object creation when the logger is disabled
 * for the WARN level.
 * </p>
 *
 * @param format
 *          the format string
 * @param arg1
 *          the first argument
 * @param arg2
 *          the second argument
 */
@Override
public void warn(final String format, final Object arg1, final Object arg2) {
    if (isWarnEnabled()) {
        FormattingTuple ft = MessageFormatter.format(format, arg1, arg2);
        m_nodeLogger.warn(ft.getMessage(), ft.getThrowable());
    }
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 27 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project jetty.project by eclipse.

the class JettyAwareLogger method log.

private void log(Marker marker, int level, String msg, Object[] argArray, Throwable t) {
    if (argArray == null) {
        // Simple SLF4J Message (no args)
        _logger.log(marker, FQCN, level, msg, null, t);
    } else {
        int loggerLevel = _logger.isTraceEnabled() ? TRACE : _logger.isDebugEnabled() ? DEBUG : _logger.isInfoEnabled() ? INFO : _logger.isWarnEnabled() ? WARN : ERROR;
        if (loggerLevel <= level) {
            // Don't assume downstream handles argArray properly.
            // Do it the SLF4J way here to eliminate that as a bug.
            FormattingTuple ft = MessageFormatter.arrayFormat(msg, argArray);
            _logger.log(marker, FQCN, level, ft.getMessage(), null, t);
        }
    }
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 28 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project hive by apache.

the class TestLogger method info.

@Override
public void info(String format, Object[] argArray) {
    FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
    log(LEVEL.INFO, ft.getMessage(), ft.getThrowable());
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 29 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project hive by apache.

the class TestLogger method debug.

@Override
public void debug(String format, Object[] argArray) {
    FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
    log(LEVEL.DEBUG, ft.getMessage(), ft.getThrowable());
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 30 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project hive by apache.

the class TestLogger method error.

@Override
public void error(String format, Object[] argArray) {
    FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
    log(LEVEL.ERROR, ft.getMessage(), ft.getThrowable());
}
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