Search in sources :

Example 11 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project openzaly by akaxincom.

the class LogUtils method dbDebugLog.

public static void dbDebugLog(Logger logger, long startTime, Object result, String sql, Object... objects) {
    String messagePattern = sql.replace("?", "{}");
    FormattingTuple format = MessageFormatter.arrayFormat(messagePattern, objects);
    logger.debug("[openzaly-db] cost:{}ms result:{} sql:{}", System.currentTimeMillis() - startTime, result, format.getMessage());
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 12 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project openzaly by akaxincom.

the class LogUtils method requestInfoLog.

public static void requestInfoLog(Logger logger, Command command, String messagePattern, Object... objects) {
    FormattingTuple format = MessageFormatter.arrayFormat(messagePattern, objects);
    logger.info("client={} siteUserId={} action={} msg={}", command.getClientIp(), command.getSiteUserId(), command.getAction(), command.toString(), format.getMessage());
    return;
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 13 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project infrautils by opendaylight.

the class RememberingLogger method error.

@Override
public void error(String format, Object... arguments) {
    FormattingTuple mf = MessageFormatter.arrayFormat(format, arguments);
    ERRORS.add(new LogCapture(ERROR, mf.getMessage(), mf.getThrowable()));
    super.error(format, arguments);
}
Also used : LogCapture(org.opendaylight.infrautils.testutils.LogCapture) FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 14 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project Javacord by BtoBastian.

the class JavacordLogger method debug.

@Override
public final void debug(String format, Object arg1) {
    if (isDebugEnabled()) {
        FormattingTuple ft = MessageFormatter.format(format, arg1);
        LogRecord record = new LogRecord(Level.FINE, ft.getMessage());
        record.setThrown(ft.getThrowable());
        record.setLoggerName(name);
        Logger.getLogger(name).log(record);
    }
}
Also used : LogRecord(java.util.logging.LogRecord) FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 15 with FormattingTuple

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

the class FlowExecutionLog method info.

public void info(String message, Object... args) {
    FormattingTuple ft = MessageFormatter.arrayFormat(message, args);
    infos.add(new LogTask(ft.getMessage()));
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple) LogTask(alien4cloud.topology.task.LogTask)

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