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.logging.log4j.spi;
018
019import java.io.Serializable;
020
021import org.apache.logging.log4j.Level;
022import org.apache.logging.log4j.Marker;
023import org.apache.logging.log4j.MarkerManager;
024import org.apache.logging.log4j.message.Message;
025import org.apache.logging.log4j.message.MessageFactory;
026import org.apache.logging.log4j.message.ParameterizedMessageFactory;
027import org.apache.logging.log4j.message.StringFormattedMessage;
028import org.apache.logging.log4j.status.StatusLogger;
029
030/**
031 * Base implementation of a Logger. It is highly recommended that any Logger implementation extend this class.
032 */
033public abstract class AbstractLogger implements ExtendedLogger, Serializable {
034
035    private static final long serialVersionUID = 2L;
036
037    /**
038     * Marker for flow tracing.
039     */
040    public static final Marker FLOW_MARKER = MarkerManager.getMarker("FLOW");
041
042    /**
043     * Marker for method entry tracing.
044     */
045    public static final Marker ENTRY_MARKER = MarkerManager.getMarker("ENTRY").setParents(FLOW_MARKER);
046
047    /**
048     * Marker for method exit tracing.
049     */
050    public static final Marker EXIT_MARKER = MarkerManager.getMarker("EXIT").setParents(FLOW_MARKER);
051
052    /**
053     * Marker for exception tracing.
054     */
055    public static final Marker EXCEPTION_MARKER = MarkerManager.getMarker("EXCEPTION");
056
057    /**
058     * Marker for throwing exceptions.
059     */
060    public static final Marker THROWING_MARKER = MarkerManager.getMarker("THROWING").setParents(EXCEPTION_MARKER);
061
062    /**
063     * Marker for catching exceptions.
064     */
065    public static final Marker CATCHING_MARKER = MarkerManager.getMarker("CATCHING").setParents(EXCEPTION_MARKER);
066
067    /**
068     * The default MessageFactory class.
069     */
070    public static final Class<? extends MessageFactory> DEFAULT_MESSAGE_FACTORY_CLASS = ParameterizedMessageFactory.class;
071
072    private static final String FQCN = AbstractLogger.class.getName();
073
074    private static final String THROWING = "throwing";
075
076    private static final String CATCHING = "catching";
077
078    /**
079     * Checks that the message factory a logger was created with is the same as the given messageFactory. If they are
080     * different log a warning to the {@linkplain StatusLogger}. A null MessageFactory translates to the default
081     * MessageFactory {@link #DEFAULT_MESSAGE_FACTORY_CLASS}.
082     *
083     * @param logger The logger to check
084     * @param messageFactory The message factory to check.
085     */
086    public static void checkMessageFactory(final ExtendedLogger logger, final MessageFactory messageFactory) {
087        final String name = logger.getName();
088        final MessageFactory loggerMessageFactory = logger.getMessageFactory();
089        if (messageFactory != null && !loggerMessageFactory.equals(messageFactory)) {
090            StatusLogger.getLogger().warn(
091                    "The Logger {} was created with the message factory {} and is now requested with the "
092                            + "message factory {}, which may create log events with unexpected formatting.", name,
093                    loggerMessageFactory, messageFactory);
094        } else if (messageFactory == null && !loggerMessageFactory.getClass().equals(DEFAULT_MESSAGE_FACTORY_CLASS)) {
095            StatusLogger
096                    .getLogger()
097                    .warn("The Logger {} was created with the message factory {} and is now requested with a null "
098                            + "message factory (defaults to {}), which may create log events with unexpected formatting.",
099                            name, loggerMessageFactory, DEFAULT_MESSAGE_FACTORY_CLASS.getName());
100        }
101    }
102
103    private final String name;
104
105    private final MessageFactory messageFactory;
106
107    /**
108     * Creates a new logger named after the class (or subclass).
109     */
110    public AbstractLogger() {
111        this.name = getClass().getName();
112        this.messageFactory = createDefaultMessageFactory();
113    }
114
115    /**
116     * Creates a new named logger.
117     *
118     * @param name the logger name
119     */
120    public AbstractLogger(final String name) {
121        this.name = name;
122        this.messageFactory = createDefaultMessageFactory();
123    }
124
125    /**
126     * Creates a new named logger.
127     *
128     * @param name the logger name
129     * @param messageFactory the message factory, if null then use the default message factory.
130     */
131    public AbstractLogger(final String name, final MessageFactory messageFactory) {
132        this.name = name;
133        this.messageFactory = messageFactory == null ? createDefaultMessageFactory() : messageFactory;
134    }
135
136    /**
137     * Logs a Throwable that has been caught.
138     *
139     * @param level The logging Level.
140     * @param t The Throwable.
141     */
142    @Override
143    public void catching(final Level level, final Throwable t) {
144        catching(FQCN, level, t);
145    }
146
147    /**
148     * Logs a Throwable that has been caught with location information.
149     *
150     * @param fqcn The fully qualified class name of the <b>caller</b>.
151     * @param level The logging level.
152     * @param t The Throwable.
153     */
154    protected void catching(final String fqcn, final Level level, final Throwable t) {
155        if (isEnabled(level, CATCHING_MARKER, (Object) null, null)) {
156            logMessage(fqcn, level, CATCHING_MARKER, catchingMsg(t), t);
157        }
158    }
159
160    /**
161     * Logs a Throwable at the {@link Level#ERROR ERROR} level..
162     *
163     * @param t The Throwable.
164     */
165    @Override
166    public void catching(final Throwable t) {
167        if (isEnabled(Level.ERROR, CATCHING_MARKER, (Object) null, null)) {
168            logMessage(FQCN, Level.ERROR, CATCHING_MARKER, catchingMsg(t), t);
169        }
170    }
171
172    protected Message catchingMsg(final Throwable t) {
173        return messageFactory.newMessage(CATCHING);
174    }
175
176    private MessageFactory createDefaultMessageFactory() {
177        try {
178            return DEFAULT_MESSAGE_FACTORY_CLASS.newInstance();
179        } catch (final InstantiationException e) {
180            throw new IllegalStateException(e);
181        } catch (final IllegalAccessException e) {
182            throw new IllegalStateException(e);
183        }
184    }
185
186    /**
187     * Logs a message with the specific Marker at the DEBUG level.
188     *
189     * @param marker the marker data specific to this log statement
190     * @param msg the message string to be logged
191     */
192    @Override
193    public void debug(final Marker marker, final Message msg) {
194        logIfEnabled(FQCN, Level.DEBUG, marker, msg, null);
195    }
196
197    /**
198     * Logs a message with the specific Marker at the DEBUG level.
199     *
200     * @param marker the marker data specific to this log statement.
201     * @param msg the message string to be logged
202     * @param t A Throwable or null.
203     */
204    @Override
205    public void debug(final Marker marker, final Message msg, final Throwable t) {
206        logIfEnabled(FQCN, Level.DEBUG, marker, msg, t);
207    }
208
209    /**
210     * Logs a message object with the {@link Level#DEBUG DEBUG} level.
211     *
212     * @param marker the marker data specific to this log statement.
213     * @param message the message object to log.
214     */
215    @Override
216    public void debug(final Marker marker, final Object message) {
217        logIfEnabled(FQCN, Level.DEBUG, marker, message, null);
218    }
219
220    /**
221     * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable}
222     * <code>t</code> passed as parameter.
223     *
224     * @param marker the marker data specific to this log statement.
225     * @param message the message to log.
226     * @param t the exception to log, including its stack trace.
227     */
228    @Override
229    public void debug(final Marker marker, final Object message, final Throwable t) {
230        logIfEnabled(FQCN, Level.DEBUG, marker, message, t);
231    }
232
233    /**
234     * Logs a message object with the {@link Level#DEBUG DEBUG} level.
235     *
236     * @param marker the marker data specific to this log statement.
237     * @param message the message object to log.
238     */
239    @Override
240    public void debug(final Marker marker, final String message) {
241        logIfEnabled(FQCN, Level.DEBUG, marker, message, (Throwable) null);
242    }
243
244    /**
245     * Logs a message with parameters at the {@link Level#DEBUG DEBUG} level.
246     *
247     * @param marker the marker data specific to this log statement.
248     * @param message the message to log.
249     * @param params parameters to the message.
250     */
251    @Override
252    public void debug(final Marker marker, final String message, final Object... params) {
253        logIfEnabled(FQCN, Level.DEBUG, marker, message, params);
254    }
255
256    /**
257     * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable}
258     * <code>t</code> passed as parameter.
259     *
260     * @param marker the marker data specific to this log statement.
261     * @param message the message to log.
262     * @param t the exception to log, including its stack trace.
263     */
264    @Override
265    public void debug(final Marker marker, final String message, final Throwable t) {
266        logIfEnabled(FQCN, Level.DEBUG, marker, message, t);
267    }
268
269    /**
270     * Logs the specified Message at the DEBUG level.
271     *
272     * @param msg the message to be logged
273     */
274    @Override
275    public void debug(final Message msg) {
276        logIfEnabled(FQCN, Level.DEBUG, null, msg, null);
277    }
278
279    /**
280     * Logs the specified Message at the DEBUG level.
281     *
282     * @param msg the message to be logged
283     * @param t A Throwable or null.
284     */
285    @Override
286    public void debug(final Message msg, final Throwable t) {
287        logIfEnabled(FQCN, Level.DEBUG, null, msg, t);
288    }
289
290    /**
291     * Logs a message object with the {@link Level#DEBUG DEBUG} level.
292     *
293     * @param message the message object to log.
294     */
295    @Override
296    public void debug(final Object message) {
297        logIfEnabled(FQCN, Level.DEBUG, null, message, null);
298    }
299
300    /**
301     * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable}
302     * <code>t</code> passed as parameter.
303     *
304     * @param message the message to log.
305     * @param t the exception to log, including its stack trace.
306     */
307    @Override
308    public void debug(final Object message, final Throwable t) {
309        logIfEnabled(FQCN, Level.DEBUG, null, message, t);
310    }
311
312    /**
313     * Logs a message object with the {@link Level#DEBUG DEBUG} level.
314     *
315     * @param message the message object to log.
316     */
317    @Override
318    public void debug(final String message) {
319        logIfEnabled(FQCN, Level.DEBUG, null, message, (Throwable) null);
320    }
321
322    /**
323     * Logs a message with parameters at the {@link Level#DEBUG DEBUG} level.
324     *
325     * @param message the message to log.
326     * @param params parameters to the message.
327     */
328    @Override
329    public void debug(final String message, final Object... params) {
330        logIfEnabled(FQCN, Level.DEBUG, null, message, params);
331    }
332
333    /**
334     * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable}
335     * <code>t</code> passed as parameter.
336     *
337     * @param message the message to log.
338     * @param t the exception to log, including its stack trace.
339     */
340    @Override
341    public void debug(final String message, final Throwable t) {
342        logIfEnabled(FQCN, Level.DEBUG, null, message, t);
343    }
344
345    /**
346     * Logs entry to a method.
347     */
348    @Override
349    public void entry() {
350        entry(FQCN);
351    }
352
353    /**
354     * Logs entry to a method.
355     *
356     * @param params The parameters to the method.
357     */
358    @Override
359    public void entry(final Object... params) {
360        entry(FQCN, params);
361    }
362
363    /**
364     * Logs entry to a method with location information.
365     *
366     * @param fqcn The fully qualified class name of the <b>caller</b>.
367     * @param params The parameters to the method.
368     */
369    protected void entry(final String fqcn, final Object... params) {
370        if (isEnabled(Level.TRACE, ENTRY_MARKER, (Object) null, null)) {
371            logIfEnabled(fqcn, Level.TRACE, ENTRY_MARKER, entryMsg(params.length, params), null);
372        }
373    }
374
375    protected Message entryMsg(final int count, final Object... params) {
376        if (count == 0) {
377            return messageFactory.newMessage("entry");
378        }
379        final StringBuilder sb = new StringBuilder("entry params(");
380        int i = 0;
381        for (final Object parm : params) {
382            if (parm != null) {
383                sb.append(parm.toString());
384            } else {
385                sb.append("null");
386            }
387            if (++i < params.length) {
388                sb.append(", ");
389            }
390        }
391        sb.append(')');
392        return messageFactory.newMessage(sb.toString());
393    }
394
395    /**
396     * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level.
397     *
398     * @param marker the marker data specific to this log statement
399     * @param msg the message string to be logged
400     */
401    @Override
402    public void error(final Marker marker, final Message msg) {
403        logIfEnabled(FQCN, Level.ERROR, marker, msg, null);
404    }
405
406    /**
407     * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level.
408     *
409     * @param marker the marker data specific to this log statement
410     * @param msg the message string to be logged
411     * @param t A Throwable or null.
412     */
413    @Override
414    public void error(final Marker marker, final Message msg, final Throwable t) {
415        logIfEnabled(FQCN, Level.ERROR, marker, msg, t);
416    }
417
418    /**
419     * Logs a message object with the {@link Level#ERROR ERROR} level.
420     *
421     * @param marker the marker data specific to this log statement.
422     * @param message the message object to log.
423     */
424    @Override
425    public void error(final Marker marker, final Object message) {
426        logIfEnabled(FQCN, Level.ERROR, marker, message, null);
427    }
428
429    /**
430     * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable}
431     * <code>t</code> passed as parameter.
432     *
433     * @param marker the marker data specific to this log statement.
434     * @param message the message object to log.
435     * @param t the exception to log, including its stack trace.
436     */
437    @Override
438    public void error(final Marker marker, final Object message, final Throwable t) {
439        logIfEnabled(FQCN, Level.ERROR, marker, message, t);
440    }
441
442    /**
443     * Logs a message object with the {@link Level#ERROR ERROR} level.
444     *
445     * @param marker the marker data specific to this log statement.
446     * @param message the message object to log.
447     */
448    @Override
449    public void error(final Marker marker, final String message) {
450        logIfEnabled(FQCN, Level.ERROR, marker, message, (Throwable) null);
451    }
452
453    /**
454     * Logs a message with parameters at the {@link Level#ERROR ERROR} level.
455     *
456     * @param marker the marker data specific to this log statement.
457     * @param message the message to log.
458     * @param params parameters to the message.
459     */
460    @Override
461    public void error(final Marker marker, final String message, final Object... params) {
462        logIfEnabled(FQCN, Level.ERROR, marker, message, params);
463    }
464
465    /**
466     * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable}
467     * <code>t</code> passed as parameter.
468     *
469     * @param marker the marker data specific to this log statement.
470     * @param message the message object to log.
471     * @param t the exception to log, including its stack trace.
472     */
473    @Override
474    public void error(final Marker marker, final String message, final Throwable t) {
475        logIfEnabled(FQCN, Level.ERROR, marker, message, t);
476    }
477
478    /**
479     * Logs the specified Message at the {@link Level#ERROR ERROR} level.
480     *
481     * @param msg the message to be logged
482     */
483    @Override
484    public void error(final Message msg) {
485        logIfEnabled(FQCN, Level.ERROR, null, msg, null);
486    }
487
488    /**
489     * Logs the specified Message at the {@link Level#ERROR ERROR} level.
490     *
491     * @param msg the message to be logged
492     * @param t A Throwable or null.
493     */
494    @Override
495    public void error(final Message msg, final Throwable t) {
496        logIfEnabled(FQCN, Level.ERROR, null, msg, t);
497    }
498
499    /**
500     * Logs a message object with the {@link Level#ERROR ERROR} level.
501     *
502     * @param message the message object to log.
503     */
504    @Override
505    public void error(final Object message) {
506        logIfEnabled(FQCN, Level.ERROR, null, message, null);
507    }
508
509    /**
510     * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable}
511     * <code>t</code> passed as parameter.
512     *
513     * @param message the message object to log.
514     * @param t the exception to log, including its stack trace.
515     */
516    @Override
517    public void error(final Object message, final Throwable t) {
518        logIfEnabled(FQCN, Level.ERROR, null, message, t);
519    }
520
521    /**
522     * Logs a message object with the {@link Level#ERROR ERROR} level.
523     *
524     * @param message the message object to log.
525     */
526    @Override
527    public void error(final String message) {
528        logIfEnabled(FQCN, Level.ERROR, null, message, (Throwable) null);
529    }
530
531    /**
532     * Logs a message with parameters at the {@link Level#ERROR ERROR} level.
533     *
534     * @param message the message to log.
535     * @param params parameters to the message.
536     */
537    @Override
538    public void error(final String message, final Object... params) {
539        logIfEnabled(FQCN, Level.ERROR, null, message, params);
540    }
541
542    /**
543     * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable}
544     * <code>t</code> passed as parameter.
545     *
546     * @param message the message object to log.
547     * @param t the exception to log, including its stack trace.
548     */
549    @Override
550    public void error(final String message, final Throwable t) {
551        logIfEnabled(FQCN, Level.ERROR, null, message, t);
552    }
553
554    /**
555     * Logs exit from a method.
556     */
557    @Override
558    public void exit() {
559        exit(FQCN, null);
560    }
561
562    /**
563     * Logs exiting from a method with the result.
564     *
565     * @param <R> The type of the parameter and object being returned.
566     * @param result The result being returned from the method call.
567     * @return the Throwable.
568     */
569    @Override
570    public <R> R exit(final R result) {
571        return exit(FQCN, result);
572    }
573
574    /**
575     * Logs exiting from a method with the result and location information.
576     *
577     * @param fqcn The fully qualified class name of the <b>caller</b>.
578     * @param <R> The type of the parameter and object being returned.
579     * @param result The result being returned from the method call.
580     */
581    protected <R> R exit(final String fqcn, final R result) {
582        if (isEnabled(Level.TRACE, EXIT_MARKER, (Object) null, null)) {
583            logIfEnabled(fqcn, Level.TRACE, EXIT_MARKER, exitMsg(result), null);
584        }
585        return result;
586    }
587
588    protected Message exitMsg(final Object result) {
589        if (result == null) {
590            return messageFactory.newMessage("exit");
591        }
592        return messageFactory.newMessage("exit with(" + result + ')');
593    }
594
595    /**
596     * Logs a message with the specific Marker at the FATAL level.
597     *
598     * @param marker the marker data specific to this log statement
599     * @param msg the message string to be logged
600     */
601    @Override
602    public void fatal(final Marker marker, final Message msg) {
603        logIfEnabled(FQCN, Level.FATAL, marker, msg, null);
604    }
605
606    /**
607     * Logs a message with the specific Marker at the FATAL level.
608     *
609     * @param marker the marker data specific to this log statement
610     * @param msg the message string to be logged
611     * @param t A Throwable or null.
612     */
613    @Override
614    public void fatal(final Marker marker, final Message msg, final Throwable t) {
615        logIfEnabled(FQCN, Level.FATAL, marker, msg, t);
616    }
617
618    /**
619     * Logs a message object with the {@link Level#FATAL FATAL} level.
620     *
621     * @param marker the marker data specific to this log statement.
622     * @param message the message object to log.
623     */
624    @Override
625    public void fatal(final Marker marker, final Object message) {
626        logIfEnabled(FQCN, Level.FATAL, marker, message, null);
627    }
628
629    /**
630     * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable}
631     * <code>t</code> passed as parameter.
632     *
633     * @param marker the marker data specific to this log statement.
634     * @param message the message object to log.
635     * @param t the exception to log, including its stack trace.
636     */
637    @Override
638    public void fatal(final Marker marker, final Object message, final Throwable t) {
639        logIfEnabled(FQCN, Level.FATAL, marker, message, t);
640    }
641
642    /**
643     * Logs a message object with the {@link Level#FATAL FATAL} level.
644     *
645     * @param marker the marker data specific to this log statement.
646     * @param message the message object to log.
647     */
648    @Override
649    public void fatal(final Marker marker, final String message) {
650        logIfEnabled(FQCN, Level.FATAL, marker, message, (Throwable) null);
651    }
652
653    /**
654     * Logs a message with parameters at the {@link Level#FATAL FATAL} level.
655     *
656     * @param marker the marker data specific to this log statement.
657     * @param message the message to log.
658     * @param params parameters to the message.
659     */
660    @Override
661    public void fatal(final Marker marker, final String message, final Object... params) {
662        logIfEnabled(FQCN, Level.FATAL, marker, message, params);
663    }
664
665    /**
666     * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable}
667     * <code>t</code> passed as parameter.
668     *
669     * @param marker the marker data specific to this log statement.
670     * @param message the message object to log.
671     * @param t the exception to log, including its stack trace.
672     */
673    @Override
674    public void fatal(final Marker marker, final String message, final Throwable t) {
675        logIfEnabled(FQCN, Level.FATAL, marker, message, t);
676    }
677
678    /**
679     * Logs the specified Message at the FATAL level.
680     *
681     * @param msg the message to be logged
682     */
683    @Override
684    public void fatal(final Message msg) {
685        logIfEnabled(FQCN, Level.FATAL, null, msg, null);
686    }
687
688    /**
689     * Logs the specified Message at the FATAL level.
690     *
691     * @param msg the message to be logged
692     * @param t A Throwable or null.
693     */
694    @Override
695    public void fatal(final Message msg, final Throwable t) {
696        logIfEnabled(FQCN, Level.FATAL, null, msg, t);
697    }
698
699    /**
700     * Logs a message object with the {@link Level#FATAL FATAL} level.
701     *
702     * @param message the message object to log.
703     */
704    @Override
705    public void fatal(final Object message) {
706        logIfEnabled(FQCN, Level.FATAL, null, message, null);
707    }
708
709    /**
710     * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable}
711     * <code>t</code> passed as parameter.
712     *
713     * @param message the message object to log.
714     * @param t the exception to log, including its stack trace.
715     */
716    @Override
717    public void fatal(final Object message, final Throwable t) {
718        logIfEnabled(FQCN, Level.FATAL, null, message, t);
719    }
720
721    /**
722     * Logs a message object with the {@link Level#FATAL FATAL} level.
723     *
724     * @param message the message object to log.
725     */
726    @Override
727    public void fatal(final String message) {
728        logIfEnabled(FQCN, Level.FATAL, null, message, (Throwable) null);
729    }
730
731    /**
732     * Logs a message with parameters at the {@link Level#FATAL FATAL} level.
733     *
734     * @param message the message to log.
735     * @param params parameters to the message.
736     */
737    @Override
738    public void fatal(final String message, final Object... params) {
739        logIfEnabled(FQCN, Level.FATAL, null, message, params);
740    }
741
742    /**
743     * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable}
744     * <code>t</code> passed as parameter.
745     *
746     * @param message the message object to log.
747     * @param t the exception to log, including its stack trace.
748     */
749    @Override
750    public void fatal(final String message, final Throwable t) {
751        logIfEnabled(FQCN, Level.FATAL, null, message, t);
752    }
753
754    /**
755     * Gets the message factory.
756     *
757     * @return the message factory.
758     */
759    @Override
760    public MessageFactory getMessageFactory() {
761        return messageFactory;
762    }
763
764    /*
765     * (non-Javadoc)
766     *
767     * @see org.apache.logging.log4j.Logger#getName()
768     */
769    @Override
770    public String getName() {
771        return name;
772    }
773
774    /**
775     * Logs a message with the specific Marker at the INFO level.
776     *
777     * @param marker the marker data specific to this log statement
778     * @param msg the message string to be logged
779     */
780    @Override
781    public void info(final Marker marker, final Message msg) {
782        logIfEnabled(FQCN, Level.INFO, marker, msg, null);
783    }
784
785    /**
786     * Logs a message with the specific Marker at the INFO level.
787     *
788     * @param marker the marker data specific to this log statement
789     * @param msg the message string to be logged
790     * @param t A Throwable or null.
791     */
792    @Override
793    public void info(final Marker marker, final Message msg, final Throwable t) {
794        logIfEnabled(FQCN, Level.INFO, marker, msg, t);
795    }
796
797    /**
798     * Logs a message object with the {@link Level#INFO INFO} level.
799     *
800     * @param marker the marker data specific to this log statement.
801     * @param message the message object to log.
802     */
803    @Override
804    public void info(final Marker marker, final Object message) {
805        logIfEnabled(FQCN, Level.INFO, marker, message, null);
806    }
807
808    /**
809     * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable}
810     * <code>t</code> passed as parameter.
811     *
812     * @param marker the marker data specific to this log statement.
813     * @param message the message object to log.
814     * @param t the exception to log, including its stack trace.
815     */
816    @Override
817    public void info(final Marker marker, final Object message, final Throwable t) {
818        logIfEnabled(FQCN, Level.INFO, marker, message, t);
819    }
820
821    /**
822     * Logs a message object with the {@link Level#INFO INFO} level.
823     *
824     * @param marker the marker data specific to this log statement.
825     * @param message the message object to log.
826     */
827    @Override
828    public void info(final Marker marker, final String message) {
829        logIfEnabled(FQCN, Level.INFO, marker, message, (Throwable) null);
830    }
831
832    /**
833     * Logs a message with parameters at the {@link Level#INFO INFO} level.
834     *
835     * @param marker the marker data specific to this log statement.
836     * @param message the message to log.
837     * @param params parameters to the message.
838     */
839    @Override
840    public void info(final Marker marker, final String message, final Object... params) {
841        logIfEnabled(FQCN, Level.INFO, marker, message, params);
842    }
843
844    /**
845     * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable}
846     * <code>t</code> passed as parameter.
847     *
848     * @param marker the marker data specific to this log statement.
849     * @param message the message object to log.
850     * @param t the exception to log, including its stack trace.
851     */
852    @Override
853    public void info(final Marker marker, final String message, final Throwable t) {
854        logIfEnabled(FQCN, Level.INFO, marker, message, t);
855    }
856
857    /**
858     * Logs the specified Message at the INFO level.
859     *
860     * @param msg the message to be logged
861     */
862    @Override
863    public void info(final Message msg) {
864        logIfEnabled(FQCN, Level.INFO, null, msg, null);
865    }
866
867    /**
868     * Logs the specified Message at the INFO level.
869     *
870     * @param msg the message to be logged
871     * @param t A Throwable or null.
872     */
873    @Override
874    public void info(final Message msg, final Throwable t) {
875        logIfEnabled(FQCN, Level.INFO, null, msg, t);
876    }
877
878    /**
879     * Logs a message object with the {@link Level#INFO INFO} level.
880     *
881     * @param message the message object to log.
882     */
883    @Override
884    public void info(final Object message) {
885        logIfEnabled(FQCN, Level.INFO, null, message, null);
886    }
887
888    /**
889     * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable}
890     * <code>t</code> passed as parameter.
891     *
892     * @param message the message object to log.
893     * @param t the exception to log, including its stack trace.
894     */
895    @Override
896    public void info(final Object message, final Throwable t) {
897        logIfEnabled(FQCN, Level.INFO, null, message, t);
898    }
899
900    /**
901     * Logs a message object with the {@link Level#INFO INFO} level.
902     *
903     * @param message the message object to log.
904     */
905    @Override
906    public void info(final String message) {
907        logIfEnabled(FQCN, Level.INFO, null, message, (Throwable) null);
908    }
909
910    /**
911     * Logs a message with parameters at the {@link Level#INFO INFO} level.
912     *
913     * @param message the message to log.
914     * @param params parameters to the message.
915     */
916    @Override
917    public void info(final String message, final Object... params) {
918        logIfEnabled(FQCN, Level.INFO, null, message, params);
919    }
920
921    /**
922     * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable}
923     * <code>t</code> passed as parameter.
924     *
925     * @param message the message object to log.
926     * @param t the exception to log, including its stack trace.
927     */
928    @Override
929    public void info(final String message, final Throwable t) {
930        logIfEnabled(FQCN, Level.INFO, null, message, t);
931    }
932
933    /**
934     * Checks whether this Logger is enabled for the DEBUG Level.
935     *
936     * @return boolean - {@code true} if this Logger is enabled for level DEBUG, {@code false} otherwise.
937     */
938    @Override
939    public boolean isDebugEnabled() {
940        return isEnabled(Level.DEBUG, null, null);
941    }
942
943    /**
944     * Checks whether this Logger is enabled for the DEBUG Level.
945     *
946     * @param marker The marker data.
947     * @return boolean - {@code true} if this Logger is enabled for level DEBUG, {@code false} otherwise.
948     */
949    @Override
950    public boolean isDebugEnabled(final Marker marker) {
951        return isEnabled(Level.DEBUG, marker, (Object) null, null);
952    }
953
954    /**
955     * Checks whether this Logger is enabled for the the given Level.
956     * <p>
957     * Note that passing in {@link Level#OFF OFF} always returns {@code true}.
958     * </p>
959     *
960     * @param level the level to check
961     * @return boolean - {@code true} if this Logger is enabled for level, {@code false} otherwise.
962     */
963    @Override
964    public boolean isEnabled(final Level level) {
965        return isEnabled(level, null, (Object) null, null);
966    }
967
968    /**
969     * Checks whether this Logger is enabled for the the given Level.
970     * <p>
971     * Note that passing in {@link Level#OFF OFF} always returns {@code true}.
972     * </p>
973     *
974     * @param level the level to check
975     * @param marker A Marker or null.
976     * @return boolean - {@code true} if this Logger is enabled for level, {@code false} otherwise.
977     */
978    @Override
979    public boolean isEnabled(final Level level, final Marker marker) {
980        return isEnabled(level, marker, (Object) null, null);
981    }
982
983    /**
984     * Checks whether this Logger is enabled for the {@link Level#ERROR ERROR} Level.
985     *
986     * @return boolean - {@code true} if this Logger is enabled for level {@link Level#ERROR ERROR}, {@code false}
987     *         otherwise.
988     */
989    @Override
990    public boolean isErrorEnabled() {
991        return isEnabled(Level.ERROR, null, (Object) null, null);
992    }
993
994    /**
995     * Checks whether this Logger is enabled for the {@link Level#ERROR ERROR} Level.
996     *
997     * @param marker The marker data.
998     * @return boolean - {@code true} if this Logger is enabled for level {@link Level#ERROR ERROR}, {@code false}
999     *         otherwise.
1000     */
1001    @Override
1002    public boolean isErrorEnabled(final Marker marker) {
1003        return isEnabled(Level.ERROR, marker, (Object) null, null);
1004    }
1005
1006    /**
1007     * Checks whether this Logger is enabled for the FATAL Level.
1008     *
1009     * @return boolean - {@code true} if this Logger is enabled for level FATAL, {@code false} otherwise.
1010     */
1011    @Override
1012    public boolean isFatalEnabled() {
1013        return isEnabled(Level.FATAL, null, (Object) null, null);
1014    }
1015
1016    /**
1017     * Checks whether this Logger is enabled for the FATAL Level.
1018     *
1019     * @param marker The marker data.
1020     * @return boolean - {@code true} if this Logger is enabled for level FATAL, {@code false} otherwise.
1021     */
1022    @Override
1023    public boolean isFatalEnabled(final Marker marker) {
1024        return isEnabled(Level.FATAL, marker, (Object) null, null);
1025    }
1026
1027    /**
1028     * Checks whether this Logger is enabled for the INFO Level.
1029     *
1030     * @return boolean - {@code true} if this Logger is enabled for level INFO, {@code false} otherwise.
1031     */
1032    @Override
1033    public boolean isInfoEnabled() {
1034        return isEnabled(Level.INFO, null, (Object) null, null);
1035    }
1036
1037    /**
1038     * Checks whether this Logger is enabled for the INFO Level.
1039     *
1040     * @param marker The marker data.
1041     * @return boolean - {@code true} if this Logger is enabled for level INFO, {@code false} otherwise.
1042     */
1043    @Override
1044    public boolean isInfoEnabled(final Marker marker) {
1045        return isEnabled(Level.INFO, marker, (Object) null, null);
1046    }
1047
1048    /**
1049     * Checks whether this Logger is enabled for the TRACE Level.
1050     *
1051     * @return boolean - {@code true} if this Logger is enabled for level TRACE, {@code false} otherwise.
1052     */
1053    @Override
1054    public boolean isTraceEnabled() {
1055        return isEnabled(Level.TRACE, null, (Object) null, null);
1056    }
1057
1058    /**
1059     * Checks whether this Logger is enabled for the TRACE Level.
1060     *
1061     * @param marker The marker data.
1062     * @return boolean - {@code true} if this Logger is enabled for level TRACE, {@code false} otherwise.
1063     */
1064    @Override
1065    public boolean isTraceEnabled(final Marker marker) {
1066        return isEnabled(Level.TRACE, marker, (Object) null, null);
1067    }
1068
1069    /**
1070     * Checks whether this Logger is enabled for the WARN Level.
1071     *
1072     * @return boolean - {@code true} if this Logger is enabled for level WARN, {@code false} otherwise.
1073     */
1074    @Override
1075    public boolean isWarnEnabled() {
1076        return isEnabled(Level.WARN, null, (Object) null, null);
1077    }
1078
1079    /**
1080     * Checks whether this Logger is enabled for the WARN Level.
1081     *
1082     * @param marker The marker data.
1083     * @return boolean - {@code true} if this Logger is enabled for level WARN, {@code false} otherwise.
1084     */
1085    @Override
1086    public boolean isWarnEnabled(final Marker marker) {
1087        return isEnabled(Level.WARN, marker, (Object) null, null);
1088    }
1089
1090    /**
1091     * Logs a message with the specific Marker at the given level.
1092     *
1093     * @param level the logging level
1094     * @param marker the marker data specific to this log statement
1095     * @param msg the message string to be logged
1096     */
1097    @Override
1098    public void log(final Level level, final Marker marker, final Message msg) {
1099        logIfEnabled(FQCN, level, marker, msg, (Throwable) null);
1100    }
1101
1102    /**
1103     * Logs a message with the specific Marker at the given level.
1104     *
1105     * @param level the logging level
1106     * @param marker the marker data specific to this log statement.
1107     * @param msg the message string to be logged
1108     * @param t A Throwable or null.
1109     */
1110    @Override
1111    public void log(final Level level, final Marker marker, final Message msg, final Throwable t) {
1112        logIfEnabled(FQCN, level, marker, msg, t);
1113    }
1114
1115    /**
1116     * Logs a message object with the given level.
1117     *
1118     * @param level the logging level
1119     * @param marker the marker data specific to this log statement.
1120     * @param message the message object to log.
1121     */
1122    @Override
1123    public void log(final Level level, final Marker marker, final Object message) {
1124        logIfEnabled(FQCN, level, marker, message, (Throwable) null);
1125    }
1126
1127    /**
1128     * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as
1129     * parameter.
1130     *
1131     * @param level the logging level
1132     * @param marker the marker data specific to this log statement.
1133     * @param message the message to log.
1134     * @param t the exception to log, including its stack trace.
1135     */
1136    @Override
1137    public void log(final Level level, final Marker marker, final Object message, final Throwable t) {
1138        if (isEnabled(level, marker, message, t)) {
1139            logMessage(FQCN, level, marker, message, t);
1140        }
1141    }
1142
1143    /**
1144     * Logs a message object with the given level.
1145     *
1146     * @param level the logging level
1147     * @param marker the marker data specific to this log statement.
1148     * @param message the message object to log.
1149     */
1150    @Override
1151    public void log(final Level level, final Marker marker, final String message) {
1152        logIfEnabled(FQCN, level, marker, message, (Throwable) null);
1153    }
1154
1155    /**
1156     * Logs a message with parameters at the given level.
1157     *
1158     * @param level the logging level
1159     * @param marker the marker data specific to this log statement.
1160     * @param message the message to log.
1161     * @param params parameters to the message.
1162     */
1163    @Override
1164    public void log(final Level level, final Marker marker, final String message, final Object... params) {
1165        logIfEnabled(FQCN, level, marker, message, params);
1166    }
1167
1168    /**
1169     * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as
1170     * parameter.
1171     *
1172     * @param level the logging level
1173     * @param marker the marker data specific to this log statement.
1174     * @param message the message to log.
1175     * @param t the exception to log, including its stack trace.
1176     */
1177    @Override
1178    public void log(final Level level, final Marker marker, final String message, final Throwable t) {
1179        logIfEnabled(FQCN, level, marker, message, t);
1180    }
1181
1182    /**
1183     * Logs the specified Message at the given level.
1184     *
1185     * @param level the logging level
1186     * @param msg the message to be logged
1187     */
1188    @Override
1189    public void log(final Level level, final Message msg) {
1190        logIfEnabled(FQCN, level, null, msg, null);
1191    }
1192
1193    /**
1194     * Logs the specified Message at the given level.
1195     *
1196     * @param level the logging level
1197     * @param msg the message to be logged
1198     * @param t A Throwable or null.
1199     */
1200    @Override
1201    public void log(final Level level, final Message msg, final Throwable t) {
1202        logIfEnabled(FQCN, level, null, msg, t);
1203    }
1204
1205    /**
1206     * Logs a message object with the given level.
1207     *
1208     * @param level the logging level
1209     * @param message the message object to log.
1210     */
1211    @Override
1212    public void log(final Level level, final Object message) {
1213        logIfEnabled(FQCN, level, null, message, null);
1214    }
1215
1216    /**
1217     * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as
1218     * parameter.
1219     *
1220     * @param level the logging level
1221     * @param message the message to log.
1222     * @param t the exception to log, including its stack trace.
1223     */
1224    @Override
1225    public void log(final Level level, final Object message, final Throwable t) {
1226        logIfEnabled(FQCN, level, null, message, t);
1227    }
1228
1229    /**
1230     * Logs a message object with the given level.
1231     *
1232     * @param level the logging level
1233     * @param message the message object to log.
1234     */
1235    @Override
1236    public void log(final Level level, final String message) {
1237        logIfEnabled(FQCN, level, null, message, (Throwable) null);
1238    }
1239
1240    /**
1241     * Logs a message with parameters at the given level.
1242     *
1243     * @param level the logging level
1244     * @param message the message to log.
1245     * @param params parameters to the message.
1246     */
1247    @Override
1248    public void log(final Level level, final String message, final Object... params) {
1249        logIfEnabled(FQCN, level, null, message, params);
1250    }
1251
1252    /**
1253     * Logs a message at the given level including the stack trace of the {@link Throwable}
1254     * <code>t</code> passed as parameter.
1255     *
1256     * @param level the logging level
1257     * @param message the message to log.
1258     * @param t the exception to log, including its stack trace.
1259     */
1260    @Override
1261    public void log(final Level level, final String message, final Throwable t) {
1262        logIfEnabled(FQCN, level, null, message, t);
1263    }
1264
1265    /*
1266     * (non-Javadoc)
1267     * @see org.apache.logging.log4j.spi.ExtendedLogger#logIfEnabled(java.lang.String, org.apache.logging.log4j.Level,
1268     * org.apache.logging.log4j.Marker, org.apache.logging.log4j.message.Message, java.lang.Throwable)
1269     */
1270    @Override
1271    public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final Message msg,
1272            final Throwable t) {
1273        if (isEnabled(level, marker, msg, t)) {
1274            logMessage(fqcn, level, marker, msg, t);
1275        }
1276    }
1277
1278    /*
1279     * (non-Javadoc)
1280     * @see org.apache.logging.log4j.spi.ExtendedLogger#logIfEnabled(java.lang.String, org.apache.logging.log4j.Level,
1281     * org.apache.logging.log4j.Marker, java.lang.Object, java.lang.Throwable)
1282     */
1283    @Override
1284    public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final Object message,
1285            final Throwable t) {
1286        if (isEnabled(level, marker, message, t)) {
1287            logMessage(fqcn, level, marker, message, t);
1288        }
1289    }
1290
1291    /*
1292     * (non-Javadoc)
1293     * @see org.apache.logging.log4j.spi.ExtendedLogger#logIfEnabled(java.lang.String, org.apache.logging.log4j.Level,
1294     * org.apache.logging.log4j.Marker, java.lang.String)
1295     */
1296    @Override
1297    public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final String message) {
1298        if (isEnabled(level, marker, message)) {
1299            logMessage(fqcn, level, marker, message);
1300        }
1301    }
1302
1303    /*
1304     * (non-Javadoc)
1305     * @see org.apache.logging.log4j.spi.ExtendedLogger#logIfEnabled(java.lang.String, org.apache.logging.log4j.Level,
1306     * org.apache.logging.log4j.Marker, java.lang.String, java.lang.Object[])
1307     */
1308    @Override
1309    public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final String message,
1310            final Object... params) {
1311        if (isEnabled(level, marker, message, params)) {
1312            logMessage(fqcn, level, marker, message, params);
1313        }
1314    }
1315
1316    /*
1317     * (non-Javadoc)
1318     * @see org.apache.logging.log4j.spi.ExtendedLogger#logIfEnabled(java.lang.String, org.apache.logging.log4j.Level,
1319     * org.apache.logging.log4j.Marker, java.lang.String, java.lang.Throwable)
1320     */
1321    @Override
1322    public void logIfEnabled(final String fqcn, final Level level, final Marker marker, final String message,
1323            final Throwable t) {
1324        if (isEnabled(level, marker, message, t)) {
1325            logMessage(fqcn, level, marker, message, t);
1326        }
1327    }
1328
1329    protected void logMessage(final String fqcn, final Level level, final Marker marker, final Object message,
1330            final Throwable t) {
1331        logMessage(fqcn, level, marker, messageFactory.newMessage(message), t);
1332    }
1333
1334    protected void logMessage(final String fqcn, final Level level, final Marker marker, final String message,
1335            final Throwable t) {
1336        logMessage(fqcn, level, marker, messageFactory.newMessage(message), t);
1337    }
1338
1339    protected void logMessage(final String fqcn, final Level level, final Marker marker, final String message) {
1340        final Message msg = messageFactory.newMessage(message);
1341        logMessage(fqcn, level, marker, msg, msg.getThrowable());
1342    }
1343
1344    protected void logMessage(final String fqcn, final Level level, final Marker marker, final String message,
1345            final Object... params) {
1346        final Message msg = messageFactory.newMessage(message, params);
1347        logMessage(fqcn, level, marker, msg, msg.getThrowable());
1348    }
1349
1350    /**
1351     * Logs a formatted message using the specified format string and arguments.
1352     *
1353     * @param level The logging Level.
1354     * @param marker the marker data specific to this log statement.
1355     * @param format The format String.
1356     * @param params Arguments specified by the format.
1357     */
1358    @Override
1359    public void printf(final Level level, final Marker marker, final String format, final Object... params) {
1360        if (isEnabled(level, marker, format, params)) {
1361            final Message msg = new StringFormattedMessage(format, params);
1362            logMessage(FQCN, level, marker, msg, msg.getThrowable());
1363        }
1364    }
1365
1366    /**
1367     * Logs a formatted message using the specified format string and arguments.
1368     *
1369     * @param level The logging Level.
1370     * @param format The format String.
1371     * @param params Arguments specified by the format.
1372     */
1373    @Override
1374    public void printf(final Level level, final String format, final Object... params) {
1375        if (isEnabled(level, null, format, params)) {
1376            final Message msg = new StringFormattedMessage(format, params);
1377            logMessage(FQCN, level, null, msg, msg.getThrowable());
1378        }
1379    }
1380
1381    /**
1382     * Logs a Throwable to be thrown.
1383     *
1384     * @param <T> the type of the Throwable.
1385     * @param t The Throwable.
1386     * @return the Throwable.
1387     */
1388    @Override
1389    public <T extends Throwable> T throwing(final T t) {
1390        return throwing(FQCN, Level.ERROR, t);
1391    }
1392
1393    /**
1394     * Logs a Throwable to be thrown.
1395     *
1396     * @param <T> the type of the Throwable.
1397     * @param level The logging Level.
1398     * @param t The Throwable.
1399     * @return the Throwable.
1400     */
1401    @Override
1402    public <T extends Throwable> T throwing(final Level level, final T t) {
1403        return throwing(FQCN, level, t);
1404    }
1405
1406    /**
1407     * Logs a Throwable to be thrown.
1408     *
1409     * @param <T> the type of the Throwable.
1410     * @param level The logging Level.
1411     * @param t The Throwable.
1412     * @return the Throwable.
1413     */
1414    protected <T extends Throwable> T throwing(final String fqcn, final Level level, final T t) {
1415        if (isEnabled(level, THROWING_MARKER, (Object) null, null)) {
1416            logMessage(fqcn, level, THROWING_MARKER, throwingMsg(t), t);
1417        }
1418        return t;
1419    }
1420
1421    protected Message throwingMsg(final Throwable t) {
1422        return messageFactory.newMessage(THROWING);
1423    }
1424
1425    /**
1426     * Logs a message with the specific Marker at the TRACE level.
1427     *
1428     * @param marker the marker data specific to this log statement.
1429     * @param msg the message string to be logged
1430     */
1431    @Override
1432    public void trace(final Marker marker, final Message msg) {
1433        logIfEnabled(FQCN, Level.TRACE, marker, msg, null);
1434    }
1435
1436    /**
1437     * Logs a message with the specific Marker at the TRACE level.
1438     *
1439     * @param marker the marker data specific to this log statement.
1440     * @param msg the message string to be logged
1441     * @param t A Throwable or null.
1442     */
1443    @Override
1444    public void trace(final Marker marker, final Message msg, final Throwable t) {
1445        logIfEnabled(FQCN, Level.TRACE, marker, msg, t);
1446    }
1447
1448    /**
1449     * Logs a message object with the {@link Level#TRACE TRACE} level.
1450     *
1451     * @param marker the marker data specific to this log statement.
1452     * @param message the message object to log.
1453     */
1454    @Override
1455    public void trace(final Marker marker, final Object message) {
1456        logIfEnabled(FQCN, Level.TRACE, marker, message, null);
1457    }
1458
1459    /**
1460     * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable}
1461     * <code>t</code> passed as parameter.
1462     * <p/>
1463     * <p>
1464     * See {@link #debug(String)} form for more detailed information.
1465     * </p>
1466     *
1467     * @param marker the marker data specific to this log statement.
1468     * @param message the message object to log.
1469     * @param t the exception to log, including its stack trace.
1470     */
1471    @Override
1472    public void trace(final Marker marker, final Object message, final Throwable t) {
1473        logIfEnabled(FQCN, Level.TRACE, marker, message, t);
1474    }
1475
1476    /**
1477     * Logs a message object with the {@link Level#TRACE TRACE} level.
1478     *
1479     * @param marker the marker data specific to this log statement.
1480     * @param message the message object to log.
1481     */
1482    @Override
1483    public void trace(final Marker marker, final String message) {
1484        logIfEnabled(FQCN, Level.TRACE, marker, message, (Throwable) null);
1485    }
1486
1487    /**
1488     * Logs a message with parameters at the {@link Level#TRACE TRACE} level.
1489     *
1490     * @param marker the marker data specific to this log statement.
1491     * @param message the message to log.
1492     * @param params parameters to the message.
1493     */
1494    @Override
1495    public void trace(final Marker marker, final String message, final Object... params) {
1496        logIfEnabled(FQCN, Level.TRACE, marker, message, params);
1497    }
1498
1499    /**
1500     * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable}
1501     * <code>t</code> passed as parameter.
1502     * <p/>
1503     * <p>
1504     * See {@link #debug(String)} form for more detailed information.
1505     * </p>
1506     *
1507     * @param marker the marker data specific to this log statement.
1508     * @param message the message object to log.
1509     * @param t the exception to log, including its stack trace.
1510     */
1511    @Override
1512    public void trace(final Marker marker, final String message, final Throwable t) {
1513        logIfEnabled(FQCN, Level.TRACE, marker, message, t);
1514    }
1515
1516    /**
1517     * Logs the specified Message at the TRACE level.
1518     *
1519     * @param msg the message to be logged
1520     */
1521    @Override
1522    public void trace(final Message msg) {
1523        logIfEnabled(FQCN, Level.TRACE, null, msg, null);
1524    }
1525
1526    /**
1527     * Logs the specified Message at the TRACE level.
1528     *
1529     * @param msg the message to be logged
1530     * @param t A Throwable or null.
1531     */
1532    @Override
1533    public void trace(final Message msg, final Throwable t) {
1534        logIfEnabled(FQCN, Level.TRACE, null, msg, t);
1535    }
1536
1537    /**
1538     * Logs a message object with the {@link Level#TRACE TRACE} level.
1539     *
1540     * @param message the message object to log.
1541     */
1542    @Override
1543    public void trace(final Object message) {
1544        logIfEnabled(FQCN, Level.TRACE, null, message, null);
1545    }
1546
1547    /**
1548     * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable}
1549     * <code>t</code> passed as parameter.
1550     * <p/>
1551     * <p>
1552     * See {@link #debug(String)} form for more detailed information.
1553     * </p>
1554     *
1555     * @param message the message object to log.
1556     * @param t the exception to log, including its stack trace.
1557     */
1558    @Override
1559    public void trace(final Object message, final Throwable t) {
1560        logIfEnabled(FQCN, Level.TRACE, null, message, t);
1561    }
1562
1563    /**
1564     * Logs a message object with the {@link Level#TRACE TRACE} level.
1565     *
1566     * @param message the message object to log.
1567     */
1568    @Override
1569    public void trace(final String message) {
1570        logIfEnabled(FQCN, Level.TRACE, null, message, (Throwable) null);
1571    }
1572
1573    /**
1574     * Logs a message with parameters at the {@link Level#TRACE TRACE} level.
1575     *
1576     * @param message the message to log.
1577     * @param params parameters to the message.
1578     */
1579    @Override
1580    public void trace(final String message, final Object... params) {
1581        logIfEnabled(FQCN, Level.TRACE, null, message, params);
1582    }
1583
1584    /**
1585     * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable}
1586     * <code>t</code> passed as parameter.
1587     * <p/>
1588     * <p>
1589     * See {@link #debug(String)} form for more detailed information.
1590     * </p>
1591     *
1592     * @param message the message object to log.
1593     * @param t the exception to log, including its stack trace.
1594     */
1595    @Override
1596    public void trace(final String message, final Throwable t) {
1597        logIfEnabled(FQCN, Level.TRACE, null, message, t);
1598    }
1599
1600    /**
1601     * Logs a message with the specific Marker at the WARN level.
1602     *
1603     * @param marker the marker data specific to this log statement
1604     * @param msg the message string to be logged
1605     */
1606    @Override
1607    public void warn(final Marker marker, final Message msg) {
1608        logIfEnabled(FQCN, Level.WARN, marker, msg, null);
1609    }
1610
1611    /**
1612     * Logs a message with the specific Marker at the WARN level.
1613     *
1614     * @param marker the marker data specific to this log statement
1615     * @param msg the message string to be logged
1616     * @param t A Throwable or null.
1617     */
1618    @Override
1619    public void warn(final Marker marker, final Message msg, final Throwable t) {
1620        logIfEnabled(FQCN, Level.WARN, marker, msg, t);
1621    }
1622
1623    /**
1624     * Logs a message object with the {@link Level#WARN WARN} level.
1625     *
1626     * @param marker the marker data specific to this log statement.
1627     * @param message the message object to log.
1628     */
1629    @Override
1630    public void warn(final Marker marker, final Object message) {
1631        logIfEnabled(FQCN, Level.WARN, marker, message, null);
1632    }
1633
1634    /*
1635     * Instead of one single method with Object... declared the following methods explicitly specify parameters because
1636     * they perform dramatically better than having the JVM convert them to an array.
1637     */
1638
1639    /**
1640     * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable}
1641     * <code>t</code> passed as parameter.
1642     *
1643     * @param marker the marker data specific to this log statement.
1644     * @param message the message object to log.
1645     * @param t the exception to log, including its stack trace.
1646     */
1647    @Override
1648    public void warn(final Marker marker, final Object message, final Throwable t) {
1649        logIfEnabled(FQCN, Level.WARN, marker, message, t);
1650    }
1651
1652    /**
1653     * Logs a message object with the {@link Level#WARN WARN} level.
1654     *
1655     * @param marker the marker data specific to this log statement.
1656     * @param message the message object to log.
1657     */
1658    @Override
1659    public void warn(final Marker marker, final String message) {
1660        logIfEnabled(FQCN, Level.WARN, marker, message, (Throwable) null);
1661    }
1662
1663    /**
1664     * Logs a message with parameters at the {@link Level#WARN WARN} level.
1665     *
1666     * @param marker the marker data specific to this log statement.
1667     * @param message the message to log.
1668     * @param params parameters to the message.
1669     */
1670    @Override
1671    public void warn(final Marker marker, final String message, final Object... params) {
1672        logIfEnabled(FQCN, Level.WARN, marker, message, params);
1673    }
1674
1675    /**
1676     * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable}
1677     * <code>t</code> passed as parameter.
1678     *
1679     * @param marker the marker data specific to this log statement.
1680     * @param message the message object to log.
1681     * @param t the exception to log, including its stack trace.
1682     */
1683    @Override
1684    public void warn(final Marker marker, final String message, final Throwable t) {
1685        logIfEnabled(FQCN, Level.WARN, marker, message, t);
1686    }
1687
1688    /**
1689     * Logs the specified Message at the WARN level.
1690     *
1691     * @param msg the message to be logged
1692     */
1693    @Override
1694    public void warn(final Message msg) {
1695        logIfEnabled(FQCN, Level.WARN, null, msg, null);
1696    }
1697
1698    /**
1699     * Logs the specified Message at the WARN level.
1700     *
1701     * @param msg the message to be logged
1702     * @param t A Throwable or null.
1703     */
1704    @Override
1705    public void warn(final Message msg, final Throwable t) {
1706        logIfEnabled(FQCN, Level.WARN, null, msg, t);
1707    }
1708
1709    /**
1710     * Logs a message object with the {@link Level#WARN WARN} level.
1711     *
1712     * @param message the message object to log.
1713     */
1714    @Override
1715    public void warn(final Object message) {
1716        logIfEnabled(FQCN, Level.WARN, null, message, null);
1717    }
1718
1719    /**
1720     * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable}
1721     * <code>t</code> passed as parameter.
1722     *
1723     * @param message the message object to log.
1724     * @param t the exception to log, including its stack trace.
1725     */
1726    @Override
1727    public void warn(final Object message, final Throwable t) {
1728        logIfEnabled(FQCN, Level.WARN, null, message, t);
1729    }
1730
1731    /**
1732     * Logs a message object with the {@link Level#WARN WARN} level.
1733     *
1734     * @param message the message object to log.
1735     */
1736    @Override
1737    public void warn(final String message) {
1738        logIfEnabled(FQCN, Level.WARN, null, message, (Throwable) null);
1739    }
1740
1741    /**
1742     * Logs a message with parameters at the {@link Level#WARN WARN} level.
1743     *
1744     * @param message the message to log.
1745     * @param params parameters to the message.
1746     */
1747    @Override
1748    public void warn(final String message, final Object... params) {
1749        logIfEnabled(FQCN, Level.WARN, null, message, params);
1750    }
1751
1752    /**
1753     * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable}
1754     * <code>t</code> passed as parameter.
1755     *
1756     * @param message the message object to log.
1757     * @param t the exception to log, including its stack trace.
1758     */
1759    @Override
1760    public void warn(final String message, final Throwable t) {
1761        logIfEnabled(FQCN, Level.WARN, null, message, t);
1762    }
1763
1764}