当前位置: 首页>>代码示例>>Java>>正文


Java MessageFormatter.arrayFormat方法代码示例

本文整理汇总了Java中org.slf4j.helpers.MessageFormatter.arrayFormat方法的典型用法代码示例。如果您正苦于以下问题:Java MessageFormatter.arrayFormat方法的具体用法?Java MessageFormatter.arrayFormat怎么用?Java MessageFormatter.arrayFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.slf4j.helpers.MessageFormatter的用法示例。


在下文中一共展示了MessageFormatter.arrayFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: log

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
public void log(String messageId, Object[] args, boolean status, UUID housingUnitId, UUID projectId,
		UUID clientId) {
	FormattingTuple tp = null;

	try {
		tp = MessageFormatter.arrayFormat(env.getProperty(messageId), args);

	} catch (Exception e) {
		tp = MessageFormatter.arrayFormat("Message foormat tewst {} with tuple {}", new Object[] { "param1" });
	}

	MatchProcessLogEntity entity = new MatchProcessLogEntity();
	entity.setClientId(clientId);
	entity.setHousingUnitId(housingUnitId);
	entity.setProjectId(projectId);
	entity.setStatus(status);
	entity.setStatusMessage(tp.getMessage());
	entity.setProcessId(this.processId);
	logRepository.save(entity);
}
 
开发者ID:hserv,项目名称:coordinated-entry,代码行数:21,代码来源:MatchProcessLogServiceImpl.java

示例2: eventToRecord

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
private LogRecord eventToRecord(LoggingEvent event, Level julLevel) {
    String format = event.getMessage();
    Object[] arguments = event.getArgumentArray();
    FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
    if (ft.getThrowable() != null && event.getThrowable() != null) {
        throw new IllegalArgumentException("both last element in argument array and last argument are of type Throwable");
    }

    Throwable t = event.getThrowable();
    if (ft.getThrowable() != null) {
        t = ft.getThrowable();
        throw new IllegalStateException("fix above code");
    }

    LogRecord record = new LogRecord(julLevel, ft.getMessage());
    record.setLoggerName(event.getLoggerName());
    record.setMillis(event.getTimeStamp());
    record.setSourceClassName(EventConstants.NA_SUBST);
    record.setSourceMethodName(EventConstants.NA_SUBST);

    record.setThrown(t);
    return record;
}
 
开发者ID:AmadeusITGroup,项目名称:HttpSessionReplacer,代码行数:24,代码来源:JDK14LoggerAdapter.java

示例3: doLog

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
public void doLog(Marker marker, Level level, String format, Supplier<?>[] argSuppliers, Throwable t) {
    if (!LambdaLoggerUtils.isLogLevelEnabled(underlyingLogger, level, marker)) {
        return;
    }

    if (argSuppliers == null) {
        logFormatted(marker, level, format, t);
    } else {
        FormattingTuple formattingTuple = MessageFormatter.arrayFormat(format, argSuppliersToArgs(argSuppliers), t);
        logFormatted(marker, level, formattingTuple.getMessage(), formattingTuple.getThrowable());
    }
}
 
开发者ID:kwon37xi,项目名称:slf4j-lambda,代码行数:14,代码来源:LambdaLoggerPlainImpl.java

示例4: formatAndLog

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
 * For formatted messages, first substitute arguments and then log.
 *
 * @param level
 * @param format
 * @param arguments a list of 3 ore more arguments
 */
private void formatAndLog(int level, String format, Object... arguments) {
    if (!isLevelEnabled(level)) {
        return;
    }
    FormattingTuple tp = MessageFormatter.arrayFormat(format, arguments);
    log(level, tp.getMessage(), tp.getThrowable());
}
 
开发者ID:Esri,项目名称:server-extension-java,代码行数:15,代码来源:LogAdaptor.java

示例5: error

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
public void error(String msg, Object... arguments)
{
  if (isErrorEnabled())
  {
    FormattingTuple ft = MessageFormatter.arrayFormat(msg, arguments);
    this.error(ft.getMessage());
  }
}
 
开发者ID:snowflakedb,项目名称:snowflake-jdbc,代码行数:9,代码来源:SLF4JLogger.java

示例6: debug

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
 * Log a message at level DEBUG according to the specified format and arguments.
 * This form avoids superfluous object creation when the logger is disabled for the DEBUG level.
 *
 * @param format    the format string
 * @param arguments an array of arguments
 */
