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