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