logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@apache.org
Subject svn commit: r368149 [2/4] - in /logging/sandbox/log4j/formatter: ./ src/ src/changes/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/log4j/ src/main/java/org/apache/log4j/formatter/ src/test/ src/test/jav...
Date Wed, 11 Jan 2006 22:20:05 GMT
Added: logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogMF.java
URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogMF.java?rev=368149&view=auto
==============================================================================
--- logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogMF.java (added)
+++ logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogMF.java Wed Jan 11 14:19:48 2006
@@ -0,0 +1,1155 @@
+/*
+ * Copyright 1999,2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.formatter;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import java.text.MessageFormat;
+
+/**
+ * This class provides static methods to
+ * format log messages using java.text.MessageFormat.
+ * 
+ * @author Curt Arnold
+ *
+ */
+public final class LogMF {
+	/**
+	 * Invariant empty array.
+	 */
+	private static final Object[] NO_ARGS = new Object[0];
+
+	/**
+	 * private constructor.
+	 *
+	 */
+	private LogMF() {
+	}
+
+	/**
+	 * Formats arguments using MessageFormat.
+	 * @param pattern pattern, may be malformed.
+	 * @param arguments arguments, may be null or mismatched.
+	 * @return Message string
+	 */
+	private static String format(final String pattern, final Object[] arguments) {
+		try {
+			return MessageFormat.format(pattern, arguments);
+		} catch (IllegalArgumentException ex) {
+			return pattern;
+		}
+	}
+
+	/**
+	 * Formats and makes trace level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logTrace(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.trace(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Formats and makes debug level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logDebug(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.debug(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Formats and makes info level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logInfo(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.info(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Formats and makes warn level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logWarn(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.warn(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Formats and makes error level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logError(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.error(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Formats and makes fatal level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logFatal(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.fatal(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void trace(final Logger logger, final String pattern) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void debug(final Logger logger, final String pattern) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void info(final Logger logger, final String pattern) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void warn(final Logger logger, final String pattern) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void error(final Logger logger, final String pattern) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void fatal(final Logger logger, final String pattern) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+}

Propchange: logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogMF.java
------------------------------------------------------------------------------
    svn:executable = 

Added: logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogSF.java
URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogSF.java?rev=368149&view=auto
==============================================================================
--- logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogSF.java (added)
+++ logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogSF.java Wed Jan 11 14:19:48 2006
@@ -0,0 +1,1166 @@
+/*
+ * Copyright 1999,2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.formatter;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+
+/**
+ * This class provides static methods to
+ * format log messages like org.slf4j.impl.MessageFormatter.
+ * 
+ * @author Curt Arnold
+ *
+ */
+public final class LogSF {
+	/**
+	 * Invariant empty array.
+	 */
+	private static final Object[] NO_ARGS = new Object[0];
+
+	/**
+	 * private constructor.
+	 *
+	 */
+	private LogSF() {
+	}
+
+	/**
+	 * Formats arguments using SLF4J-like formatter.
+	 * @param pattern pattern, may be malformed.
+	 * @param arguments arguments.
+	 * @return Message string
+	 */
+	private static String format(final String pattern, final Object[] arguments) {
+		if (arguments == null) {
+			return pattern;
+		}
+		StringBuilder buf = new StringBuilder(pattern);
+		int index = 0;
+		int pos = buf.indexOf("{");
+		while (pos >= 0 && pos < buf.length() - 1 && index < arguments.length) {
+			if (buf.charAt(pos + 1) == '}') {
+				String subst = String.valueOf(arguments[index++]);
+				buf.replace(pos, pos + 2, subst);
+				pos += subst.length();
+			} else {
+				pos = buf.indexOf("{", pos + 1);
+			}
+		}
+		return buf.toString();
+	}
+
+	
+	/**
+	 * Formats and makes debug level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logTrace(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.trace(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Formats and makes debug level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logDebug(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.debug(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Formats and makes info level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logInfo(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.info(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Formats and makes warn level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logWarn(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.warn(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Formats and makes error level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logError(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.error(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Formats and makes fatal level log request.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null or malformed.
+	 * @param arguments may be null or mismatched.
+	 */
+	private static void logFatal(final Logger logger, final String pattern,
+			final Object[] arguments) {
+		if (pattern != null) {
+			logger.fatal(format(pattern, arguments));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final Object... arguments) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, arguments);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void trace(final Logger logger, final String pattern) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isTraceEnabled()) {
+			logTrace(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void debug(final Logger logger, final String pattern) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isDebugEnabled()) {
+			logDebug(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void info(final Logger logger, final String pattern) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isInfoEnabled()) {
+			logInfo(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void warn(final Logger logger, final String pattern) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isEnabledFor(Level.WARN)) {
+			logWarn(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void error(final Logger logger, final String pattern) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isEnabledFor(Level.ERROR)) {
+			logError(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 */
+	public static void fatal(final Logger logger, final String pattern) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, NO_ARGS);
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final boolean argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Boolean.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final char argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Character.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final byte argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Byte.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final short argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Short.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final int argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Integer.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final long argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Long.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final float argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Float.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final double argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { Double.valueOf(argument) });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final Object argument) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { argument });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { arg0, arg1 });
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param pattern pattern, may be null.
+	 * @param arg0 a value to be formatted and substituted.
+	 * @param arg1 a value to be formatted and substituted.
+	 * @param arg2 a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final String pattern,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (logger.isEnabledFor(Level.FATAL)) {
+			logFatal(logger, pattern, new Object[] { arg0, arg1, arg2 });
+		}
+	}
+
+}

