001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.log4j;
018
019import org.apache.log4j.spi.LoggingEvent;
020
021import java.util.ResourceBundle;
022
023
024/**
025 * This class provides parameterized logging services
026 * using the SLF4J pattern syntax.
027 * <p>
028 * Message formatting is only performed when the 
029 * request exceeds the threshold level of the logger.
030 *
031 * @since 1.2.16
032 *
033 */
034public final class LogSF extends LogXF {
035    /**
036     * private constructor.
037     *
038     */
039    private LogSF() {
040    }
041
042
043
044
045    /**
046     * Formats arguments using SLF4J-like formatter.
047     * @param pattern pattern, may be malformed.
048     * @param arguments arguments.
049     * @return Message string
050     */
051    private static String format(final String pattern,
052                                 final Object[] arguments) {
053        if (pattern != null) {
054            String retval = "";
055            int count = 0;
056            int prev = 0;
057            int pos = pattern.indexOf("{");
058            while(pos >= 0) {
059                if (pos == 0 || pattern.charAt(pos-1) != '\\') {
060                    retval += pattern.substring(prev, pos);
061                    if (pos + 1 < pattern.length() && pattern.charAt(pos+1) == '}') {
062                        if(arguments != null && count < arguments.length) {
063                            retval += arguments[count++];
064                        } else {
065                            retval += "{}";
066                        }
067                        prev = pos + 2;
068                    } else {
069                        retval += "{";
070                        prev = pos + 1;
071                    }
072                } else {
073                    retval += pattern.substring(prev, pos - 1) + "{";
074                    prev = pos + 1;
075                }
076                pos = pattern.indexOf("{", prev);
077            }
078            return retval + pattern.substring(prev);
079        }
080        return null;
081    }
082
083    /**
084     * Formats arguments using MessageFormat.
085     * @param pattern pattern, may be malformed.
086     * @param arg0 argument, may be null or mismatched.
087     * @return Message string
088     */
089    private static String format(final String pattern, final Object arg0) {
090        if (pattern != null) {
091            //
092            //  if there is an escaped brace, delegate to multi-param formatter
093            if (pattern.indexOf("\\{") >= 0) {
094                return format(pattern, new Object[] { arg0 });
095            }
096            int pos = pattern.indexOf("{}");
097            if (pos >= 0) {
098                return pattern.substring(0, pos) + arg0 + pattern.substring(pos+2);
099            }
100        }
101        return pattern;
102    }
103
104    /**
105     * Formats arguments using MessageFormat using a pattern from
106     * a resource bundle.
107     * @param resourceBundleName name of resource bundle, may be null.
108     * @param key key for pattern in resource bundle, may be null.
109     * @param arguments arguments, may be null or mismatched.
110     * @return Message string or null
111     */
112    private static String format(
113            final String resourceBundleName,
114            final String key,
115            final Object[] arguments) {
116        String pattern;
117        if (resourceBundleName != null) {
118            try {
119                ResourceBundle bundle =
120                        ResourceBundle.getBundle(resourceBundleName);
121                pattern = bundle.getString(key);
122            } catch (Exception ex) {
123                pattern = key;
124            }
125        } else {
126            pattern = key;
127        }
128        return format(pattern, arguments);
129    }
130
131
132    /**
133     * Fully Qualified Class Name of this class.
134     */
135    private static final String FQCN = LogSF.class.getName();
136
137    /**
138     * Equivalent of Logger.forcedLog.
139     *
140     * @param logger logger, may not be null.
141     * @param level level, may not be null.
142     * @param msg message, may be null.
143     */
144    private static void forcedLog(final Logger logger,
145                                  final Level level,
146                                  final String msg) {
147        logger.callAppenders(new LoggingEvent(FQCN, logger, level, msg, null));
148    }
149
150    /**
151     * Equivalent of Logger.forcedLog.
152     *
153     * @param logger logger, may not be null.
154     * @param level level, may not be null.
155     * @param msg message, may be null.
156     * @param t throwable.
157     */
158    private static void forcedLog(final Logger logger,
159                                  final Level level,
160                                  final String msg,
161                                  final Throwable t) {
162        logger.callAppenders(new LoggingEvent(FQCN, logger, level, msg, t));
163    }
164    /**
165         * Log a parameterized message at trace level.
166         * @param logger logger, may not be null.
167         * @param pattern pattern, may be null.
168         * @param arguments an array of arguments to be
169         *          formatted and substituted.
170         */
171    public static void trace(final Logger logger, final String pattern,
172        final Object[] arguments) {
173        if (logger.isEnabledFor(TRACE)) {
174            forcedLog(logger, TRACE, format(pattern, arguments));
175        }
176    }
177
178    /**
179     * Log a parameterized message at debug level.
180     * @param logger logger, may not be null.
181     * @param pattern pattern, may be null.
182     * @param arguments an array of arguments to be formatted and substituted.
183     */
184    public static void debug(final Logger logger, final String pattern,
185        final Object[] arguments) {
186        if (logger.isDebugEnabled()) {
187            forcedLog(logger, Level.DEBUG, format(pattern, arguments));
188        }
189    }
190
191    /**
192     * Log a parameterized message at info level.
193     * @param logger logger, may not be null.
194     * @param pattern pattern, may be null.
195     * @param arguments an array of arguments to be formatted and substituted.
196     */
197    public static void info(final Logger logger, final String pattern,
198        final Object[] arguments) {
199        if (logger.isInfoEnabled()) {
200            forcedLog(logger, Level.INFO, format(pattern, arguments));
201        }
202    }
203
204    /**
205     * Log a parameterized message at warn level.
206     * @param logger logger, may not be null.
207     * @param pattern pattern, may be null.
208     * @param arguments an array of arguments to be formatted and substituted.
209     */
210    public static void warn(final Logger logger, final String pattern,
211        final Object[] arguments) {
212        if (logger.isEnabledFor(Level.WARN)) {
213            forcedLog(logger, Level.WARN, format(pattern, arguments));
214        }
215    }
216
217    /**
218     * Log a parameterized message at error level.
219     * @param logger logger, may not be null.
220     * @param pattern pattern, may be null.
221     * @param arguments an array of arguments to be formatted and substituted.
222     */
223    public static void error(final Logger logger, final String pattern,
224        final Object[] arguments) {
225        if (logger.isEnabledFor(Level.ERROR)) {
226            forcedLog(logger, Level.ERROR, format(pattern, arguments));
227        }
228    }
229
230    /**
231     * Log a parameterized message at fatal level.
232     * @param logger logger, may not be null.
233     * @param pattern pattern, may be null.
234     * @param arguments an array of arguments to be formatted and substituted.
235     */
236    public static void fatal(final Logger logger, final String pattern,
237        final Object[] arguments) {
238        if (logger.isEnabledFor(Level.FATAL)) {
239            forcedLog(logger, Level.FATAL, format(pattern, arguments));
240        }
241    }
242
243    /**
244         * Log a parameterized message at trace level.
245         * @param logger logger, may not be null.
246         * @param t throwable, may be null.
247         * @param pattern pattern, may be null.
248         * @param arguments an array of arguments to be
249         *          formatted and substituted.
250         */
251    public static void trace(final Logger logger,
252                             final Throwable t,
253                             final String pattern,
254        final Object[] arguments) {
255        if (logger.isEnabledFor(TRACE)) {
256            forcedLog(logger, TRACE, format(pattern, arguments), t);
257        }
258    }
259
260    /**
261     * Log a parameterized message at debug level.
262     * @param logger logger, may not be null.
263     * @param t throwable, may be null.
264     * @param pattern pattern, may be null.
265     * @param arguments an array of arguments to be formatted and substituted.
266     */
267    public static void debug(final Logger logger,
268                             final Throwable t,
269                             final String pattern,
270        final Object[] arguments) {
271        if (logger.isDebugEnabled()) {
272            forcedLog(logger, Level.DEBUG, format(pattern, arguments), t);
273        }
274    }
275
276    /**
277     * Log a parameterized message at info level.
278     * @param logger logger, may not be null.
279     * @param t throwable, may be null.
280     * @param pattern pattern, may be null.
281     * @param arguments an array of arguments to be formatted and substituted.
282     */
283    public static void info(final Logger logger,
284                            final Throwable t,
285                            final String pattern,
286        final Object[] arguments) {
287        if (logger.isInfoEnabled()) {
288            forcedLog(logger, Level.INFO, format(pattern, arguments), t);
289        }
290    }
291
292    /**
293     * Log a parameterized message at warn level.
294     * @param logger logger, may not be null.
295     * @param t throwable, may be null.
296     * @param pattern pattern, may be null.
297     * @param arguments an array of arguments to be formatted and substituted.
298     */
299    public static void warn(final Logger logger,
300                            final Throwable t,
301                            final String pattern,
302        final Object[] arguments) {
303        if (logger.isEnabledFor(Level.WARN)) {
304            forcedLog(logger, Level.WARN, format(pattern, arguments), t);
305        }
306    }
307
308    /**
309     * Log a parameterized message at error level.
310     * @param logger logger, may not be null.
311     * @param t throwable, may be null.
312     * @param pattern pattern, may be null.
313     * @param arguments an array of arguments to be formatted and substituted.
314     */
315    public static void error(final Logger logger,
316                             final Throwable t,
317                             final String pattern,
318        final Object[] arguments) {
319        if (logger.isEnabledFor(Level.ERROR)) {
320            forcedLog(logger, Level.ERROR, format(pattern, arguments), t);
321        }
322    }
323
324    /**
325     * Log a parameterized message at fatal level.
326     * @param logger logger, may not be null.
327     * @param t throwable, may be null.
328     * @param pattern pattern, may be null.
329     * @param arguments an array of arguments to be formatted and substituted.
330     */
331    public static void fatal(final Logger logger,
332                             final Throwable t,
333                             final String pattern,
334        final Object[] arguments) {
335        if (logger.isEnabledFor(Level.FATAL)) {
336            forcedLog(logger, Level.FATAL, format(pattern, arguments), t);
337        }
338    }
339
340
341
342    /**
343     * Log a parameterized message at trace level.
344     * @param logger logger, may not be null.
345     * @param pattern pattern, may be null.
346     * @param argument a value to be formatted and substituted.
347     */
348    public static void trace(final Logger logger, final String pattern,
349        final boolean argument) {
350        if (logger.isEnabledFor(TRACE)) {
351            forcedLog(logger, TRACE, format(pattern, valueOf(argument)));
352        }
353    }
354
355    /**
356     * Log a parameterized message at trace level.
357     * @param logger logger, may not be null.
358     * @param pattern pattern, may be null.
359     * @param argument a value to be formatted and substituted.
360     */
361    public static void trace(final Logger logger, final String pattern,
362        final char argument) {
363        if (logger.isEnabledFor(TRACE)) {
364            forcedLog(logger, TRACE, format(pattern, valueOf(argument)));
365        }
366    }
367
368    /**
369     * Log a parameterized message at trace level.
370     * @param logger logger, may not be null.
371     * @param pattern pattern, may be null.
372     * @param argument a value to be formatted and substituted.
373     */
374    public static void trace(final Logger logger, final String pattern,
375        final byte argument) {
376        if (logger.isEnabledFor(TRACE)) {
377            forcedLog(logger, TRACE, format(pattern, valueOf(argument)));
378        }
379    }
380
381    /**
382     * Log a parameterized message at trace level.
383     * @param logger logger, may not be null.
384     * @param pattern pattern, may be null.
385     * @param argument a value to be formatted and substituted.
386     */
387    public static void trace(final Logger logger, final String pattern,
388        final short argument) {
389        if (logger.isEnabledFor(TRACE)) {
390            forcedLog(logger, TRACE, format(pattern, valueOf(argument)));
391        }
392    }
393
394    /**
395     * Log a parameterized message at trace level.
396     * @param logger logger, may not be null.
397     * @param pattern pattern, may be null.
398     * @param argument a value to be formatted and substituted.
399     */
400    public static void trace(final Logger logger, final String pattern,
401        final int argument) {
402        if (logger.isEnabledFor(TRACE)) {
403            forcedLog(logger, TRACE, format(pattern, valueOf(argument)));
404        }
405    }
406
407    /**
408     * Log a parameterized message at trace level.
409     * @param logger logger, may not be null.
410     * @param pattern pattern, may be null.
411     * @param argument a value to be formatted and substituted.
412     */
413    public static void trace(final Logger logger, final String pattern,
414        final long argument) {
415        if (logger.isEnabledFor(TRACE)) {
416            forcedLog(logger, TRACE, format(pattern, valueOf(argument)));
417        }
418    }
419
420    /**
421     * Log a parameterized message at trace level.
422     * @param logger logger, may not be null.
423     * @param pattern pattern, may be null.
424     * @param argument a value to be formatted and substituted.
425     */
426    public static void trace(final Logger logger, final String pattern,
427        final float argument) {
428        if (logger.isEnabledFor(TRACE)) {
429            forcedLog(logger, TRACE, format(pattern, valueOf(argument)));
430        }
431    }
432
433    /**
434     * Log a parameterized message at trace level.
435     * @param logger logger, may not be null.
436     * @param pattern pattern, may be null.
437     * @param argument a value to be formatted and substituted.
438     */
439    public static void trace(final Logger logger, final String pattern,
440        final double argument) {
441        if (logger.isEnabledFor(TRACE)) {
442            forcedLog(logger, TRACE, format(pattern, valueOf(argument)));
443        }
444    }
445
446    /**
447     * Log a parameterized message at trace level.
448     * @param logger logger, may not be null.
449     * @param pattern pattern, may be null.
450     * @param argument a value to be formatted and substituted.
451     */
452    public static void trace(final Logger logger, final String pattern,
453        final Object argument) {
454        if (logger.isEnabledFor(TRACE)) {
455            forcedLog(logger, TRACE, format(pattern, argument));
456        }
457    }
458
459    /**
460     * Log a parameterized message at trace level.
461     * @param logger logger, may not be null.
462     * @param pattern pattern, may be null.
463     * @param arg0 a value to be formatted and substituted.
464     * @param arg1 a value to be formatted and substituted.
465     */
466    public static void trace(final Logger logger, final String pattern,
467        final Object arg0, final Object arg1) {
468        if (logger.isEnabledFor(TRACE)) {
469            forcedLog(logger, TRACE,
470                    format(pattern, toArray(arg0, arg1)));
471        }
472    }
473
474    /**
475     * Log a parameterized message at trace level.
476     * @param logger logger, may not be null.
477     * @param pattern pattern, may be null.
478     * @param arg0 a value to be formatted and substituted.
479     * @param arg1 a value to be formatted and substituted.
480     * @param arg2 a value to be formatted and substituted.
481     */
482    public static void trace(final Logger logger, final String pattern,
483        final Object arg0, final Object arg1, final Object arg2) {
484        if (logger.isEnabledFor(TRACE)) {
485            forcedLog(logger, TRACE,
486                    format(pattern, toArray(arg0, arg1, arg2)));
487        }
488    }
489
490    /**
491     * Log a parameterized message at trace level.
492     * @param logger logger, may not be null.
493     * @param pattern pattern, may be null.
494     * @param arg0 a value to be formatted and substituted.
495     * @param arg1 a value to be formatted and substituted.
496     * @param arg2 a value to be formatted and substituted.
497     * @param arg3 a value to be formatted and substituted.
498     */
499    public static void trace(final Logger logger, final String pattern,
500        final Object arg0, final Object arg1, final Object arg2,
501        final Object arg3) {
502        if (logger.isEnabledFor(TRACE)) {
503            forcedLog(logger, TRACE,
504                    format(pattern, toArray(arg0, arg1, arg2, arg3)));
505        }
506    }
507
508    /**
509     * Log a parameterized message at debug level.
510     * @param logger logger, may not be null.
511     * @param pattern pattern, may be null.
512     * @param argument a value to be formatted and substituted.
513     */
514    public static void debug(final Logger logger, final String pattern,
515        final boolean argument) {
516        if (logger.isDebugEnabled()) {
517            forcedLog(logger, Level.DEBUG, format(pattern, valueOf(argument)));
518        }
519    }
520
521    /**
522     * Log a parameterized message at debug level.
523     * @param logger logger, may not be null.
524     * @param pattern pattern, may be null.
525     * @param argument a value to be formatted and substituted.
526     */
527    public static void debug(final Logger logger, final String pattern,
528        final char argument) {
529        if (logger.isDebugEnabled()) {
530            forcedLog(logger, Level.DEBUG, format(pattern, valueOf(argument)));
531        }
532    }
533
534    /**
535     * Log a parameterized message at debug level.
536     * @param logger logger, may not be null.
537     * @param pattern pattern, may be null.
538     * @param argument a value to be formatted and substituted.
539     */
540    public static void debug(final Logger logger, final String pattern,
541        final byte argument) {
542        if (logger.isDebugEnabled()) {
543            forcedLog(logger, Level.DEBUG, format(pattern, valueOf(argument)));
544        }
545    }
546
547    /**
548     * Log a parameterized message at debug level.
549     * @param logger logger, may not be null.
550     * @param pattern pattern, may be null.
551     * @param argument a value to be formatted and substituted.
552     */
553    public static void debug(final Logger logger, final String pattern,
554        final short argument) {
555        if (logger.isDebugEnabled()) {
556            forcedLog(logger, Level.DEBUG, format(pattern, valueOf(argument)));
557        }
558    }
559
560    /**
561     * Log a parameterized message at debug level.
562     * @param logger logger, may not be null.
563     * @param pattern pattern, may be null.
564     * @param argument a value to be formatted and substituted.
565     */
566    public static void debug(final Logger logger, final String pattern,
567        final int argument) {
568        if (logger.isDebugEnabled()) {
569            forcedLog(logger, Level.DEBUG, format(pattern, valueOf(argument)));
570        }
571    }
572
573    /**
574     * Log a parameterized message at debug level.
575     * @param logger logger, may not be null.
576     * @param pattern pattern, may be null.
577     * @param argument a value to be formatted and substituted.
578     */
579    public static void debug(final Logger logger, final String pattern,
580        final long argument) {
581        if (logger.isDebugEnabled()) {
582            forcedLog(logger, Level.DEBUG, format(pattern, valueOf(argument)));
583        }
584    }
585
586    /**
587     * Log a parameterized message at debug level.
588     * @param logger logger, may not be null.
589     * @param pattern pattern, may be null.
590     * @param argument a value to be formatted and substituted.
591     */
592    public static void debug(final Logger logger, final String pattern,
593        final float argument) {
594        if (logger.isDebugEnabled()) {
595            forcedLog(logger, Level.DEBUG, format(pattern, valueOf(argument)));
596        }
597    }
598
599    /**
600     * Log a parameterized message at debug level.
601     * @param logger logger, may not be null.
602     * @param pattern pattern, may be null.
603     * @param argument a value to be formatted and substituted.
604     */
605    public static void debug(final Logger logger, final String pattern,
606        final double argument) {
607        if (logger.isDebugEnabled()) {
608            forcedLog(logger, Level.DEBUG, format(pattern, valueOf(argument)));
609        }
610    }
611
612    /**
613     * Log a parameterized message at debug level.
614     * @param logger logger, may not be null.
615     * @param pattern pattern, may be null.
616     * @param argument a value to be formatted and substituted.
617     */
618    public static void debug(final Logger logger, final String pattern,
619        final Object argument) {
620        if (logger.isDebugEnabled()) {
621            forcedLog(logger, Level.DEBUG, format(pattern, argument));
622        }
623    }
624
625    /**
626     * Log a parameterized message at debug level.
627     * @param logger logger, may not be null.
628     * @param pattern pattern, may be null.
629     * @param arg0 a value to be formatted and substituted.
630     * @param arg1 a value to be formatted and substituted.
631     */
632    public static void debug(final Logger logger, final String pattern,
633        final Object arg0, final Object arg1) {
634        if (logger.isDebugEnabled()) {
635            forcedLog(logger, Level.DEBUG,
636                    format(pattern, toArray(arg0, arg1)));
637        }
638    }
639
640    /**
641     * Log a parameterized message at debug level.
642     * @param logger logger, may not be null.
643     * @param pattern pattern, may be null.
644     * @param arg0 a value to be formatted and substituted.
645     * @param arg1 a value to be formatted and substituted.
646     * @param arg2 a value to be formatted and substituted.
647     */
648    public static void debug(final Logger logger, final String pattern,
649        final Object arg0, final Object arg1, final Object arg2) {
650        if (logger.isDebugEnabled()) {
651            forcedLog(logger, Level.DEBUG,
652                    format(pattern, toArray(arg0, arg1, arg2)));
653        }
654    }
655
656    /**
657     * Log a parameterized message at debug level.
658     * @param logger logger, may not be null.
659     * @param pattern pattern, may be null.
660     * @param arg0 a value to be formatted and substituted.
661     * @param arg1 a value to be formatted and substituted.
662     * @param arg2 a value to be formatted and substituted.
663     * @param arg3 a value to be formatted and substituted.
664     */
665    public static void debug(final Logger logger, final String pattern,
666        final Object arg0, final Object arg1, final Object arg2,
667        final Object arg3) {
668        if (logger.isDebugEnabled()) {
669            forcedLog(logger, Level.DEBUG,
670                    format(pattern, toArray(arg0, arg1, arg2, arg3)));
671        }
672    }
673
674    /**
675     * Log a parameterized message at info level.
676     * @param logger logger, may not be null.
677     * @param pattern pattern, may be null.
678     * @param argument a value to be formatted and substituted.
679     */
680    public static void info(final Logger logger, final String pattern,
681        final boolean argument) {
682        if (logger.isInfoEnabled()) {
683            forcedLog(logger, Level.INFO, format(pattern, valueOf(argument)));
684        }
685    }
686
687    /**
688     * Log a parameterized message at info level.
689     * @param logger logger, may not be null.
690     * @param pattern pattern, may be null.
691     * @param argument a value to be formatted and substituted.
692     */
693    public static void info(final Logger logger, final String pattern,
694        final char argument) {
695        if (logger.isInfoEnabled()) {
696            forcedLog(logger, Level.INFO, format(pattern, valueOf(argument)));
697        }
698    }
699
700    /**
701     * Log a parameterized message at info level.
702     * @param logger logger, may not be null.
703     * @param pattern pattern, may be null.
704     * @param argument a value to be formatted and substituted.
705     */
706    public static void info(final Logger logger, final String pattern,
707        final byte argument) {
708        if (logger.isInfoEnabled()) {
709            forcedLog(logger, Level.INFO, format(pattern, valueOf(argument)));
710        }
711    }
712
713    /**
714     * Log a parameterized message at info level.
715     * @param logger logger, may not be null.
716     * @param pattern pattern, may be null.
717     * @param argument a value to be formatted and substituted.
718     */
719    public static void info(final Logger logger, final String pattern,
720        final short argument) {
721        if (logger.isInfoEnabled()) {
722            forcedLog(logger, Level.INFO, format(pattern, valueOf(argument)));
723        }
724    }
725
726    /**
727     * Log a parameterized message at info level.
728     * @param logger logger, may not be null.
729     * @param pattern pattern, may be null.
730     * @param argument a value to be formatted and substituted.
731     */
732    public static void info(final Logger logger, final String pattern,
733        final int argument) {
734        if (logger.isInfoEnabled()) {
735            forcedLog(logger, Level.INFO, format(pattern, valueOf(argument)));
736        }
737    }
738
739    /**
740     * Log a parameterized message at info level.
741     * @param logger logger, may not be null.
742     * @param pattern pattern, may be null.
743     * @param argument a value to be formatted and substituted.
744     */
745    public static void info(final Logger logger, final String pattern,
746        final long argument) {
747        if (logger.isInfoEnabled()) {
748            forcedLog(logger, Level.INFO, format(pattern, valueOf(argument)));
749        }
750    }
751
752    /**
753     * Log a parameterized message at info level.
754     * @param logger logger, may not be null.
755     * @param pattern pattern, may be null.
756     * @param argument a value to be formatted and substituted.
757     */
758    public static void info(final Logger logger, final String pattern,
759        final float argument) {
760        if (logger.isInfoEnabled()) {
761            forcedLog(logger, Level.INFO, format(pattern, valueOf(argument)));
762        }
763    }
764
765    /**
766     * Log a parameterized message at info level.
767     * @param logger logger, may not be null.
768     * @param pattern pattern, may be null.
769     * @param argument a value to be formatted and substituted.
770     */
771    public static void info(final Logger logger, final String pattern,
772        final double argument) {
773        if (logger.isInfoEnabled()) {
774            forcedLog(logger, Level.INFO, format(pattern, valueOf(argument)));
775        }
776    }
777
778    /**
779     * Log a parameterized message at info level.
780     * @param logger logger, may not be null.
781     * @param pattern pattern, may be null.
782     * @param argument a value to be formatted and substituted.
783     */
784    public static void info(final Logger logger, final String pattern,
785        final Object argument) {
786        if (logger.isInfoEnabled()) {
787            forcedLog(logger, Level.INFO, format(pattern, argument));
788        }
789    }
790
791    /**
792     * Log a parameterized message at info level.
793     * @param logger logger, may not be null.
794     * @param pattern pattern, may be null.
795     * @param arg0 a value to be formatted and substituted.
796     * @param arg1 a value to be formatted and substituted.
797     */
798    public static void info(final Logger logger, final String pattern,
799        final Object arg0, final Object arg1) {
800        if (logger.isInfoEnabled()) {
801            forcedLog(logger, Level.INFO, format(pattern, toArray(arg0, arg1)));
802        }
803    }
804
805    /**
806     * Log a parameterized message at info level.
807     * @param logger logger, may not be null.
808     * @param pattern pattern, may be null.
809     * @param arg0 a value to be formatted and substituted.
810     * @param arg1 a value to be formatted and substituted.
811     * @param arg2 a value to be formatted and substituted.
812     */
813    public static void info(final Logger logger, final String pattern,
814        final Object arg0, final Object arg1, final Object arg2) {
815        if (logger.isInfoEnabled()) {
816            forcedLog(logger, Level.INFO, format(pattern,
817                    toArray(arg0, arg1, arg2)));
818        }
819    }
820
821    /**
822     * Log a parameterized message at info level.
823     * @param logger logger, may not be null.
824     * @param pattern pattern, may be null.
825     * @param arg0 a value to be formatted and substituted.
826     * @param arg1 a value to be formatted and substituted.
827     * @param arg2 a value to be formatted and substituted.
828     * @param arg3 a value to be formatted and substituted.
829     */
830    public static void info(final Logger logger, final String pattern,
831        final Object arg0, final Object arg1, final Object arg2,
832        final Object arg3) {
833        if (logger.isInfoEnabled()) {
834            forcedLog(logger, Level.INFO, format(pattern,
835                    toArray(arg0, arg1, arg2, arg3)));
836        }
837    }
838
839    /**
840     * Log a parameterized message at warn level.
841     * @param logger logger, may not be null.
842     * @param pattern pattern, may be null.
843     * @param argument a value to be formatted and substituted.
844     */
845    public static void warn(final Logger logger, final String pattern,
846        final boolean argument) {
847        if (logger.isEnabledFor(Level.WARN)) {
848            forcedLog(logger, Level.WARN, format(pattern, valueOf(argument)));
849        }
850    }
851
852    /**
853     * Log a parameterized message at warn level.
854     * @param logger logger, may not be null.
855     * @param pattern pattern, may be null.
856     * @param argument a value to be formatted and substituted.
857     */
858    public static void warn(final Logger logger, final String pattern,
859        final char argument) {
860        if (logger.isEnabledFor(Level.WARN)) {
861            forcedLog(logger, Level.WARN, format(pattern, valueOf(argument)));
862        }
863    }
864
865    /**
866     * Log a parameterized message at warn level.
867     * @param logger logger, may not be null.
868     * @param pattern pattern, may be null.
869     * @param argument a value to be formatted and substituted.
870     */
871    public static void warn(final Logger logger, final String pattern,
872        final byte argument) {
873        if (logger.isEnabledFor(Level.WARN)) {
874            forcedLog(logger, Level.WARN, format(pattern, valueOf(argument)));
875        }
876    }
877
878    /**
879     * Log a parameterized message at warn level.
880     * @param logger logger, may not be null.
881     * @param pattern pattern, may be null.
882     * @param argument a value to be formatted and substituted.
883     */
884    public static void warn(final Logger logger, final String pattern,
885        final short argument) {
886        if (logger.isEnabledFor(Level.WARN)) {
887            forcedLog(logger, Level.WARN, format(pattern, valueOf(argument)));
888        }
889    }
890
891    /**
892     * Log a parameterized message at warn level.
893     * @param logger logger, may not be null.
894     * @param pattern pattern, may be null.
895     * @param argument a value to be formatted and substituted.
896     */
897    public static void warn(final Logger logger, final String pattern,
898        final int argument) {
899        if (logger.isEnabledFor(Level.WARN)) {
900            forcedLog(logger, Level.WARN, format(pattern, valueOf(argument)));
901        }
902    }
903
904    /**
905     * Log a parameterized message at warn level.
906     * @param logger logger, may not be null.
907     * @param pattern pattern, may be null.
908     * @param argument a value to be formatted and substituted.
909     */
910    public static void warn(final Logger logger, final String pattern,
911        final long argument) {
912        if (logger.isEnabledFor(Level.WARN)) {
913            forcedLog(logger, Level.WARN, format(pattern, valueOf(argument)));
914        }
915    }
916
917    /**
918     * Log a parameterized message at warn level.
919     * @param logger logger, may not be null.
920     * @param pattern pattern, may be null.
921     * @param argument a value to be formatted and substituted.
922     */
923    public static void warn(final Logger logger, final String pattern,
924        final float argument) {
925        if (logger.isEnabledFor(Level.WARN)) {
926            forcedLog(logger, Level.WARN, format(pattern, valueOf(argument)));
927        }
928    }
929
930    /**
931     * Log a parameterized message at warn level.
932     * @param logger logger, may not be null.
933     * @param pattern pattern, may be null.
934     * @param argument a value to be formatted and substituted.
935     */
936    public static void warn(final Logger logger, final String pattern,
937        final double argument) {
938        if (logger.isEnabledFor(Level.WARN)) {
939            forcedLog(logger, Level.WARN, format(pattern, valueOf(argument)));
940        }
941    }
942
943    /**
944     * Log a parameterized message at warn level.
945     * @param logger logger, may not be null.
946     * @param pattern pattern, may be null.
947     * @param argument a value to be formatted and substituted.
948     */
949    public static void warn(final Logger logger, final String pattern,
950        final Object argument) {
951        if (logger.isEnabledFor(Level.WARN)) {
952            forcedLog(logger, Level.WARN, format(pattern, argument));
953        }
954    }
955
956    /**
957     * Log a parameterized message at warn level.
958     * @param logger logger, may not be null.
959     * @param pattern pattern, may be null.
960     * @param arg0 a value to be formatted and substituted.
961     * @param arg1 a value to be formatted and substituted.
962     */
963    public static void warn(final Logger logger, final String pattern,
964        final Object arg0, final Object arg1) {
965        if (logger.isEnabledFor(Level.WARN)) {
966            forcedLog(logger, Level.WARN,
967                    format(pattern, toArray(arg0, arg1)));
968        }
969    }
970
971    /**
972     * Log a parameterized message at warn level.
973     * @param logger logger, may not be null.
974     * @param pattern pattern, may be null.
975     * @param arg0 a value to be formatted and substituted.
976     * @param arg1 a value to be formatted and substituted.
977     * @param arg2 a value to be formatted and substituted.
978     */
979    public static void warn(final Logger logger, final String pattern,
980        final Object arg0, final Object arg1, final Object arg2) {
981        if (logger.isEnabledFor(Level.WARN)) {
982            forcedLog(logger, Level.WARN,
983                    format(pattern, toArray(arg0, arg1, arg2)));
984        }
985    }
986
987    /**
988     * Log a parameterized message at warn level.
989     * @param logger logger, may not be null.
990     * @param pattern pattern, may be null.
991     * @param arg0 a value to be formatted and substituted.
992     * @param arg1 a value to be formatted and substituted.
993     * @param arg2 a value to be formatted and substituted.
994     * @param arg3 a value to be formatted and substituted.
995     */
996    public static void warn(final Logger logger, final String pattern,
997        final Object arg0, final Object arg1, final Object arg2,
998        final Object arg3) {
999        if (logger.isEnabledFor(Level.WARN)) {
1000            forcedLog(logger, Level.WARN, format(pattern,
1001                    toArray(arg0, arg1, arg2, arg3)));
1002        }
1003    }
1004
1005    /**
1006      * Log a parameterized message at specified level.
1007      * @param logger logger, may not be null.
1008      * @param level level, may not be null.
1009      * @param pattern pattern, may be null.
1010     * @param parameters parameters to the log message.
1011      */
1012    public static void log(final Logger logger,
1013                             final Level level,
1014                             final String pattern,
1015                             final Object[] parameters) {
1016        if (logger.isEnabledFor(level)) {
1017            forcedLog(logger, level,
1018                    format(pattern, parameters));
1019        }
1020    }
1021
1022    /**
1023      * Log a parameterized message at specified level.
1024      * @param logger logger, may not be null.
1025      * @param level level, may not be null.
1026     * @param t throwable, may be null.
1027      * @param pattern pattern, may be null.
1028     * @param parameters parameters to the log message.
1029      */
1030    public static void log(final Logger logger,
1031                             final Level level,
1032                             final Throwable t,
1033                             final String pattern,
1034                             final Object[] parameters) {
1035        if (logger.isEnabledFor(level)) {
1036            forcedLog(logger, level,
1037                    format(pattern, parameters), t);
1038        }
1039    }
1040
1041    /**
1042      * Log a parameterized message at specified level.
1043      * @param logger logger, may not be null.
1044      * @param level level, may not be null.
1045      * @param pattern pattern, may be null.
1046     * @param param1 parameter to the log message.
1047      */
1048    public static void log(final Logger logger,
1049                             final Level level,
1050                             final String pattern,
1051                             final Object param1) {
1052        if (logger.isEnabledFor(level)) {
1053            forcedLog(logger, level,
1054                    format(pattern, toArray(param1)));
1055        }
1056    }
1057
1058    /**
1059      * Log a parameterized message at specified level.
1060      * @param logger logger, may not be null.
1061      * @param level level, may not be null.
1062      * @param pattern pattern, may be null.
1063     * @param param1 parameter to the log message.
1064      */
1065    public static void log(final Logger logger,
1066                             final Level level,
1067                             final String pattern,
1068                             final boolean param1) {
1069        if (logger.isEnabledFor(level)) {
1070            forcedLog(logger, level,
1071                    format(pattern, toArray(valueOf(param1))));
1072        }
1073    }
1074
1075
1076    /**
1077      * Log a parameterized message at specified level.
1078      * @param logger logger, may not be null.
1079      * @param level level, may not be null.
1080      * @param pattern pattern, may be null.
1081     * @param param1 parameter to the log message.
1082      */
1083    public static void log(final Logger logger,
1084                             final Level level,
1085                             final String pattern,
1086                             final byte param1) {
1087        if (logger.isEnabledFor(level)) {
1088            forcedLog(logger, level,
1089                    format(pattern, toArray(valueOf(param1))));
1090        }
1091    }
1092
1093
1094    /**
1095      * Log a parameterized message at specified level.
1096      * @param logger logger, may not be null.
1097      * @param level level, may not be null.
1098      * @param pattern pattern, may be null.
1099     * @param param1 parameter to the log message.
1100      */
1101    public static void log(final Logger logger,
1102                             final Level level,
1103                             final String pattern,
1104                             final char param1) {
1105        if (logger.isEnabledFor(level)) {
1106            forcedLog(logger, level,
1107                    format(pattern, toArray(valueOf(param1))));
1108        }
1109    }
1110
1111    /**
1112      * Log a parameterized message at specified level.
1113      * @param logger logger, may not be null.
1114      * @param level level, may not be null.
1115      * @param pattern pattern, may be null.
1116     * @param param1 parameter to the log message.
1117      */
1118    public static void log(final Logger logger,
1119                             final Level level,
1120                             final String pattern,
1121                             final short param1) {
1122        if (logger.isEnabledFor(level)) {
1123            forcedLog(logger, level,
1124                    format(pattern, toArray(valueOf(param1))));
1125        }
1126    }
1127
1128    /**
1129      * Log a parameterized message at specified level.
1130      * @param logger logger, may not be null.
1131      * @param level level, may not be null.
1132      * @param pattern pattern, may be null.
1133     * @param param1 parameter to the log message.
1134      */
1135    public static void log(final Logger logger,
1136                             final Level level,
1137                             final String pattern,
1138                             final int param1) {
1139        if (logger.isEnabledFor(level)) {
1140            forcedLog(logger, level,
1141                    format(pattern, toArray(valueOf(param1))));
1142        }
1143    }
1144
1145
1146    /**
1147      * Log a parameterized message at specified level.
1148      * @param logger logger, may not be null.
1149      * @param level level, may not be null.
1150      * @param pattern pattern, may be null.
1151     * @param param1 parameter to the log message.
1152      */
1153    public static void log(final Logger logger,
1154                             final Level level,
1155                             final String pattern,
1156                             final long param1) {
1157        if (logger.isEnabledFor(level)) {
1158            forcedLog(logger, level,
1159                    format(pattern, toArray(valueOf(param1))));
1160        }
1161    }
1162
1163
1164    /**
1165      * Log a parameterized message at specified level.
1166      * @param logger logger, may not be null.
1167      * @param level level, may not be null.
1168      * @param pattern pattern, may be null.
1169     * @param param1 parameter to the log message.
1170      */
1171    public static void log(final Logger logger,
1172                             final Level level,
1173                             final String pattern,
1174                             final float param1) {
1175        if (logger.isEnabledFor(level)) {
1176            forcedLog(logger, level,
1177                    format(pattern, toArray(valueOf(param1))));
1178        }
1179    }
1180
1181
1182    /**
1183      * Log a parameterized message at specified level.
1184      * @param logger logger, may not be null.
1185      * @param level level, may not be null.
1186      * @param pattern pattern, may be null.
1187     * @param param1 parameter to the log message.
1188      */
1189    public static void log(final Logger logger,
1190                             final Level level,
1191                             final String pattern,
1192                             final double param1) {
1193        if (logger.isEnabledFor(level)) {
1194            forcedLog(logger, level,
1195                    format(pattern, toArray(valueOf(param1))));
1196        }
1197    }
1198
1199
1200    /**
1201     * Log a parameterized message at specified level.
1202     * @param logger logger, may not be null.
1203     * @param level level, may not be null.
1204     * @param pattern pattern, may be null.
1205     * @param arg0 a value to be formatted and substituted.
1206     * @param arg1 a value to be formatted and substituted.
1207     */
1208    public static void log(final Logger logger,
1209                            final Level level,
1210                            final String pattern,
1211        final Object arg0, final Object arg1) {
1212        if (logger.isEnabledFor(level)) {
1213            forcedLog(logger, level,
1214                    format(pattern, toArray(arg0, arg1)));
1215        }
1216    }
1217
1218    /**
1219     * Log a parameterized message at specifed level.
1220     * @param logger logger, may not be null.
1221     * @param level level, may not be null.
1222     * @param pattern pattern, may be null.
1223     * @param arg0 a value to be formatted and substituted.
1224     * @param arg1 a value to be formatted and substituted.
1225     * @param arg2 a value to be formatted and substituted.
1226     */
1227    public static void log(final Logger logger,
1228                           final Level level,
1229                           final String pattern,
1230        final Object arg0, final Object arg1, final Object arg2) {
1231        if (logger.isEnabledFor(level)) {
1232            forcedLog(logger, level,
1233                    format(pattern, toArray(arg0, arg1, arg2)));
1234        }
1235    }
1236
1237    /**
1238     * Log a parameterized message at specified level.
1239     * @param logger logger, may not be null.
1240     * @param pattern pattern, may be null.
1241     * @param level level, may not be null.
1242     * @param arg0 a value to be formatted and substituted.
1243     * @param arg1 a value to be formatted and substituted.
1244     * @param arg2 a value to be formatted and substituted.
1245     * @param arg3 a value to be formatted and substituted.
1246     */
1247    public static void log(final Logger logger,
1248                           final Level level,
1249                           final String pattern,
1250        final Object arg0, final Object arg1, final Object arg2,
1251        final Object arg3) {
1252        if (logger.isEnabledFor(level)) {
1253            forcedLog(logger, level, format(pattern,
1254                    toArray(arg0, arg1, arg2, arg3)));
1255        }
1256    }
1257
1258
1259    /**
1260      * Log a parameterized message using a pattern from a resource bundle.
1261      * @param logger logger, may not be null.
1262      * @param level level, may not be null.
1263      * @param bundleName resource bundle name, may be null.
1264     * @param key key, may be null.
1265     * @param parameters parameters to the log message.
1266      */
1267    public static void logrb(final Logger logger,
1268                             final Level level,
1269                             final String bundleName,
1270                             final String key,
1271                             final Object[] parameters) {
1272        if (logger.isEnabledFor(level)) {
1273            forcedLog(logger, level,
1274                    format(bundleName, key, parameters));
1275        }
1276    }
1277
1278    /**
1279      * Log a parameterized message using a pattern from a resource bundle.
1280      * @param logger logger, may not be null.
1281      * @param level level, may not be null.
1282     * @param t throwable, may be null.
1283      * @param bundleName resource bundle name, may be null.
1284     * @param key key, may be null.
1285     * @param parameters parameters to the log message.
1286      */
1287    public static void logrb(final Logger logger,
1288                             final Level level,
1289                             final Throwable t,
1290                             final String bundleName,
1291                             final String key,
1292                             final Object[] parameters) {
1293        if (logger.isEnabledFor(level)) {
1294            forcedLog(logger, level,
1295                    format(bundleName, key, parameters), t);
1296        }
1297    }
1298
1299    /**
1300      * Log a parameterized message using a pattern from a resource bundle.
1301      * @param logger logger, may not be null.
1302      * @param level level, may not be null.
1303      * @param bundleName resource bundle name, may be null.
1304     * @param key key, may be null.
1305     * @param param1 Parameter to the log message.
1306      */
1307    public static void logrb(final Logger logger,
1308                             final Level level,
1309                             final String bundleName,
1310                             final String key,
1311                             final Object param1) {
1312        if (logger.isEnabledFor(level)) {
1313            forcedLog(logger, level,
1314                    format(bundleName, key, toArray(param1)));
1315        }
1316    }
1317
1318    /**
1319      * Log a parameterized message using a pattern from a resource bundle.
1320      * @param logger logger, may not be null.
1321      * @param level level, may not be null.
1322      * @param bundleName resource bundle name, may be null.
1323     * @param key key, may be null.
1324     * @param param1 Parameter to the log message.
1325      */
1326    public static void logrb(final Logger logger,
1327                             final Level level,
1328                             final String bundleName,
1329                             final String key,
1330                             final boolean param1) {
1331        if (logger.isEnabledFor(level)) {
1332            forcedLog(logger, level,
1333                    format(bundleName, key, toArray(valueOf(param1))));
1334        }
1335    }
1336
1337    /**
1338      * Log a parameterized message using a pattern from a resource bundle.
1339      * @param logger logger, may not be null.
1340      * @param level level, may not be null.
1341      * @param bundleName resource bundle name, may be null.
1342     * @param key key, may be null.
1343     * @param param1 Parameter to the log message.
1344      */
1345    public static void logrb(final Logger logger,
1346                             final Level level,
1347                             final String bundleName,
1348                             final String key,
1349                             final char param1) {
1350        if (logger.isEnabledFor(level)) {
1351            forcedLog(logger, level,
1352                    format(bundleName, key, toArray(valueOf(param1))));
1353        }
1354    }
1355
1356    /**
1357      * Log a parameterized message using a pattern from a resource bundle.
1358      * @param logger logger, may not be null.
1359      * @param level level, may not be null.
1360      * @param bundleName resource bundle name, may be null.
1361     * @param key key, may be null.
1362     * @param param1 Parameter to the log message.
1363      */
1364    public static void logrb(final Logger logger,
1365                             final Level level,
1366                             final String bundleName,
1367                             final String key,
1368                             final byte param1) {
1369        if (logger.isEnabledFor(level)) {
1370            forcedLog(logger, level,
1371                    format(bundleName, key, toArray(valueOf(param1))));
1372        }
1373    }
1374
1375    /**
1376      * Log a parameterized message using a pattern from a resource bundle.
1377      * @param logger logger, may not be null.
1378      * @param level level, may not be null.
1379      * @param bundleName resource bundle name, may be null.
1380     * @param key key, may be null.
1381     * @param param1 Parameter to the log message.
1382      */
1383    public static void logrb(final Logger logger,
1384                             final Level level,
1385                             final String bundleName,
1386                             final String key,
1387                             final short param1) {
1388        if (logger.isEnabledFor(level)) {
1389            forcedLog(logger, level,
1390                    format(bundleName, key, toArray(valueOf(param1))));
1391        }
1392    }
1393
1394    /**
1395      * Log a parameterized message using a pattern from a resource bundle.
1396      * @param logger logger, may not be null.
1397      * @param level level, may not be null.
1398      * @param bundleName resource bundle name, may be null.
1399     * @param key key, may be null.
1400     * @param param1 Parameter to the log message.
1401      */
1402    public static void logrb(final Logger logger,
1403                             final Level level,
1404                             final String bundleName,
1405                             final String key,
1406                             final int param1) {
1407        if (logger.isEnabledFor(level)) {
1408            forcedLog(logger, level,
1409                    format(bundleName, key, toArray(valueOf(param1))));
1410        }
1411    }
1412
1413    /**
1414      * Log a parameterized message using a pattern from a resource bundle.
1415      * @param logger logger, may not be null.
1416      * @param level level, may not be null.
1417      * @param bundleName resource bundle name, may be null.
1418     * @param key key, may be null.
1419     * @param param1 Parameter to the log message.
1420      */
1421    public static void logrb(final Logger logger,
1422                             final Level level,
1423                             final String bundleName,
1424                             final String key,
1425                             final long param1) {
1426        if (logger.isEnabledFor(level)) {
1427            forcedLog(logger, level,
1428                    format(bundleName, key, toArray(valueOf(param1))));
1429        }
1430    }
1431    /**
1432      * Log a parameterized message using a pattern from a resource bundle.
1433      * @param logger logger, may not be null.
1434      * @param level level, may not be null.
1435      * @param bundleName resource bundle name, may be null.
1436     * @param key key, may be null.
1437     * @param param1 Parameter to the log message.
1438      */
1439    public static void logrb(final Logger logger,
1440                             final Level level,
1441                             final String bundleName,
1442                             final String key,
1443                             final float param1) {
1444        if (logger.isEnabledFor(level)) {
1445            forcedLog(logger, level,
1446                    format(bundleName, key, toArray(valueOf(param1))));
1447        }
1448    }
1449
1450
1451    /**
1452      * Log a parameterized message using a pattern from a resource bundle.
1453      * @param logger logger, may not be null.
1454      * @param level level, may not be null.
1455      * @param bundleName resource bundle name, may be null.
1456     * @param key key, may be null.
1457     * @param param1 Parameter to the log message.
1458      */
1459    public static void logrb(final Logger logger,
1460                             final Level level,
1461                             final String bundleName,
1462                             final String key,
1463                             final double param1) {
1464        if (logger.isEnabledFor(level)) {
1465            forcedLog(logger, level,
1466                    format(bundleName, key, toArray(valueOf(param1))));
1467        }
1468    }
1469
1470    /**
1471      * Log a parameterized message using a pattern from a resource bundle.
1472      * @param logger logger, may not be null.
1473      * @param level level, may not be null.
1474      * @param bundleName resource bundle name, may be null.
1475     * @param key key, may be null.
1476     * @param param0 Parameter to the log message.
1477     * @param param1 Parameter to the log message.
1478      */
1479    public static void logrb(final Logger logger,
1480                             final Level level,
1481                             final String bundleName,
1482                             final String key,
1483                             final Object param0,
1484                             final Object param1) {
1485        if (logger.isEnabledFor(level)) {
1486            forcedLog(logger, level,
1487                    format(bundleName, key, toArray(param0, param1)));
1488        }
1489    }
1490
1491
1492    /**
1493      * Log a parameterized message using a pattern from a resource bundle.
1494      * @param logger logger, may not be null.
1495      * @param level level, may not be null.
1496      * @param bundleName resource bundle name, may be null.
1497     * @param key key, may be null.
1498     * @param param0 Parameter to the log message.
1499     * @param param1 Parameter to the log message.
1500     * @param param2 Parameter to the log message.
1501      */
1502    public static void logrb(final Logger logger,
1503                             final Level level,
1504                             final String bundleName,
1505                             final String key,
1506                             final Object param0,
1507                             final Object param1,
1508                             final Object param2) {
1509        if (logger.isEnabledFor(level)) {
1510            forcedLog(logger, level,
1511                    format(bundleName, key, toArray(param0, param1, param2)));
1512        }
1513    }
1514
1515
1516    /**
1517      * Log a parameterized message using a pattern from a resource bundle.
1518      * @param logger logger, may not be null.
1519      * @param level level, may not be null.
1520      * @param bundleName resource bundle name, may be null.
1521     * @param key key, may be null.
1522     * @param param0 Parameter to the log message.
1523     * @param param1 Parameter to the log message.
1524     * @param param2 Parameter to the log message.
1525     * @param param3 Parameter to the log message.
1526      */
1527    public static void logrb(final Logger logger,
1528                             final Level level,
1529                             final String bundleName,
1530                             final String key,
1531                             final Object param0,
1532                             final Object param1,
1533                             final Object param2,
1534                             final Object param3) {
1535        if (logger.isEnabledFor(level)) {
1536            forcedLog(logger, level,
1537                    format(bundleName, key,
1538                            toArray(param0, param1, param2, param3)));
1539        }
1540    }
1541}