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;
018    
019    import org.apache.logging.log4j.message.Message;
020    import org.apache.logging.log4j.message.MessageFactory;
021    
022    /**
023     * This is the central interface in the log4j package. Most logging operations, except configuration, are done through
024     * this interface.
025     *
026     * <p>
027     * The canonical way to obtain a Logger for a class is through {@link LogManager#getLogger()}. Typically, each class
028     * gets its own Logger named after its fully qualified class name (the default Logger name when obtained through the
029     * {@link LogManager#getLogger()} method). Thus, the simplest way to use this would be like so:
030     * </p>
031     * <pre>
032     *     public class MyClass {
033     *         private static final Logger LOGGER = LogManager.getLogger();
034     *         // ...
035     *     }
036     * </pre>
037     * <p>
038     * For ease of filtering, searching, sorting, etc., it is generally a good idea to create Loggers for each class rather
039     * than sharing Loggers. Instead, {@link Marker Markers} should be used for shared, filterable identification.
040     * </p>
041     * <p>
042     * For service provider implementations, it is recommended to extend the
043     * {@link org.apache.logging.log4j.spi.AbstractLogger} class rather than implementing this interface directly.
044     * </p>
045     */
046    public interface Logger {
047    
048        /**
049         * Logs an exception or error that has been caught to a specific logging level.
050         *
051         * @param level The logging Level.
052         * @param t The Throwable.
053         */
054        void catching(Level level, Throwable t);
055    
056        /**
057         * Logs an exception or error that has been caught. Normally, one may wish to provide additional information with
058         * an exception while logging it; in these cases, one would not use this method. In other cases where simply
059         * logging the fact that an exception was swallowed somewhere (e.g., at the top of the stack trace in a
060         * {@code main()} method), this method is ideal for it.
061         *
062         * @param t The Throwable.
063         */
064        void catching(Throwable t);
065    
066        /**
067         * Logs a message with the specific Marker at the {@link Level#DEBUG DEBUG} level.
068         *
069         * @param marker the marker data specific to this log statement
070         * @param msg the message string to be logged
071         */
072        void debug(Marker marker, Message msg);
073    
074        /**
075         * Logs a message with the specific Marker at the {@link Level#DEBUG DEBUG} level.
076         *
077         * @param marker the marker data specific to this log statement
078         * @param msg the message string to be logged
079         * @param t A Throwable or null.
080         */
081        void debug(Marker marker, Message msg, Throwable t);
082    
083        /**
084         * Logs a message object with the {@link Level#DEBUG DEBUG} level.
085         *
086         * @param marker the marker data specific to this log statement
087         * @param message the message object to log.
088         */
089        void debug(Marker marker, Object message);
090    
091        /**
092         * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable}
093         * <code>t</code> passed as parameter.
094         *
095         * @param marker the marker data specific to this log statement
096         * @param message the message to log.
097         * @param t the exception to log, including its stack trace.
098         */
099        void debug(Marker marker, Object message, Throwable t);
100    
101        /**
102         * Logs a message object with the {@link Level#DEBUG DEBUG} level.
103         *
104         * @param marker the marker data specific to this log statement
105         * @param message the message object to log.
106         */
107        void debug(Marker marker, String message);
108    
109        /**
110         * Logs a message with parameters at the {@link Level#DEBUG DEBUG} level.
111         *
112         * @param marker the marker data specific to this log statement
113         * @param message the message to log; the format depends on the message factory.
114         * @param params parameters to the message.
115         * @see #getMessageFactory()
116         */
117        void debug(Marker marker, String message, Object... params);
118    
119        /**
120         * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable}
121         * <code>t</code> passed as parameter.
122         *
123         * @param marker the marker data specific to this log statement
124         * @param message the message to log.
125         * @param t the exception to log, including its stack trace.
126         */
127        void debug(Marker marker, String message, Throwable t);
128    
129        /**
130         * Logs a message with the specific Marker at the {@link Level#DEBUG DEBUG} level.
131         *
132         * @param msg the message string to be logged
133         */
134        void debug(Message msg);
135    
136        /**
137         * Logs a message with the specific Marker at the {@link Level#DEBUG DEBUG} level.
138         *
139         * @param msg the message string to be logged
140         * @param t A Throwable or null.
141         */
142        void debug(Message msg, Throwable t);
143    
144        /**
145         * Logs a message object with the {@link Level#DEBUG DEBUG} level.
146         *
147         * @param message the message object to log.
148         */
149        void debug(Object message);
150    
151        /**
152         * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable}
153         * <code>t</code> passed as parameter.
154         *
155         * @param message the message to log.
156         * @param t the exception to log, including its stack trace.
157         */
158        void debug(Object message, Throwable t);
159    
160        /**
161         * Logs a message object with the {@link Level#DEBUG DEBUG} level.
162         *
163         * @param message the message object to log.
164         */
165        void debug(String message);
166    
167        /**
168         * Logs a message with parameters at the {@link Level#DEBUG DEBUG} level.
169         *
170         * @param message the message to log; the format depends on the message factory.
171         * @param params parameters to the message.
172         * @see #getMessageFactory()
173         */
174        void debug(String message, Object... params);
175    
176        /**
177         * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable}
178         * <code>t</code> passed as parameter.
179         *
180         * @param message the message to log.
181         * @param t the exception to log, including its stack trace.
182         */
183        void debug(String message, Throwable t);
184    
185        /**
186         * Logs entry to a method. Used when the method in question has no parameters or when the parameters should not be
187         * logged.
188         */
189        void entry();
190    
191        /**
192         * Logs entry to a method along with its parameters. For example,
193         * <pre>
194         *     public void doSomething(String foo, int bar) {
195         *         LOGGER.entry(foo, bar);
196         *         // do something
197         *     }
198         * </pre>
199         * <p>The use of methods such as this are more effective when combined with aspect-oriented programming or other
200         * bytecode manipulation tools. It can be rather tedious (and messy) to use this type of method manually.</p>
201         *
202         * @param params The parameters to the method.
203         * TODO Use of varargs results in array creation which can be a substantial portion of no-op case. LogMF/LogSF
204         *        provides several overrides to avoid vararg except in edge cases. (RG) LogMF and LogSF implement these in
205         *        LogXF which calls logger.callAppenders. callAppenders is part of the implementation and cannot be used by
206         *        the API. Adding more methods here and in AbstractLogger is sufficient.
207         */
208        void entry(Object... params);
209    
210        /**
211         * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level.
212         *
213         * @param marker the marker data specific to this log statement
214         * @param msg the message string to be logged
215         */
216        void error(Marker marker, Message msg);
217    
218        /**
219         * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level.
220         *
221         * @param marker the marker data specific to this log statement
222         * @param msg the message string to be logged
223         * @param t A Throwable or null.
224         */
225        void error(Marker marker, Message msg, Throwable t);
226    
227        /**
228         * Logs a message object with the {@link Level#ERROR ERROR} level.
229         *
230         * @param marker the marker data specific to this log statement.
231         * @param message the message object to log.
232         */
233        void error(Marker marker, Object message);
234    
235        /**
236         * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable}
237         * <code>t</code> passed as parameter.
238         *
239         * @param marker the marker data specific to this log statement.
240         * @param message the message object to log.
241         * @param t the exception to log, including its stack trace.
242         */
243        void error(Marker marker, Object message, Throwable t);
244    
245        /**
246         * Logs a message object with the {@link Level#ERROR ERROR} level.
247         *
248         * @param marker the marker data specific to this log statement.
249         * @param message the message object to log.
250         */
251        void error(Marker marker, String message);
252    
253        /**
254         * Logs a message with parameters at the {@link Level#ERROR ERROR} level.
255         *
256         * @param marker the marker data specific to this log statement.
257         * @param message the message to log; the format depends on the message factory.
258         * @param params parameters to the message.
259         * @see #getMessageFactory()
260         *
261         * TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
262         *        array creation expense on every call. (RG) I assume you meant error, not info. It isn't possible to be
263         *        misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for
264         *        1, 2 or 3 parameters.
265         */
266        void error(Marker marker, String message, Object... params);
267    
268        /**
269         * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable}
270         * <code>t</code> passed as parameter.
271         *
272         * @param marker the marker data specific to this log statement.
273         * @param message the message object to log.
274         * @param t the exception to log, including its stack trace.
275         */
276        void error(Marker marker, String message, Throwable t);
277    
278        /**
279         * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level.
280         *
281         * @param msg the message string to be logged
282         */
283        void error(Message msg);
284    
285        /**
286         * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level.
287         *
288         * @param msg the message string to be logged
289         * @param t A Throwable or null.
290         */
291        void error(Message msg, Throwable t);
292    
293        /**
294         * Logs a message object with the {@link Level#ERROR ERROR} level.
295         *
296         * @param message the message object to log.
297         */
298        void error(Object message);
299    
300        /**
301         * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable}
302         * <code>t</code> passed as parameter.
303         *
304         * @param message the message object to log.
305         * @param t the exception to log, including its stack trace.
306         */
307        void error(Object message, Throwable t);
308    
309        /**
310         * Logs a message object with the {@link Level#ERROR ERROR} level.
311         *
312         * @param message the message object to log.
313         */
314        void error(String message);
315    
316        /**
317         * Logs a message with parameters at the {@link Level#ERROR ERROR} level.
318         *
319         * @param message the message to log; the format depends on the message factory.
320         * @param params parameters to the message.
321         * @see #getMessageFactory()
322         *
323         * TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
324         *        array creation expense on every call. (RG) I assume you meant error, not info. It isn't possible to be
325         *        misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for
326         *        1, 2 or 3 parameters.
327         */
328        void error(String message, Object... params);
329    
330        /**
331         * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable}
332         * <code>t</code> passed as parameter.
333         *
334         * @param message the message object to log.
335         * @param t the exception to log, including its stack trace.
336         */
337        void error(String message, Throwable t);
338    
339        /**
340         * Logs exit from a method. Used for methods that do not return anything.
341         */
342        void exit();
343    
344        /**
345         * Logs exiting from a method with the result. This may be coded as:
346         * <pre>
347         *     return LOGGER.exit(myResult);
348         * </pre>
349         *
350         * @param <R> The type of the parameter and object being returned.
351         * @param result The result being returned from the method call.
352         * @return the result.
353         */
354        <R> R exit(R result);
355    
356        /**
357         * Logs a message with the specific Marker at the {@link Level#FATAL FATAL} level.
358         *
359         * @param marker the marker data specific to this log statement
360         * @param msg the message string to be logged
361         */
362        void fatal(Marker marker, Message msg);
363    
364        /**
365         * Logs a message with the specific Marker at the {@link Level#FATAL FATAL} level.
366         *
367         * @param marker the marker data specific to this log statement
368         * @param msg the message string to be logged
369         * @param t A Throwable or null.
370         */
371        void fatal(Marker marker, Message msg, Throwable t);
372    
373        /**
374         * Logs a message object with the {@link Level#FATAL FATAL} level.
375         *
376         * @param marker The marker data specific to this log statement.
377         * @param message the message object to log.
378         */
379        void fatal(Marker marker, Object message);
380    
381        /**
382         * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable}
383         * <code>t</code> passed as parameter.
384         *
385         * @param marker The marker data specific to this log statement.
386         * @param message the message object to log.
387         * @param t the exception to log, including its stack trace.
388         */
389        void fatal(Marker marker, Object message, Throwable t);
390    
391        /**
392         * Logs a message object with the {@link Level#FATAL FATAL} level.
393         *
394         * @param marker The marker data specific to this log statement.
395         * @param message the message object to log.
396         */
397        void fatal(Marker marker, String message);
398    
399        /**
400         * Logs a message with parameters at the {@link Level#FATAL FATAL} level.
401         *
402         * @param marker The marker data specific to this log statement.
403         * @param message the message to log; the format depends on the message factory.
404         * @param params parameters to the message.
405         * @see #getMessageFactory()
406         *
407         * TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
408         *        array creation expense on every call.(RG) I assume you meant fatal, not info. It isn't possible to be
409         *        misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for
410         *        1, 2 or 3 parameters.
411         */
412        void fatal(Marker marker, String message, Object... params);
413    
414        /**
415         * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable}
416         * <code>t</code> passed as parameter.
417         *
418         * @param marker The marker data specific to this log statement.
419         * @param message the message object to log.
420         * @param t the exception to log, including its stack trace.
421         */
422        void fatal(Marker marker, String message, Throwable t);
423    
424        /**
425         * Logs a message with the specific Marker at the {@link Level#FATAL FATAL} level.
426         *
427         * @param msg the message string to be logged
428         */
429        void fatal(Message msg);
430    
431        /**
432         * Logs a message with the specific Marker at the {@link Level#FATAL FATAL} level.
433         *
434         * @param msg the message string to be logged
435         * @param t A Throwable or null.
436         */
437        void fatal(Message msg, Throwable t);
438    
439        /**
440         * Logs a message object with the {@link Level#FATAL FATAL} level.
441         *
442         * @param message the message object to log.
443         */
444        void fatal(Object message);
445    
446        /**
447         * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable}
448         * <code>t</code> passed as parameter.
449         *
450         * @param message the message object to log.
451         * @param t the exception to log, including its stack trace.
452         */
453        void fatal(Object message, Throwable t);
454    
455        /**
456         * Logs a message object with the {@link Level#FATAL FATAL} level.
457         *
458         * @param message the message object to log.
459         */
460        void fatal(String message);
461    
462        /**
463         * Logs a message with parameters at the {@link Level#FATAL FATAL} level.
464         *
465         * @param message the message to log; the format depends on the message factory.
466         * @param params parameters to the message.
467         * @see #getMessageFactory()
468         *
469         * TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
470         *        array creation expense on every call.(RG) I assume you meant fatal, not info. It isn't possible to be
471         *        misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for
472         *        1, 2 or 3 parameters.
473         */
474        void fatal(String message, Object... params);
475    
476        /**
477         * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable}
478         * <code>t</code> passed as parameter.
479         *
480         * @param message the message object to log.
481         * @param t the exception to log, including its stack trace.
482         */
483        void fatal(String message, Throwable t);
484    
485        /**
486         * Gets the Level associated with the Logger.
487         *
488         * @return the Level associate with the Logger.
489         */
490        Level getLevel();
491    
492        /**
493         * Gets the message factory used to convert message Objects and Strings into actual log Messages.
494         *
495         * @return the message factory.
496         */
497        MessageFactory getMessageFactory();
498    
499        /**
500         * Gets the logger name.
501         *
502         * @return the logger name.
503         */
504        String getName();
505    
506        /**
507         * Logs a message with the specific Marker at the {@link Level#INFO INFO} level.
508         *
509         * @param marker the marker data specific to this log statement
510         * @param msg the message string to be logged
511         */
512        void info(Marker marker, Message msg);
513    
514        /**
515         * Logs a message with the specific Marker at the {@link Level#INFO INFO} level.
516         *
517         * @param marker the marker data specific to this log statement
518         * @param msg the message string to be logged
519         * @param t A Throwable or null.
520         */
521        void info(Marker marker, Message msg, Throwable t);
522    
523        /**
524         * Logs a message object with the {@link Level#INFO INFO} level.
525         *
526         * @param marker the marker data specific to this log statement
527         * @param message the message object to log.
528         */
529        void info(Marker marker, Object message);
530    
531        /**
532         * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable}
533         * <code>t</code> passed as parameter.
534         *
535         * @param marker the marker data specific to this log statement
536         * @param message the message object to log.
537         * @param t the exception to log, including its stack trace.
538         */
539        void info(Marker marker, Object message, Throwable t);
540    
541        /**
542         * Logs a message object with the {@link Level#INFO INFO} level.
543         *
544         * @param marker the marker data specific to this log statement
545         * @param message the message object to log.
546         */
547        void info(Marker marker, String message);
548    
549        /**
550         * Logs a message with parameters at the {@link Level#INFO INFO} level.
551         *
552         * @param marker the marker data specific to this log statement
553         * @param message the message to log; the format depends on the message factory.
554         * @param params parameters to the message.
555         * @see #getMessageFactory()
556         *
557         * TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
558         *        array creation expense on every call. (RG) It isn't possible to be misinterpreted as the previous method
559         *        is for that signature. Methods should be added to avoid varargs for 1, 2 or 3 parameters.
560         */
561        void info(Marker marker, String message, Object... params);
562    
563        /**
564         * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable}
565         * <code>t</code> passed as parameter.
566         *
567         * @param marker the marker data specific to this log statement
568         * @param message the message object to log.
569         * @param t the exception to log, including its stack trace.
570         */
571        void info(Marker marker, String message, Throwable t);
572    
573        /**
574         * Logs a message with the specific Marker at the {@link Level#INFO INFO} level.
575         *
576         * @param msg the message string to be logged
577         */
578        void info(Message msg);
579    
580        /**
581         * Logs a message with the specific Marker at the {@link Level#INFO INFO} level.
582         *
583         * @param msg the message string to be logged
584         * @param t A Throwable or null.
585         */
586        void info(Message msg, Throwable t);
587    
588        /**
589         * Logs a message object with the {@link Level#INFO INFO} level.
590         *
591         * @param message the message object to log.
592         */
593        void info(Object message);
594    
595        /**
596         * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable}
597         * <code>t</code> passed as parameter.
598         *
599         * @param message the message object to log.
600         * @param t the exception to log, including its stack trace.
601         */
602        void info(Object message, Throwable t);
603    
604        /**
605         * Logs a message object with the {@link Level#INFO INFO} level.
606         *
607         * @param message the message object to log.
608         */
609        void info(String message);
610    
611        /**
612         * Logs a message with parameters at the {@link Level#INFO INFO} level.
613         *
614         * @param message the message to log; the format depends on the message factory.
615         * @param params parameters to the message.
616         * @see #getMessageFactory()
617         *
618         * TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
619         *        array creation expense on every call. (RG) It isn't possible to be misinterpreted as the previous method
620         *        is for that signature. Methods should be added to avoid varargs for 1, 2 or 3 parameters.
621         */
622        void info(String message, Object... params);
623    
624        /**
625         * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable}
626         * <code>t</code> passed as parameter.
627         *
628         * @param message the message object to log.
629         * @param t the exception to log, including its stack trace.
630         */
631        void info(String message, Throwable t);
632    
633        /**
634         * Checks whether this Logger is enabled for the {@link Level#DEBUG DEBUG} Level.
635         *
636         * @return boolean - {@code true} if this Logger is enabled for level DEBUG, {@code false} otherwise.
637         */
638        boolean isDebugEnabled();
639    
640        /**
641         * Checks whether this Logger is enabled for the {@link Level#DEBUG DEBUG} Level.
642         *
643         * @param marker The marker data specific to this log statement.
644         * @return boolean - {@code true} if this Logger is enabled for level DEBUG, {@code false} otherwise.
645         */
646        boolean isDebugEnabled(Marker marker);
647    
648        /**
649         * Checks whether this Logger is enabled for the the given Level.
650         * <p>
651         * Note that passing in {@link Level#OFF OFF} always returns {@code true}.
652         * </p>
653         *
654         * @param level the level to check
655         * @return boolean - {@code true} if this Logger is enabled for level, {@code false} otherwise.
656         */
657        boolean isEnabled(Level level);
658    
659        /**
660         * Checks whether this logger is enabled at the specified level and an optional Marker.
661         *
662         * @param level The Level to check.
663         * @param marker The marker data specific to this log statement.
664         * @return boolean - {@code true} if this Logger is enabled for level {@link Level#WARN WARN}, {@code false}
665         *         otherwise.
666         */
667        boolean isEnabled(Level level, Marker marker);
668    
669        /**
670         * Checks whether this Logger is enabled for the {@link Level#ERROR ERROR} Level.
671         *
672         * @return boolean - {@code true} if this Logger is enabled for level {@link Level#ERROR ERROR}, {@code false}
673         *         otherwise.
674         */
675        boolean isErrorEnabled();
676    
677        /**
678         * Checks whether this Logger is enabled for the {@link Level#ERROR ERROR} Level.
679         *
680         * @param marker The marker data specific to this log statement.
681         * @return boolean - {@code true} if this Logger is enabled for level {@link Level#ERROR ERROR}, {@code false}
682         *         otherwise.
683         */
684        boolean isErrorEnabled(Marker marker);
685    
686        /**
687         * Checks whether this Logger is enabled for the {@link Level#FATAL FATAL} Level.
688         *
689         * @return boolean - {@code true} if this Logger is enabled for level {@link Level#FATAL FATAL}, {@code false}
690         *         otherwise.
691         */
692        boolean isFatalEnabled();
693    
694        /**
695         * Checks whether this Logger is enabled for the {@link Level#FATAL FATAL} Level.
696         *
697         * @param marker The marker data specific to this log statement.
698         * @return boolean - {@code true} if this Logger is enabled for level {@link Level#FATAL FATAL}, {@code false}
699         *         otherwise.
700         */
701        boolean isFatalEnabled(Marker marker);
702    
703        /**
704         * Checks whether this Logger is enabled for the {@link Level#INFO INFO} Level.
705         *
706         * @return boolean - {@code true} if this Logger is enabled for level INFO, {@code false} otherwise.
707         */
708        boolean isInfoEnabled();
709    
710        /**
711         * Checks whether this Logger is enabled for the {@link Level#INFO INFO} Level.
712         *
713         * @param marker The marker data specific to this log statement.
714         * @return boolean - {@code true} if this Logger is enabled for level INFO, {@code false} otherwise.
715         */
716        boolean isInfoEnabled(Marker marker);
717    
718        /**
719         * Checks whether this Logger is enabled for the {@link Level#TRACE TRACE} level.
720         *
721         * @return boolean - {@code true} if this Logger is enabled for level TRACE, {@code false} otherwise.
722         */
723        boolean isTraceEnabled();
724    
725        /**
726         * Checks whether this Logger is enabled for the {@link Level#TRACE TRACE} level.
727         *
728         * @param marker The marker data specific to this log statement.
729         * @return boolean - {@code true} if this Logger is enabled for level TRACE, {@code false} otherwise.
730         */
731        boolean isTraceEnabled(Marker marker);
732    
733        /**
734         * Checks whether this Logger is enabled for the {@link Level#WARN WARN} Level.
735         *
736         * @return boolean - {@code true} if this Logger is enabled for level {@link Level#WARN WARN}, {@code false}
737         *         otherwise.
738         */
739        boolean isWarnEnabled();
740    
741        /**
742         * Checks whether this Logger is enabled for the {@link Level#WARN WARN} Level.
743         *
744         * @param marker The marker data specific to this log statement.
745         * @return boolean - {@code true} if this Logger is enabled for level {@link Level#WARN WARN}, {@code false}
746         *         otherwise.
747         */
748        boolean isWarnEnabled(Marker marker);
749    
750        /**
751         * Logs a message with the specific Marker at the given level.
752         *
753         * @param level the logging level
754         * @param marker the marker data specific to this log statement
755         * @param msg the message string to be logged
756         */
757        void log(Level level, Marker marker, Message msg);
758    
759        /**
760         * Logs a message with the specific Marker at the given level.
761         *
762         * @param level the logging level
763         * @param marker the marker data specific to this log statement
764         * @param msg the message string to be logged
765         * @param t A Throwable or null.
766         */
767        void log(Level level, Marker marker, Message msg, Throwable t);
768    
769        /**
770         * Logs a message object with the given level.
771         *
772         * @param level the logging level
773         * @param marker the marker data specific to this log statement
774         * @param message the message object to log.
775         */
776        void log(Level level, Marker marker, Object message);
777    
778        /**
779         * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as
780         * parameter.
781         *
782         * @param level the logging level
783         * @param marker the marker data specific to this log statement
784         * @param message the message to log.
785         * @param t the exception to log, including its stack trace.
786         */
787        void log(Level level, Marker marker, Object message, Throwable t);
788    
789        /**
790         * Logs a message object with the given level.
791         *
792         * @param level the logging level
793         * @param marker the marker data specific to this log statement
794         * @param message the message object to log.
795         */
796        void log(Level level, Marker marker, String message);
797    
798        /**
799         * Logs a message with parameters at the given level.
800         *
801         * @param level the logging level
802         * @param marker the marker data specific to this log statement
803         * @param message the message to log; the format depends on the message factory.
804         * @param params parameters to the message.
805         * @see #getMessageFactory()
806         */
807        void log(Level level, Marker marker, String message, Object... params);
808    
809        /**
810         * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as
811         * parameter.
812         *
813         * @param level the logging level
814         * @param marker the marker data specific to this log statement
815         * @param message the message to log.
816         * @param t the exception to log, including its stack trace.
817         */
818        void log(Level level, Marker marker, String message, Throwable t);
819    
820        /**
821         * Logs a message with the specific Marker at the given level.
822         *
823         * @param level the logging level
824         * @param msg the message string to be logged
825         */
826        void log(Level level, Message msg);
827    
828        /**
829         * Logs a message with the specific Marker at the given level.
830         *
831         * @param level the logging level
832         * @param msg the message string to be logged
833         * @param t A Throwable or null.
834         */
835        void log(Level level, Message msg, Throwable t);
836    
837        /**
838         * Logs a message object with the given level.
839         *
840         * @param level the logging level
841         * @param message the message object to log.
842         */
843        void log(Level level, Object message);
844    
845        /**
846         * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as
847         * parameter.
848         *
849         * @param level the logging level
850         * @param message the message to log.
851         * @param t the exception to log, including its stack trace.
852         */
853        void log(Level level, Object message, Throwable t);
854    
855        /**
856         * Logs a message object with the given level.
857         *
858         * @param level the logging level
859         * @param message the message object to log.
860         */
861        void log(Level level, String message);
862    
863        /**
864         * Logs a message with parameters at the given level.
865         *
866         * @param level the logging level
867         * @param message the message to log; the format depends on the message factory.
868         * @param params parameters to the message.
869         * @see #getMessageFactory()
870         */
871        void log(Level level, String message, Object... params);
872    
873        /**
874         * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as
875         * parameter.
876         *
877         * @param level the logging level
878         * @param message the message to log.
879         * @param t the exception to log, including its stack trace.
880         */
881        void log(Level level, String message, Throwable t);
882    
883        /**
884         * Logs a formatted message using the specified format string and arguments.
885         *
886         * @param level The logging Level.
887         * @param marker the marker data specific to this log statement.
888         * @param format The format String.
889         * @param params Arguments specified by the format.
890         */
891        void printf(Level level, Marker marker, String format, Object... params);
892    
893        /**
894         * Logs a formatted message using the specified format string and arguments.
895         *
896         * @param level The logging Level.
897         * @param format The format String.
898         * @param params Arguments specified by the format.
899         */
900        void printf(Level level, String format, Object... params);
901    
902        /**
903         * Logs an exception or error to be thrown. This may be coded as:
904         * <pre>
905         *     throw logger.throwing(Level.DEBUG, myException);
906         * </pre>
907         *
908         * @param <T> the Throwable type.
909         * @param level The logging Level.
910         * @param t The Throwable.
911         * @return the Throwable.
912         */
913        <T extends Throwable> T throwing(Level level, T t);
914    
915        /**
916         * Logs an exception or error to be thrown. This may be coded as:
917         * <pre>
918         *     throw logger.throwing(myException);
919         * </pre>
920         *
921         * @param <T> the Throwable type.
922         * @param t The Throwable.
923         * @return the Throwable.
924         */
925        <T extends Throwable> T throwing(T t);
926    
927        /**
928         * Logs a message with the specific Marker at the {@link Level#TRACE TRACE} level.
929         *
930         * @param marker the marker data specific to this log statement
931         * @param msg the message string to be logged
932         */
933        void trace(Marker marker, Message msg);
934    
935        /**
936         * Logs a message with the specific Marker at the {@link Level#TRACE TRACE} level.
937         *
938         * @param marker the marker data specific to this log statement
939         * @param msg the message string to be logged
940         * @param t A Throwable or null.
941         */
942        void trace(Marker marker, Message msg, Throwable t);
943    
944        /**
945         * Logs a message object with the {@link Level#TRACE TRACE} level.
946         *
947         * @param marker the marker data specific to this log statement
948         * @param message the message object to log.
949         */
950        void trace(Marker marker, Object message);
951    
952        /**
953         * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable}
954         * <code>t</code> passed as parameter.
955         *
956         * @param marker the marker data specific to this log statement
957         * @param message the message object to log.
958         * @param t the exception to log, including its stack trace.
959         * @see #debug(String)
960         */
961        void trace(Marker marker, Object message, Throwable t);
962    
963        /**
964         * Logs a message object with the {@link Level#TRACE TRACE} level.
965         *
966         * @param marker the marker data specific to this log statement
967         * @param message the message object to log.
968         */
969        void trace(Marker marker, String message);
970    
971        /**
972         * Logs a message with parameters at the {@link Level#TRACE TRACE} level.
973         *
974         * @param marker the marker data specific to this log statement
975         * @param message the message to log; the format depends on the message factory.
976         * @param params parameters to the message.
977         * @see #getMessageFactory()
978         */
979        void trace(Marker marker, String message, Object... params);
980    
981        /**
982         * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable}
983         * <code>t</code> passed as parameter.
984         *
985         * @param marker the marker data specific to this log statement
986         * @param message the message object to log.
987         * @param t the exception to log, including its stack trace.
988         * @see #debug(String)
989         */
990        void trace(Marker marker, String message, Throwable t);
991    
992        /**
993         * Logs a message with the specific Marker at the {@link Level#TRACE TRACE} level.
994         *
995         * @param msg the message string to be logged
996         */
997        void trace(Message msg);
998    
999        /**
1000         * Logs a message with the specific Marker at the {@link Level#TRACE TRACE} level.
1001         *
1002         * @param msg the message string to be logged
1003         * @param t A Throwable or null.
1004         */
1005        void trace(Message msg, Throwable t);
1006    
1007        /**
1008         * Logs a message object with the {@link Level#TRACE TRACE} level.
1009         *
1010         * @param message the message object to log.
1011         */
1012        void trace(Object message);
1013    
1014        /**
1015         * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable}
1016         * <code>t</code> passed as parameter.
1017         *
1018         * @param message the message object to log.
1019         * @param t the exception to log, including its stack trace.
1020         * @see #debug(String)
1021         */
1022        void trace(Object message, Throwable t);
1023    
1024        /**
1025         * Logs a message object with the {@link Level#TRACE TRACE} level.
1026         *
1027         * @param message the message object to log.
1028         */
1029        void trace(String message);
1030    
1031        /**
1032         * Logs a message with parameters at the {@link Level#TRACE TRACE} level.
1033         *
1034         * @param message the message to log; the format depends on the message factory.
1035         * @param params parameters to the message.
1036         * @see #getMessageFactory()
1037         */
1038        void trace(String message, Object... params);
1039    
1040        /**
1041         * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable}
1042         * <code>t</code> passed as parameter.
1043         *
1044         * @param message the message object to log.
1045         * @param t the exception to log, including its stack trace.
1046         * @see #debug(String)
1047         */
1048        void trace(String message, Throwable t);
1049    
1050        /**
1051         * Logs a message with the specific Marker at the {@link Level#WARN WARN} level.
1052         *
1053         * @param marker the marker data specific to this log statement
1054         * @param msg the message string to be logged
1055         */
1056        void warn(Marker marker, Message msg);
1057    
1058        /**
1059         * Logs a message with the specific Marker at the {@link Level#WARN WARN} level.
1060         *
1061         * @param marker the marker data specific to this log statement
1062         * @param msg the message string to be logged
1063         * @param t A Throwable or null.
1064         */
1065        void warn(Marker marker, Message msg, Throwable t);
1066    
1067        /**
1068         * Logs a message object with the {@link Level#WARN WARN} level.
1069         *
1070         * @param marker the marker data specific to this log statement
1071         * @param message the message object to log.
1072         */
1073        void warn(Marker marker, Object message);
1074    
1075        /**
1076         * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable}
1077         * <code>t</code> passed as parameter.
1078         *
1079         * @param marker the marker data specific to this log statement
1080         * @param message the message object to log.
1081         * @param t the exception to log, including its stack trace.
1082         */
1083        void warn(Marker marker, Object message, Throwable t);
1084    
1085        /**
1086         * Logs a message object with the {@link Level#WARN WARN} level.
1087         *
1088         * @param marker the marker data specific to this log statement
1089         * @param message the message object to log.
1090         */
1091        void warn(Marker marker, String message);
1092    
1093        /**
1094         * Logs a message with parameters at the {@link Level#WARN WARN} level.
1095         *
1096         * @param marker the marker data specific to this log statement.
1097         * @param message the message to log; the format depends on the message factory.
1098         * @param params parameters to the message.
1099         * @see #getMessageFactory()
1100         *
1101         * TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
1102         *        array creation expense on every call. (RG) I assume you meant warn, not info. It isn't possible to be
1103         *        misinterpreted as the previous method is for that signature.Methods should be added to avoid varargs for
1104         *        1, 2 or 3 parameters.
1105         */
1106        void warn(Marker marker, String message, Object... params);
1107    
1108        /**
1109         * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable}
1110         * <code>t</code> passed as parameter.
1111         *
1112         * @param marker the marker data specific to this log statement
1113         * @param message the message object to log.
1114         * @param t the exception to log, including its stack trace.
1115         */
1116        void warn(Marker marker, String message, Throwable t);
1117    
1118        /**
1119         * Logs a message with the specific Marker at the {@link Level#WARN WARN} level.
1120         *
1121         * @param msg the message string to be logged
1122         */
1123        void warn(Message msg);
1124    
1125        /**
1126         * Logs a message with the specific Marker at the {@link Level#WARN WARN} level.
1127         *
1128         * @param msg the message string to be logged
1129         * @param t A Throwable or null.
1130         */
1131        void warn(Message msg, Throwable t);
1132    
1133        /**
1134         * Logs a message object with the {@link Level#WARN WARN} level.
1135         *
1136         * @param message the message object to log.
1137         */
1138        void warn(Object message);
1139    
1140        /**
1141         * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable}
1142         * <code>t</code> passed as parameter.
1143         *
1144         * @param message the message object to log.
1145         * @param t the exception to log, including its stack trace.
1146         */
1147        void warn(Object message, Throwable t);
1148    
1149        /**
1150         * Logs a message object with the {@link Level#WARN WARN} level.
1151         *
1152         * @param message the message object to log.
1153         */
1154        void warn(String message);
1155    
1156        /**
1157         * Logs a message with parameters at the {@link Level#WARN WARN} level.
1158         *
1159         * @param message the message to log; the format depends on the message factory.
1160         * @param params parameters to the message.
1161         * @see #getMessageFactory()
1162         *
1163         * TODO Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs
1164         *        array creation expense on every call. (RG) I assume you meant warn, not info. It isn't possible to be
1165         *        misinterpreted as the previous method is for that signature.Methods should be added to avoid varargs for
1166         *        1, 2 or 3 parameters.
1167         */
1168        void warn(String message, Object... params);
1169    
1170        /**
1171         * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable}
1172         * <code>t</code> passed as parameter.
1173         *
1174         * @param message the message object to log.
1175         * @param t the exception to log, including its stack trace.
1176         */
1177        void warn(String message, Throwable t);
1178    }