View Javadoc
1   /**
2    * Copyright (c) 2004-2011 QOS.ch
3    * All rights reserved.
4    *
5    * Permission is hereby granted, free  of charge, to any person obtaining
6    * a  copy  of this  software  and  associated  documentation files  (the
7    * "Software"), to  deal in  the Software without  restriction, including
8    * without limitation  the rights to  use, copy, modify,  merge, publish,
9    * distribute,  sublicense, and/or sell  copies of  the Software,  and to
10   * permit persons to whom the Software  is furnished to do so, subject to
11   * the following conditions:
12   *
13   * The  above  copyright  notice  and  this permission  notice  shall  be
14   * included in all copies or substantial portions of the Software.
15   *
16   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
17   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
18   * MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
19   * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20   * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21   * OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
22   * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23   *
24   */
25  package org.slf4j.ext;
26  
27  import org.slf4j.Logger;
28  import org.slf4j.Marker;
29  //import org.slf4j.helpers.FormattingTuple;
30  //import org.slf4j.helpers.MessageFormatter;
31  import org.slf4j.spi.LocationAwareLogger;
32  
33  /**
34   * A helper class wrapping an {@link org.slf4j.Logger} instance preserving
35   * location information if the wrapped instance supports it.
36   * 
37   * @author Ralph Goers
38   * @author Ceki Gülcü
39   */
40  public class LoggerWrapper implements Logger {
41  
42      // To ensure consistency between two instances sharing the same name
43      // (homonyms) a LoggerWrapper should not contain any state beyond
44      // the Logger instance it wraps.
45      // Note that 'instanceofLAL' directly depends on Logger.
46      // fqcn depend on the caller, but its value would not be different
47      // between successive invocations of a factory class
48  
49      protected final Logger logger;
50      final String fqcn;
51      // is this logger instance a LocationAwareLogger
52      protected final boolean instanceofLAL;
53  
54      public LoggerWrapper(Logger logger, String fqcn) {
55          this.logger = logger;
56          this.fqcn = fqcn;
57          if (logger instanceof LocationAwareLogger) {
58              instanceofLAL = true;
59          } else {
60              instanceofLAL = false;
61          }
62      }
63  
64      /**
65       * Delegate to the appropriate method of the underlying logger.
66       */
67      public boolean isTraceEnabled() {
68          return logger.isTraceEnabled();
69      }
70  
71      /**
72       * Delegate to the appropriate method of the underlying logger.
73       */
74      public boolean isTraceEnabled(Marker marker) {
75          return logger.isTraceEnabled(marker);
76      }
77  
78      /**
79       * Delegate to the appropriate method of the underlying logger.
80       */
81      public void trace(String msg) {
82          if (!logger.isTraceEnabled())
83              return;
84  
85          if (instanceofLAL) {
86              ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.TRACE_INT, msg, null, null);
87          } else {
88              logger.trace(msg);
89          }
90      }
91  
92      /**
93       * Delegate to the appropriate method of the underlying logger.
94       */
95      public void trace(String format, Object arg) {
96          if (!logger.isTraceEnabled())
97              return;
98  
99          if (instanceofLAL) {
100             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.TRACE_INT, format, new Object[] { arg }, null);
101         } else {
102             logger.trace(format, arg);
103         }
104     }
105 
106     /**
107      * Delegate to the appropriate method of the underlying logger.
108      */
109     public void trace(String format, Object arg1, Object arg2) {
110         if (!logger.isTraceEnabled())
111             return;
112 
113         if (instanceofLAL) {
114             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.TRACE_INT, format, new Object[] { arg1, arg2 }, null);
115         } else {
116             logger.trace(format, arg1, arg2);
117         }
118     }
119 
120     /**
121      * Delegate to the appropriate method of the underlying logger.
122      */
123     public void trace(String format, Object... args) {
124         if (!logger.isTraceEnabled())
125             return;
126 
127         if (instanceofLAL) {
128             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.TRACE_INT, format, args, null);
129         } else {
130             logger.trace(format, args);
131         }
132     }
133 
134     /**
135      * Delegate to the appropriate method of the underlying logger.
136      */
137     public void trace(String msg, Throwable t) {
138         if (!logger.isTraceEnabled())
139             return;
140 
141         if (instanceofLAL) {
142             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.TRACE_INT, msg, null, t);
143         } else {
144             logger.trace(msg, t);
145         }
146     }
147 
148     /**
149      * Delegate to the appropriate method of the underlying logger.
150      */
151     public void trace(Marker marker, String msg) {
152         if (!logger.isTraceEnabled(marker))
153             return;
154         if (instanceofLAL) {
155             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.TRACE_INT, msg, null, null);
156         } else {
157             logger.trace(marker, msg);
158         }
159     }
160 
161     /**
162      * Delegate to the appropriate method of the underlying logger.
163      */
164     public void trace(Marker marker, String format, Object arg) {
165         if (!logger.isTraceEnabled(marker))
166             return;
167         if (instanceofLAL) {
168             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.TRACE_INT, format, new Object[] { arg }, null);
169         } else {
170             logger.trace(marker, format, arg);
171         }
172     }
173 
174     /**
175      * Delegate to the appropriate method of the underlying logger.
176      */
177     public void trace(Marker marker, String format, Object arg1, Object arg2) {
178         if (!logger.isTraceEnabled(marker))
179             return;
180         if (instanceofLAL) {
181             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.TRACE_INT, format, new Object[] { arg1, arg2 }, null);
182         } else {
183             logger.trace(marker, format, arg1, arg2);
184         }
185     }
186 
187     /**
188      * Delegate to the appropriate method of the underlying logger.
189      */
190     public void trace(Marker marker, String format, Object... args) {
191         if (!logger.isTraceEnabled(marker))
192             return;
193         if (instanceofLAL) {
194             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.TRACE_INT, format, args, null);
195         } else {
196             logger.trace(marker, format, args);
197         }
198     }
199 
200     /**
201      * Delegate to the appropriate method of the underlying logger.
202      */
203     public void trace(Marker marker, String msg, Throwable t) {
204         if (!logger.isTraceEnabled(marker))
205             return;
206         if (instanceofLAL) {
207             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.TRACE_INT, msg, null, t);
208         } else {
209             logger.trace(marker, msg, t);
210         }
211     }
212 
213     /**
214      * Delegate to the appropriate method of the underlying logger.
215      */
216     public boolean isDebugEnabled() {
217         return logger.isDebugEnabled();
218     }
219 
220     /**
221      * Delegate to the appropriate method of the underlying logger.
222      */
223     public boolean isDebugEnabled(Marker marker) {
224         return logger.isDebugEnabled(marker);
225     }
226 
227     /**
228      * Delegate to the appropriate method of the underlying logger.
229      */
230     public void debug(String msg) {
231         if (!logger.isDebugEnabled())
232             return;
233 
234         if (instanceofLAL) {
235             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.DEBUG_INT, msg, null, null);
236         } else {
237             logger.debug(msg);
238         }
239     }
240 
241     /**
242      * Delegate to the appropriate method of the underlying logger.
243      */
244     public void debug(String format, Object arg) {
245         if (!logger.isDebugEnabled())
246             return;
247 
248         if (instanceofLAL) {
249             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.DEBUG_INT, format, new Object[] { arg }, null);
250         } else {
251             logger.debug(format, arg);
252         }
253     }
254 
255     /**
256      * Delegate to the appropriate method of the underlying logger.
257      */
258     public void debug(String format, Object arg1, Object arg2) {
259         if (!logger.isDebugEnabled())
260             return;
261 
262         if (instanceofLAL) {
263             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.DEBUG_INT, format, new Object[] { arg1, arg2 }, null);
264         } else {
265             logger.debug(format, arg1, arg2);
266         }
267     }
268 
269     /**
270      * Delegate to the appropriate method of the underlying logger.
271      */
272     public void debug(String format, Object... argArray) {
273         if (!logger.isDebugEnabled())
274             return;
275 
276         if (instanceofLAL) {
277             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.DEBUG_INT, format, argArray, null);
278         } else {
279             logger.debug(format, argArray);
280         }
281     }
282 
283     /**
284      * Delegate to the appropriate method of the underlying logger.
285      */
286     public void debug(String msg, Throwable t) {
287         if (!logger.isDebugEnabled())
288             return;
289 
290         if (instanceofLAL) {
291             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.DEBUG_INT, msg, null, t);
292         } else {
293             logger.debug(msg, t);
294         }
295     }
296 
297     /**
298      * Delegate to the appropriate method of the underlying logger.
299      */
300     public void debug(Marker marker, String msg) {
301         if (!logger.isDebugEnabled(marker))
302             return;
303         if (instanceofLAL) {
304             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.DEBUG_INT, msg, null, null);
305         } else {
306             logger.debug(marker, msg);
307         }
308     }
309 
310     /**
311      * Delegate to the appropriate method of the underlying logger.
312      */
313     public void debug(Marker marker, String format, Object arg) {
314         if (!logger.isDebugEnabled(marker))
315             return;
316         if (instanceofLAL) {
317             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.DEBUG_INT, format, new Object[] { arg }, null);
318         } else {
319             logger.debug(marker, format, arg);
320         }
321     }
322 
323     /**
324      * Delegate to the appropriate method of the underlying logger.
325      */
326     public void debug(Marker marker, String format, Object arg1, Object arg2) {
327         if (!logger.isDebugEnabled(marker))
328             return;
329         if (instanceofLAL) {
330             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.DEBUG_INT, format, new Object[] { arg1, arg2 }, null);
331         } else {
332             logger.debug(marker, format, arg1, arg2);
333         }
334     }
335 
336     /**
337      * Delegate to the appropriate method of the underlying logger.
338      */
339     public void debug(Marker marker, String format, Object... argArray) {
340         if (!logger.isDebugEnabled(marker))
341             return;
342         if (instanceofLAL) {
343 
344             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.DEBUG_INT, format, argArray, null);
345         } else {
346             logger.debug(marker, format, argArray);
347         }
348     }
349 
350     /**
351      * Delegate to the appropriate method of the underlying logger.
352      */
353     public void debug(Marker marker, String msg, Throwable t) {
354         if (!logger.isDebugEnabled(marker))
355             return;
356         if (instanceofLAL) {
357             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.DEBUG_INT, msg, null, t);
358         } else {
359             logger.debug(marker, msg, t);
360         }
361     }
362 
363     /**
364      * Delegate to the appropriate method of the underlying logger.
365      */
366     public boolean isInfoEnabled() {
367         return logger.isInfoEnabled();
368     }
369 
370     /**
371      * Delegate to the appropriate method of the underlying logger.
372      */
373     public boolean isInfoEnabled(Marker marker) {
374         return logger.isInfoEnabled(marker);
375     }
376 
377     /**
378      * Delegate to the appropriate method of the underlying logger.
379      */
380     public void info(String msg) {
381         if (!logger.isInfoEnabled())
382             return;
383 
384         if (instanceofLAL) {
385             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.INFO_INT, msg, null, null);
386         } else {
387             logger.info(msg);
388         }
389     }
390 
391     /**
392      * Delegate to the appropriate method of the underlying logger.
393      */
394     public void info(String format, Object arg) {
395         if (!logger.isInfoEnabled())
396             return;
397 
398         if (instanceofLAL) {
399             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.INFO_INT, format, new Object[] { arg }, null);
400         } else {
401             logger.info(format, arg);
402         }
403     }
404 
405     /**
406      * Delegate to the appropriate method of the underlying logger.
407      */
408     public void info(String format, Object arg1, Object arg2) {
409         if (!logger.isInfoEnabled())
410             return;
411 
412         if (instanceofLAL) {
413             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.INFO_INT, format, new Object[] { arg1, arg2 }, null);
414         } else {
415             logger.info(format, arg1, arg2);
416         }
417     }
418 
419     /**
420      * Delegate to the appropriate method of the underlying logger.
421      */
422     public void info(String format, Object... args) {
423         if (!logger.isInfoEnabled())
424             return;
425 
426         if (instanceofLAL) {
427             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.INFO_INT, format, args, null);
428         } else {
429             logger.info(format, args);
430         }
431     }
432 
433     /**
434      * Delegate to the appropriate method of the underlying logger.
435      */
436     public void info(String msg, Throwable t) {
437         if (!logger.isInfoEnabled())
438             return;
439 
440         if (instanceofLAL) {
441             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.INFO_INT, msg, null, t);
442         } else {
443             logger.info(msg, t);
444         }
445     }
446 
447     /**
448      * Delegate to the appropriate method of the underlying logger.
449      */
450     public void info(Marker marker, String msg) {
451         if (!logger.isInfoEnabled(marker))
452             return;
453         if (instanceofLAL) {
454             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.INFO_INT, msg, null, null);
455         } else {
456             logger.info(marker, msg);
457         }
458     }
459 
460     /**
461      * Delegate to the appropriate method of the underlying logger.
462      */
463     public void info(Marker marker, String format, Object arg) {
464         if (!logger.isInfoEnabled(marker))
465             return;
466         if (instanceofLAL) {
467             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.INFO_INT, format, new Object[] { arg }, null);
468         } else {
469             logger.info(marker, format, arg);
470         }
471     }
472 
473     /**
474      * Delegate to the appropriate method of the underlying logger.
475      */
476     public void info(Marker marker, String format, Object arg1, Object arg2) {
477         if (!logger.isInfoEnabled(marker))
478             return;
479         if (instanceofLAL) {
480             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.INFO_INT, format, new Object[] { arg1, arg2 }, null);
481         } else {
482             logger.info(marker, format, arg1, arg2);
483         }
484     }
485 
486     /**
487      * Delegate to the appropriate method of the underlying logger.
488      */
489     public void info(Marker marker, String format, Object... args) {
490         if (!logger.isInfoEnabled(marker))
491             return;
492         if (instanceofLAL) {
493             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.INFO_INT, format, args, null);
494         } else {
495             logger.info(marker, format, args);
496         }
497     }
498 
499     /**
500      * Delegate to the appropriate method of the underlying logger.
501      */
502     public void info(Marker marker, String msg, Throwable t) {
503         if (!logger.isInfoEnabled(marker))
504             return;
505         if (instanceofLAL) {
506             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.INFO_INT, msg, null, t);
507         } else {
508             logger.info(marker, msg, t);
509         }
510     }
511 
512     public boolean isWarnEnabled() {
513         return logger.isWarnEnabled();
514     }
515 
516     /**
517      * Delegate to the appropriate method of the underlying logger.
518      */
519     public boolean isWarnEnabled(Marker marker) {
520         return logger.isWarnEnabled(marker);
521     }
522 
523     /**
524      * Delegate to the appropriate method of the underlying logger.
525      */
526     public void warn(String msg) {
527         if (!logger.isWarnEnabled())
528             return;
529 
530         if (instanceofLAL) {
531             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.WARN_INT, msg, null, null);
532         } else {
533             logger.warn(msg);
534         }
535     }
536 
537     /**
538      * Delegate to the appropriate method of the underlying logger.
539      */
540     public void warn(String format, Object arg) {
541         if (!logger.isWarnEnabled())
542             return;
543 
544         if (instanceofLAL) {
545             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.WARN_INT, format, new Object[] { arg }, null);
546         } else {
547             logger.warn(format, arg);
548         }
549     }
550 
551     /**
552      * Delegate to the appropriate method of the underlying logger.
553      */
554     public void warn(String format, Object arg1, Object arg2) {
555         if (!logger.isWarnEnabled())
556             return;
557 
558         if (instanceofLAL) {
559             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.WARN_INT, format, new Object[] { arg1, arg2 }, null);
560         } else {
561             logger.warn(format, arg1, arg2);
562         }
563     }
564 
565     /**
566      * Delegate to the appropriate method of the underlying logger.
567      */
568     public void warn(String format, Object... args) {
569         if (!logger.isWarnEnabled())
570             return;
571 
572         if (instanceofLAL) {
573             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.WARN_INT, format, args, null);
574         } else {
575             logger.warn(format, args);
576         }
577     }
578 
579     /**
580      * Delegate to the appropriate method of the underlying logger.
581      */
582     public void warn(String msg, Throwable t) {
583         if (!logger.isWarnEnabled())
584             return;
585 
586         if (instanceofLAL) {
587             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.WARN_INT, msg, null, t);
588         } else {
589             logger.warn(msg, t);
590         }
591     }
592 
593     /**
594      * Delegate to the appropriate method of the underlying logger.
595      */
596     public void warn(Marker marker, String msg) {
597         if (!logger.isWarnEnabled(marker))
598             return;
599         if (instanceofLAL) {
600             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.WARN_INT, msg, null, null);
601         } else {
602             logger.warn(marker, msg);
603         }
604     }
605 
606     /**
607      * Delegate to the appropriate method of the underlying logger.
608      */
609     public void warn(Marker marker, String format, Object arg) {
610         if (!logger.isWarnEnabled(marker))
611             return;
612         if (instanceofLAL) {
613             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.WARN_INT, format, new Object[] { arg }, null);
614         } else {
615             logger.warn(marker, format, arg);
616         }
617     }
618 
619     /**
620      * Delegate to the appropriate method of the underlying logger.
621      */
622     public void warn(Marker marker, String format, Object arg1, Object arg2) {
623         if (!logger.isWarnEnabled(marker))
624             return;
625         if (instanceofLAL) {
626             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.WARN_INT, format, new Object[] { arg1, arg2 }, null);
627         } else {
628             logger.warn(marker, format, arg1, arg2);
629         }
630     }
631 
632     /**
633      * Delegate to the appropriate method of the underlying logger.
634      */
635     public void warn(Marker marker, String format, Object... args) {
636         if (!logger.isWarnEnabled(marker))
637             return;
638         if (instanceofLAL) {
639             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.WARN_INT, format, args, null);
640         } else {
641             logger.warn(marker, format, args);
642         }
643     }
644 
645     /**
646      * Delegate to the appropriate method of the underlying logger.
647      */
648     public void warn(Marker marker, String msg, Throwable t) {
649         if (!logger.isWarnEnabled(marker))
650             return;
651         if (instanceofLAL) {
652             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.WARN_INT, msg, null, t);
653         } else {
654             logger.warn(marker, msg, t);
655         }
656     }
657 
658     /**
659      * Delegate to the appropriate method of the underlying logger.
660      */
661     public boolean isErrorEnabled() {
662         return logger.isErrorEnabled();
663     }
664 
665     /**
666      * Delegate to the appropriate method of the underlying logger.
667      */
668     public boolean isErrorEnabled(Marker marker) {
669         return logger.isErrorEnabled(marker);
670     }
671 
672     /**
673      * Delegate to the appropriate method of the underlying logger.
674      */
675     public void error(String msg) {
676         if (!logger.isErrorEnabled())
677             return;
678 
679         if (instanceofLAL) {
680             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.ERROR_INT, msg, null, null);
681         } else {
682             logger.error(msg);
683         }
684     }
685 
686     /**
687      * Delegate to the appropriate method of the underlying logger.
688      */
689     public void error(String format, Object arg) {
690         if (!logger.isErrorEnabled())
691             return;
692 
693         if (instanceofLAL) {
694             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.ERROR_INT, format, new Object[] { arg }, null);
695         } else {
696             logger.error(format, arg);
697         }
698     }
699 
700     /**
701      * Delegate to the appropriate method of the underlying logger.
702      */
703     public void error(String format, Object arg1, Object arg2) {
704         if (!logger.isErrorEnabled())
705             return;
706 
707         if (instanceofLAL) {
708             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.ERROR_INT, format, new Object[] { arg1, arg2 }, null);
709         } else {
710             logger.error(format, arg1, arg2);
711         }
712     }
713 
714     /**
715      * Delegate to the appropriate method of the underlying logger.
716      */
717     public void error(String format, Object... args) {
718         if (!logger.isErrorEnabled())
719             return;
720 
721         if (instanceofLAL) {
722             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.ERROR_INT, format, args, null);
723         } else {
724             logger.error(format, args);
725         }
726     }
727 
728     /**
729      * Delegate to the appropriate method of the underlying logger.
730      */
731     public void error(String msg, Throwable t) {
732         if (!logger.isErrorEnabled())
733             return;
734 
735         if (instanceofLAL) {
736             ((LocationAwareLogger) logger).log(null, fqcn, LocationAwareLogger.ERROR_INT, msg, null, t);
737         } else {
738             logger.error(msg, t);
739         }
740     }
741 
742     /**
743      * Delegate to the appropriate method of the underlying logger.
744      */
745     public void error(Marker marker, String msg) {
746         if (!logger.isErrorEnabled(marker))
747             return;
748         if (instanceofLAL) {
749             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.ERROR_INT, msg, null, null);
750         } else {
751             logger.error(marker, msg);
752         }
753     }
754 
755     /**
756      * Delegate to the appropriate method of the underlying logger.
757      */
758     public void error(Marker marker, String format, Object arg) {
759         if (!logger.isErrorEnabled(marker))
760             return;
761         if (instanceofLAL) {
762             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.ERROR_INT, format, new Object[] { arg }, null);
763         } else {
764             logger.error(marker, format, arg);
765         }
766     }
767 
768     /**
769      * Delegate to the appropriate method of the underlying logger.
770      */
771     public void error(Marker marker, String format, Object arg1, Object arg2) {
772         if (!logger.isErrorEnabled(marker))
773             return;
774         if (instanceofLAL) {
775             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.ERROR_INT, format, new Object[] { arg1, arg2 }, null);
776         } else {
777             logger.error(marker, format, arg1, arg2);
778         }
779     }
780 
781     /**
782      * Delegate to the appropriate method of the underlying logger.
783      */
784     public void error(Marker marker, String format, Object... args) {
785         if (!logger.isErrorEnabled(marker))
786             return;
787         if (instanceofLAL) {
788             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.ERROR_INT, format, args, null);
789         } else {
790             logger.error(marker, format, args);
791         }
792     }
793 
794     /**
795      * Delegate to the appropriate method of the underlying logger.
796      */
797     public void error(Marker marker, String msg, Throwable t) {
798         if (!logger.isErrorEnabled(marker))
799             return;
800         if (instanceofLAL) {
801             ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.ERROR_INT, msg, null, t);
802         } else {
803             logger.error(marker, msg, t);
804         }
805     }
806 
807     /**
808      * Delegate to the appropriate method of the underlying logger.
809      */
810     public String getName() {
811         return logger.getName();
812     }
813 }