Refine search
public String getFormattedMessage() { if (formattedMessage != null) { return formattedMessage; } if (argumentArray != null) { formattedMessage = MessageFormatter.arrayFormat(message, argumentArray).getMessage(); } else { formattedMessage = message; } return formattedMessage; }
public String getFormattedMessage() { if (formattedMessage != null) { return formattedMessage; } if (argumentArray != null) { formattedMessage = MessageFormatter.arrayFormat(message, argumentArray).getMessage(); } else { formattedMessage = message; } return formattedMessage; }
/** * append log with pattern * * @param appendLogPattern like "aaa {} bbb {} ccc" * @param appendLogArguments like "111, true" */ public static void log(String appendLogPattern, Object ... appendLogArguments) { FormattingTuple ft = MessageFormatter.arrayFormat(appendLogPattern, appendLogArguments); String appendLog = ft.getMessage(); /*appendLog = appendLogPattern; if (appendLogArguments!=null && appendLogArguments.length>0) { appendLog = MessageFormat.format(appendLogPattern, appendLogArguments); }*/ StackTraceElement callInfo = new Throwable().getStackTrace()[1]; logDetail(callInfo, appendLog); }
/** * Log a message at level DEBUG according to the specified format and * arguments. * * <p> * This form avoids superfluous object creation when the logger is disabled * for the DEBUG level. * </p> * * @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(FQCN, Level.DEBUG, ft.getMessage(), ft.getThrowable()); } }
/** * Log a message at level INFO according to the specified format and * arguments. * * <p> * This form avoids superfluous object creation when the logger is disabled * for the INFO level. * </p> * * @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(FQCN, Level.INFO, ft.getMessage(), ft.getThrowable()); } }
/** * Log a message at level ERROR according to the specified format and * arguments. * * <p> * This form avoids superfluous object creation when the logger is disabled * for the ERROR level. * </p> * * @param format * the format string * @param argArray * an array of arguments */ public void error(String format, Object... argArray) { if (logger.isEnabledFor(Level.ERROR)) { FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray); logger.log(FQCN, Level.ERROR, ft.getMessage(), ft.getThrowable()); } }
/** * Log a message at level WARN 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 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(FQCN, Level.WARN, ft.getMessage(), ft.getThrowable()); } }
public static void error(final Logger logger, final EventReporter eventReporter, final String msg, final Object... args) { logger.error(msg, args); if (eventReporter != null) { eventReporter.reportEvent(Severity.ERROR, CATEGORY, MessageFormatter.arrayFormat(msg, args).getMessage()); } }
@Override public void warn(String format, Object... arguments) { String message = MessageFormatter.arrayFormat(format, arguments).getMessage(); warnMessages.add(new LogMessage(null, message, null, arguments)); logger.warn(format, arguments); }
public static void warn(final Logger logger, final EventReporter eventReporter, final String msg, final Object... args) { logger.warn(msg, args); if (eventReporter != null) { eventReporter.reportEvent(Severity.WARNING, CATEGORY, MessageFormatter.arrayFormat(msg, args).getMessage()); } }
@Override public void info(String format, Object... arguments) { String message = MessageFormatter.arrayFormat(format, arguments).getMessage(); infoMessages.add(new LogMessage(null, message, null, arguments)); logger.info(format, arguments); }
private String createMessage(Collection<CollapsedRequest<Object, Object>> requests, List<Object> response) { return ERROR_MSG + arrayFormat(ERROR_MSF_TEMPLATE, new Object[]{getCollapserKey().name(), requests.size(), response.size()}).getMessage(); }
/** * Log a message at level TRACE according to the specified format and * arguments. * * <p> * This form avoids superfluous object creation when the logger is disabled * for the TRACE level. * </p> * * @param format * the format string * @param arguments * an array of arguments */ public void trace(String format, Object... arguments) { if (isTraceEnabled()) { FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments); logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, ft.getMessage(), ft.getThrowable()); } }
level == ERROR_INT && logger.isErrorEnabled()) { LocationAwareLogger l = (LocationAwareLogger) logger; FormattingTuple ft = MessageFormatter.arrayFormat(msg, parameters); l.log(null, FQCN, level, ft.getMessage(), null, ft.getThrowable());
@Override public void addLogMessage(final LogLevel level, final String format, final Object[] params, final Throwable t) { replaceThrowablesWithMessage(params); final String formattedMessage = MessageFormatter.arrayFormat(format, params, t).getMessage(); addLogMessage(level, formattedMessage, t); }
@Override public void addLogMessage(final LogLevel level, final String format, final Object[] params) { replaceThrowablesWithMessage(params); final String formattedMessage = MessageFormatter.arrayFormat(format, params).getMessage(); addLogMessage(level, formattedMessage); }
/** * 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()); }
private void writeLog(Marker marker, int level, String format, Object[] args, Throwable exception) { String message = format; if (args != null && args.length > 0) { FormattingTuple formatted = MessageFormatter.arrayFormat(format, args); if (exception == null && formatted.getThrowable() != null) { exception = formatted.getThrowable(); } message = formatted.getMessage(); } logger.log(marker, fqcn, level, addPrefix(message), null, exception); } }
/** * Log a message at level FINE according to the specified format and * arguments. * * <p> * This form avoids superfluous object creation when the logger is disabled * for the FINE level. * </p> * * @param format * the format string * @param argArray * an array of arguments */ public void debug(String format, Object... argArray) { if (logger.isLoggable(Level.FINE)) { FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray); log(SELF, Level.FINE, ft.getMessage(), ft.getThrowable()); } }
/** * Log a message at level INFO according to the specified format and * arguments. * * <p> * This form avoids superfluous object creation when the logger is disabled * for the INFO level. * </p> * * @param format * the format string * @param argArray * an array of arguments */ public void info(String format, Object... argArray) { if (logger.isLoggable(Level.INFO)) { FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray); log(SELF, Level.INFO, ft.getMessage(), ft.getThrowable()); } }