logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@apache.org
Subject svn commit: r397643 - /logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogMF.java
Date Thu, 27 Apr 2006 21:32:07 GMT
Author: carnold
Date: Thu Apr 27 14:32:06 2006
New Revision: 397643

URL: http://svn.apache.org/viewcvs?rev=397643&view=rev
Log:
Add ResourceBundle support for LogMF formatter

Modified:
    logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogMF.java

Modified: 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=397643&r1=397642&r2=397643&view=diff
==============================================================================
--- logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogMF.java (original)
+++ logging/sandbox/log4j/formatter/src/main/java/org/apache/log4j/formatter/LogMF.java Thu Apr 27 14:32:06 2006
@@ -22,6 +22,7 @@
 import java.text.DateFormat;
 import java.util.Date;
 import java.text.MessageFormat;
+import java.util.ResourceBundle;
 
 /**
  * This class provides static methods to
@@ -103,7 +104,7 @@
 	/**
 	 * Formats arguments using MessageFormat.
 	 * @param pattern pattern, may be malformed.
-	 * @param arguments arguments, may be null or mismatched.
+	 * @param arg0 argument, may be null or mismatched.
 	 * @return Message string
 	 */
 	private static String format(final String pattern, final Object arg0) {
@@ -117,7 +118,23 @@
 		}
 		return msg;
 	}
-	/**
+
+    /**
+     * Gets a message format pattern from a resource bundle by key.
+     * @param bundle bundle, may not be null.
+     * @param key key, may not be null.
+     * @return pattern retrieved pattern or
+     */
+    private static String getPattern(final ResourceBundle bundle,
+                                     final String key) {
+        String pattern = bundle.getString(key);
+        if (pattern == null) {
+            pattern = "Unable to find key \"" + key + "\" in bundle " + bundle.toString();
+        }
+        return pattern;
+    }
+
+    /**
 	 * Log a parameterized message at debug level.
 	 * @param logger logger, may not be null.
 	 * @param pattern pattern, may be null.
@@ -1179,4 +1196,1147 @@
 			logger.fatal(format(pattern, new Object[] { arg0, arg1, arg2, arg3 }));
 		}
 	}
+
+
+    /**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object[] arguments) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), arguments));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object[] arguments) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), arguments));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object[] arguments) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), arguments));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object[] arguments) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), arguments));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object[] arguments) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), arguments));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param arguments an array of arguments to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object[] arguments) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), arguments));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final boolean argument) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), argument ? Boolean.TRUE : Boolean.FALSE));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final char argument) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), new Character(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final byte argument) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), new Byte(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final short argument) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), new Short(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final int argument) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), new Integer(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final long argument) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), new Long(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final float argument) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), new Float(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final double argument) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), new Double(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object argument) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), argument));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), new Object[] { arg0, arg1 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at trace level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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.
+	 * @param arg3 a value to be formatted and substituted.
+	 */
+	public static void trace(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object arg0,
+			final Object arg1,
+			final Object arg2,
+			final Object arg3) {
+		if (bundle != null && key != null && logger.isTraceEnabled()) {
+			logger.trace(format(getPattern(bundle, key),
+					new Object[] { arg0, arg1, arg2, arg3 }));
+		}
+	}
+
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final boolean argument) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), argument ? Boolean.TRUE : Boolean.FALSE));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final char argument) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), new Character(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final byte argument) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), new Byte(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final short argument) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), new Short(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final int argument) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), new Integer(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final long argument) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), new Long(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final float argument) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), new Float(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final double argument) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), new Double(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object argument) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), argument));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), new Object[] { arg0, arg1 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at debug level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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.
+	 * @param arg3 a value to be formatted and substituted.
+	 */
+	public static void debug(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1,
+			final Object arg2, final Object arg3) {
+		if (bundle != null && key != null && logger.isDebugEnabled()) {
+			logger.debug(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2, arg3 }));
+		}
+	}
+
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final boolean argument) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), argument ? Boolean.TRUE : Boolean.FALSE));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final char argument) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), new Character(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final byte argument) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), new Byte(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final short argument) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), new Short(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final int argument) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), new Integer(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final long argument) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), new Long(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final float argument) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), new Float(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final double argument) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), new Double(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object argument) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), argument));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), new Object[] { arg0, arg1 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at info level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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.
+	 * @param arg3 a value to be formatted and substituted.
+	 */
+	public static void info(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1, final Object arg2, final Object arg3) {
+		if (bundle != null && key != null && logger.isInfoEnabled()) {
+			logger.info(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2, arg3 }));
+		}
+	}
+
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final boolean argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), argument ? Boolean.TRUE : Boolean.FALSE));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final char argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), new Character(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final byte argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), new Byte(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final short argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), new Short(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final int argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), new Integer(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final long argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), new Long(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final float argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), new Float(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final double argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), new Double(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), argument));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), new Object[] { arg0, arg1 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at warn level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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.
+	 * @param arg3 a value to be formatted and substituted.
+	 */
+	public static void warn(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1,
+			final Object arg2, final Object arg3) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.WARN)) {
+			logger.warn(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2, arg3 }));
+		}
+	}
+
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final boolean argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), argument ? Boolean.TRUE : Boolean.FALSE));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final char argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), new Character(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final byte argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), new Byte(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final short argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), new Short(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final int argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), new Integer(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final long argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), new Long(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final float argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), new Float(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final double argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), new Double(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), argument));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), new Object[] { arg0, arg1 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at error level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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.
+	 * @param arg3 a value to be formatted and substituted.
+	 */
+	public static void error(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1,
+			final Object arg2, final Object arg3) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.ERROR)) {
+			logger.error(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2, arg3 }));
+		}
+	}
+
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final boolean argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), argument ? Boolean.TRUE : Boolean.FALSE));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final char argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), new Character(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final byte argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), new Byte(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final short argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), new Short(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final int argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), new Integer(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final long argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), new Long(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final float argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), new Float(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final double argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), new Double(argument)));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, may be null.
+	 * @param argument a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object argument) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), argument));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), new Object[] { arg0, arg1 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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 ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1, final Object arg2) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2 }));
+		}
+	}
+
+	/**
+	 * Log a parameterized message at fatal level.
+	 * @param logger logger, may not be null.
+	 * @param bundle resource bundle, may be null.
+     * @param key key for pattern in resource bundle, 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.
+	 * @param arg3 a value to be formatted and substituted.
+	 */
+	public static void fatal(final Logger logger, final ResourceBundle bundle, final String key,
+			final Object arg0, final Object arg1,
+			final Object arg2, final Object arg3) {
+		if (bundle != null && key != null && logger.isEnabledFor(Level.FATAL)) {
+			logger.fatal(format(getPattern(bundle, key), new Object[] { arg0, arg1, arg2, arg3 }));
+		}
+	}
+
 }



---------------------------------------------------------------------
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