Propchange: logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogSF.java
------------------------------------------------------------------------------
    svn:executable = 

Added: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/VectorAppender.java
URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/VectorAppender.java?rev=368149&view=auto
==============================================================================
--- logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/VectorAppender.java (added)
+++ logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/VectorAppender.java Wed Jan 11 14:19:48 2006
@@ -0,0 +1,78 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j;
+
+import java.util.Vector;
+import org.apache.log4j.Layout;
+import org.apache.log4j.spi.LoggingEvent;
+import org.apache.log4j.helpers.OptionConverter;
+import org.apache.log4j.helpers.Transform;
+import org.apache.log4j.helpers.LogLog;
+
+/**
+   An appender that appends logging events to a vector.
+   @author Ceki  G&uuml;lc&uuml;
+*/
+public class VectorAppender extends AppenderSkeleton {
+
+  public Vector vector;
+  
+  public VectorAppender() {
+    vector = new Vector();
+  }
+
+  /**
+     Does nothing.
+  */
+  public void activateOptions() {
+  }
+
+
+  /**
+     This method is called by the {@link AppenderSkeleton#doAppend}
+     method.
+
+  */
+  public void append(LoggingEvent event) {
+    //System.out.println("---Vector appender called with message ["+event.getRenderedMessage()+"].");
+    //System.out.flush();
+    try {
+      Thread.currentThread().sleep(100);
+    } catch(Exception e) {
+    }
+    vector.addElement(event);
+   }
+
+  public Vector getVector() {
+    return vector;
+  }
+
+  public synchronized void close() {
+    if(this.closed)
+      return;
+    this.closed = true;
+  }
+
+
+  public boolean isClosed() {
+    return closed;
+  }
+
+  public boolean requiresLayout() {
+    return false;
+  }
+}

Propchange: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/VectorAppender.java
------------------------------------------------------------------------------
    svn:executable = 

Added: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogCapture.java
URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogCapture.java?rev=368149&view=auto
==============================================================================
--- logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogCapture.java (added)
+++ logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogCapture.java Wed Jan 11 14:19:48 2006
@@ -0,0 +1,74 @@
+/*
+ * Copyright 1999,2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.formatter;
+
+import java.util.Vector;
+
+import junit.framework.Assert;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.VectorAppender;
+import org.apache.log4j.spi.LoggingEvent;
+
+/**
+ * Helper class to set up and capture log messages.
+ */
+public class LogCapture {
+	/**
+	 * Appender.
+	 */
+	private final VectorAppender appender;
+
+	/**
+	 * Expected level.
+	 */
+	private final Level level;
+
+	/**
+	 * Creates new instance of LogCapture.
+	 *
+	 */
+	public LogCapture(final Level level) {
+		this.level = level;
+		Logger root = Logger.getRootLogger();
+		appender = new VectorAppender();
+		root.addAppender(appender);
+	}
+
+	/**
+	 * Get message.
+	 * @return rendered message, null if no logging event captured.
+	 */
+	public String getMessage() {
+		Vector vector = appender.getVector();
+		String msg = null;
+		switch (vector.size()) {
+		case 0:
+			break;
+		case 1:
+			LoggingEvent event = (LoggingEvent) vector.elementAt(0);
+			Assert.assertNotNull(event);
+			Assert.assertEquals(level, event.getLevel());
+			msg = event.getRenderedMessage();
+			Assert.assertNotNull(msg);
+			break;
+
+		default:
+			Assert.fail("More than one request captured");
+		}
+		return msg;
+	}
+}

Propchange: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogCapture.java
------------------------------------------------------------------------------
    svn:executable = 



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message