public void debug(String format, Object... arguments) {
    if (logger.isDebugEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
        logger.log(getCallerClassName(), Level.DEBUG, ft.getMessage(),
                ft.getThrowable());
    }
}
 
开发者ID:wings27,项目名称:easy-logger,代码行数:15,代码来源:EasyLog4jLogger.java

示例7: info

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
 * Log a message at level INFO according to the specified format and arguments.
 * This form avoids superfluous object creation when the logger is disabled for the INFO level.
 *
 * @param format   the format string
 * @param argArray an array of arguments
 */
public void info(String format, Object... argArray) {
    if (logger.isInfoEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
        logger.log(getCallerClassName(), Level.INFO, ft.getMessage(),
                ft.getThrowable());
    }
}
 
开发者ID:wings27,项目名称:easy-logger,代码行数:15,代码来源:EasyLog4jLogger.java

示例8: error

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
public void error(final String format, final Object... arguments) {
    final FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
    Crashlytics.log(Log.ERROR, mTag, ft.getMessage());
    if (ft.getThrowable() != null) {
        exception(Log.ERROR, ft.getThrowable());
    }
}
 
开发者ID:dasfoo,项目名称:delern,代码行数:9,代码来源:Logger.java

示例9: warn

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
/**
 * Log a message at level WARN according to the specified format and arguments.
 * This form avoids superfluous object creation when the logger is disabled for the WARN level.
 *
 * @param format   the format string
 * @param argArray an array of arguments
 */
public void warn(String format, Object... argArray) {
    if (logger.isEnabledFor(Level.WARN)) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
        logger.log(getCallerClassName(), Level.WARN, ft.getMessage(),
                ft.getThrowable());
    }
}
 
开发者ID:wings27,项目名称:easy-logger,代码行数:15,代码来源:EasyLog4jLogger.java

示例10: info

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
public final void info(String format, Object... arguments) {
    FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
    LogRecord record = new LogRecord(Level.INFO, ft.getMessage());
    record.setThrown(ft.getThrowable());
    record.setLoggerName(name);
    Logger.getLogger(name).log(record);
}
 
开发者ID:BtoBastian,项目名称:Javacord,代码行数:9,代码来源:JavacordLogger.java

示例11: error

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
public final void error(String format, Object... arguments) {
    FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
    LogRecord record = new LogRecord(Level.SEVERE, ft.getMessage());
    record.setThrown(ft.getThrowable());
    record.setLoggerName(name);
    Logger.getLogger(name).log(record);
}
 
开发者ID:BtoBastian,项目名称:Javacord,代码行数:9,代码来源:JavacordLogger.java

示例12: warn

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
public void warn(String msg, Object... arguments)
{
  if (isWarnEnabled())
  {
    FormattingTuple ft = MessageFormatter.arrayFormat(msg, arguments);
    this.warn(ft.getMessage());
  }
}
 
开发者ID:snowflakedb,项目名称:snowflake-jdbc,代码行数:9,代码来源:SLF4JLogger.java

示例13: trace

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
public void trace(final String format, final Object... arguments) {
    final FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
    Crashlytics.log(Log.VERBOSE, mTag, ft.getMessage());
    if (ft.getThrowable() != null) {
        exception(Log.VERBOSE, ft.getThrowable());
    }
}
 
开发者ID:dasfoo,项目名称:delern,代码行数:9,代码来源:Logger.java

示例14: debug

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
public void debug(final String format, final Object... arguments) {
    final FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
    Crashlytics.log(Log.DEBUG, mTag, ft.getMessage());
    if (ft.getThrowable() != null) {
        exception(Log.DEBUG, ft.getThrowable());
    }
}
 
开发者ID:dasfoo,项目名称:delern,代码行数:9,代码来源:Logger.java

示例15: info

import org.slf4j.helpers.MessageFormatter; //导入方法依赖的package包/类
@Override
public void info(final String format, final Object... arguments) {
    final FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments);
    Crashlytics.log(Log.INFO, mTag, ft.getMessage());
    if (ft.getThrowable() != null) {
        exception(Log.INFO, ft.getThrowable());
    }
}
 
开发者ID:dasfoo,项目名称:delern,代码行数:9,代码来源:Logger.java


注:本文中的org.slf4j.helpers.MessageFormatter.arrayFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。