1 /*
2 * Copyright (c) 2004-2007 QOS.ch
3 * All rights reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 package org.slf4j;
27
28 /**
29 *
30 * The main user interface to logging. It is expected that logging
31 * takes place through concrete implementations of this interface.
32 *
33 * @author Ceki Gülcü
34 */
35 public interface Logger {
36
37
38 /**
39 * Case insensitive String constant used to retrieve the name of the root logger.
40 * @since 1.3
41 */
42 final public String ROOT_LOGGER_NAME = "ROOT";
43
44 /**
45 * Return the name of this <code>Logger</code> instance.
46 */
47 public String getName();
48
49 /**
50 * Is the logger instance enabled for the TRACE level?
51 * @return True if this Logger is enabled for the TRACE level,
52 * false otherwise.
53 *
54 * @since 1.4
55 */
56 public boolean isTraceEnabled();
57
58
59 /**
60 * Log a message at the TRACE level.
61 *
62 * @param msg the message string to be logged
63 * @since 1.4
64 */
65 public void trace(String msg);
66
67
68 /**
69 * Log a message at the TRACE level according to the specified format
70 * and argument.
71 *
72 * <p>This form avoids superfluous object creation when the logger
73 * is disabled for the TRACE level. </p>
74 *
75 * @param format the format string
76 * @param arg the argument
77 *
78 * @since 1.4
79 */
80 public void trace(String format, Object arg);
81
82
83
84 /**
85 * Log a message at the TRACE level according to the specified format
86 * and arguments.
87 *
88 * <p>This form avoids superfluous object creation when the logger
89 * is disabled for the TRACE level. </p>
90 *
91 * @param format the format string
92 * @param arg1 the first argument
93 * @param arg2 the second argument
94 *
95 * @since 1.4
96 */
97 public void trace(String format, Object arg1, Object arg2);
98
99 /**
100 * Log a message at the TRACE level according to the specified format
101 * and arguments.
102 *
103 * <p>This form avoids superfluous object creation when the logger
104 * is disabled for the TRACE level. </p>
105 *
106 * @param format the format string
107 * @param argArray an array of arguments
108 *
109 * @since 1.4
110 */
111 public void trace(String format, Object[] argArray);
112
113 /**
114 * Log an exception (throwable) at the TRACE level with an
115 * accompanying message.
116 *
117 * @param msg the message accompanying the exception
118 * @param t the exception (throwable) to log
119 *
120 * @since 1.4
121 */
122 public void trace(String msg, Throwable t);
123
124
125 /**
126 * Similar to {@link #isTraceEnabled()} method except that the
127 * marker data is also taken into account.
128 *
129 * @param marker The marker data to take into consideration
130 *
131 * @since 1.4
132 */
133 public boolean isTraceEnabled(Marker marker);
134
135 /**
136 * Log a message with the specific Marker at the TRACE level.
137 *
138 * @param marker the marker data specific to this log statement
139 * @param msg the message string to be logged
140 *
141 * @since 1.4
142 */
143 public void trace(Marker marker, String msg);
144
145 /**
146 * This method is similar to {@link #trace(String, Object)} method except that the
147 * marker data is also taken into consideration.
148 *
149 * @param marker the marker data specific to this log statement
150 * @param format the format string
151 * @param arg the argument
152 *
153 * @since 1.4
154 */
155 public void trace(Marker marker, String format, Object arg);
156
157
158 /**
159 * This method is similar to {@link #trace(String, Object, Object)}
160 * method except that the marker data is also taken into
161 * consideration.
162 *
163 * @param marker the marker data specific to this log statement
164 * @param format the format string
165 * @param arg1 the first argument
166 * @param arg2 the second argument
167 *
168 * @since 1.4
169 */
170 public void trace(Marker marker, String format, Object arg1, Object arg2);
171
172 /**
173 * This method is similar to {@link #trace(String, Object[])}
174 * method except that the marker data is also taken into
175 * consideration.
176 *
177 * @param marker the marker data specific to this log statement
178 * @param format the format string
179 * @param argArray an array of arguments
180 *
181 * @since 1.4
182 */
183 public void trace(Marker marker, String format, Object[] argArray);
184
185
186 /**
187 * This method is similar to {@link #trace(String, Throwable)} method except that the
188 * marker data is also taken into consideration.
189 *
190 * @param marker the marker data specific to this log statement
191 * @param msg the message accompanying the exception
192 * @param t the exception (throwable) to log
193 *
194 * @since 1.4
195 */
196 public void trace(Marker marker, String msg, Throwable t);
197
198
199 /**
200 * Is the logger instance enabled for the DEBUG level?
201 * @return True if this Logger is enabled for the DEBUG level,
202 * false otherwise.
203 *
204 */
205 public boolean isDebugEnabled();
206
207
208 /**
209 * Log a message at the DEBUG level.
210 *
211 * @param msg the message string to be logged
212 */
213 public void debug(String msg);
214
215
216 /**
217 * Log a message at the DEBUG level according to the specified format
218 * and argument.
219 *
220 * <p>This form avoids superfluous object creation when the logger
221 * is disabled for the DEBUG level. </p>
222 *
223 * @param format the format string
224 * @param arg the argument
225 */
226 public void debug(String format, Object arg);
227
228
229
230 /**
231 * Log a message at the DEBUG level according to the specified format
232 * and arguments.
233 *
234 * <p>This form avoids superfluous object creation when the logger
235 * is disabled for the DEBUG level. </p>
236 *
237 * @param format the format string
238 * @param arg1 the first argument
239 * @param arg2 the second argument
240 */
241 public void debug(String format, Object arg1, Object arg2);
242
243 /**
244 * Log a message at the DEBUG level according to the specified format
245 * and arguments.
246 *
247 * <p>This form avoids superfluous object creation when the logger
248 * is disabled for the DEBUG level. </p>
249 *
250 * @param format the format string
251 * @param argArray an array of arguments
252 */
253 public void debug(String format, Object[] argArray);
254
255 /**
256 * Log an exception (throwable) at the DEBUG level with an
257 * accompanying message.
258 *
259 * @param msg the message accompanying the exception
260 * @param t the exception (throwable) to log
261 */
262 public void debug(String msg, Throwable t);
263
264
265 /**
266 * Similar to {@link #isDebugEnabled()} method except that the
267 * marker data is also taken into account.
268 *
269 * @param marker The marker data to take into consideration
270 */
271 public boolean isDebugEnabled(Marker marker);
272
273 /**
274 * Log a message with the specific Marker at the DEBUG level.
275 *
276 * @param marker the marker data specific to this log statement
277 * @param msg the message string to be logged
278 */
279 public void debug(Marker marker, String msg);
280
281 /**
282 * This method is similar to {@link #debug(String, Object)} method except that the
283 * marker data is also taken into consideration.
284 *
285 * @param marker the marker data specific to this log statement
286 * @param format the format string
287 * @param arg the argument
288 */
289 public void debug(Marker marker, String format, Object arg);
290
291
292 /**
293 * This method is similar to {@link #debug(String, Object, Object)}
294 * method except that the marker data is also taken into
295 * consideration.
296 *
297 * @param marker the marker data specific to this log statement
298 * @param format the format string
299 * @param arg1 the first argument
300 * @param arg2 the second argument
301 */
302 public void debug(Marker marker, String format, Object arg1, Object arg2);
303
304 /**
305 * This method is similar to {@link #debug(String, Object[])}
306 * method except that the marker data is also taken into
307 * consideration.
308 *
309 * @param marker the marker data specific to this log statement
310 * @param format the format string
311 * @param argArray an array of arguments
312 */
313 public void debug(Marker marker, String format, Object[] argArray);
314
315
316 /**
317 * This method is similar to {@link #debug(String, Throwable)} method except that the
318 * marker data is also taken into consideration.
319 *
320 * @param marker the marker data specific to this log statement
321 * @param msg the message accompanying the exception
322 * @param t the exception (throwable) to log
323 */
324 public void debug(Marker marker, String msg, Throwable t);
325
326
327 /**
328 * Is the logger instance enabled for the INFO level?
329 * @return True if this Logger is enabled for the INFO level,
330 * false otherwise.
331 */
332 public boolean isInfoEnabled();
333
334
335 /**
336 * Log a message at the INFO level.
337 *
338 * @param msg the message string to be logged
339 */
340 public void info(String msg);
341
342
343 /**
344 * Log a message at the INFO level according to the specified format
345 * and argument.
346 *
347 * <p>This form avoids superfluous object creation when the logger
348 * is disabled for the INFO level. </p>
349 *
350 * @param format the format string
351 * @param arg the argument
352 */
353 public void info(String format, Object arg);
354
355
356 /**
357 * Log a message at the INFO level according to the specified format
358 * and arguments.
359 *
360 * <p>This form avoids superfluous object creation when the logger
361 * is disabled for the INFO level. </p>
362 *
363 * @param format the format string
364 * @param arg1 the first argument
365 * @param arg2 the second argument
366 */
367 public void info(String format, Object arg1, Object arg2);
368
369 /**
370 * Log a message at the INFO level according to the specified format
371 * and arguments.
372 *
373 * <p>This form avoids superfluous object creation when the logger
374 * is disabled for the INFO level. </p>
375 *
376 * @param format the format string
377 * @param argArray an array of arguments
378 */
379 public void info(String format, Object[] argArray);
380
381 /**
382 * Log an exception (throwable) at the INFO level with an
383 * accompanying message.
384 *
385 * @param msg the message accompanying the exception
386 * @param t the exception (throwable) to log
387 */
388 public void info(String msg, Throwable t);
389
390 /**
391 * Similar to {@link #isInfoEnabled()} method except that the marker
392 * data is also taken into consideration.
393 *
394 * @param marker The marker data to take into consideration
395 */
396 public boolean isInfoEnabled(Marker marker);
397
398 /**
399 * Log a message with the specific Marker at the INFO level.
400 *
401 * @param marker The marker specific to this log statement
402 * @param msg the message string to be logged
403 */
404 public void info(Marker marker, String msg);
405
406 /**
407 * This method is similar to {@link #info(String, Object)} method except that the
408 * marker data is also taken into consideration.
409 *
410 * @param marker the marker data specific to this log statement
411 * @param format the format string
412 * @param arg the argument
413 */
414 public void info(Marker marker, String format, Object arg);
415
416 /**
417 * This method is similar to {@link #info(String, Object, Object)}
418 * method except that the marker data is also taken into
419 * consideration.
420 *
421 * @param marker the marker data specific to this log statement
422 * @param format the format string
423 * @param arg1 the first argument
424 * @param arg2 the second argument
425 */
426 public void info(Marker marker, String format, Object arg1, Object arg2);
427
428
429 /**
430 * This method is similar to {@link #info(String, Object[])}
431 * method except that the marker data is also taken into
432 * consideration.
433 *
434 * @param marker the marker data specific to this log statement
435 * @param format the format string
436 * @param argArray an array of arguments
437 */
438 public void info(Marker marker, String format, Object[] argArray);
439
440
441 /**
442 * This method is similar to {@link #info(String, Throwable)} method
443 * except that the marker data is also taken into consideration.
444 *
445 * @param marker the marker data for this log statement
446 * @param msg the message accompanying the exception
447 * @param t the exception (throwable) to log
448 */
449 public void info(Marker marker, String msg, Throwable t);
450
451
452 /**
453 * Is the logger instance enabled for the WARN level?
454 * @return True if this Logger is enabled for the WARN level,
455 * false otherwise.
456 */
457 public boolean isWarnEnabled();
458
459 /**
460 * Log a message at the WARN level.
461 *
462 * @param msg the message string to be logged
463 */
464 public void warn(String msg);
465
466 /**
467 * Log a message at the WARN level according to the specified format
468 * and argument.
469 *
470 * <p>This form avoids superfluous object creation when the logger
471 * is disabled for the WARN level. </p>
472 *
473 * @param format the format string
474 * @param arg the argument
475 */
476 public void warn(String format, Object arg);
477
478
479 /**
480 * Log a message at the WARN level according to the specified format
481 * and arguments.
482 *
483 * <p>This form avoids superfluous object creation when the logger
484 * is disabled for the WARN level. </p>
485 *
486 * @param format the format string
487 * @param argArray an array of arguments
488 */
489 public void warn(String format, Object[] argArray);
490
491 /**
492 * Log a message at the WARN level according to the specified format
493 * and arguments.
494 *
495 * <p>This form avoids superfluous object creation when the logger
496 * is disabled for the WARN level. </p>
497 *
498 * @param format the format string
499 * @param arg1 the first argument
500 * @param arg2 the second argument
501 */
502 public void warn(String format, Object arg1, Object arg2);
503
504 /**
505 * Log an exception (throwable) at the WARN level with an
506 * accompanying message.
507 *
508 * @param msg the message accompanying the exception
509 * @param t the exception (throwable) to log
510 */
511 public void warn(String msg, Throwable t);
512
513
514 /**
515 * Similar to {@link #isWarnEnabled()} method except that the marker
516 * data is also taken into consideration.
517 *
518 * @param marker The marker data to take into consideration
519 */
520 public boolean isWarnEnabled(Marker marker);
521
522 /**
523 * Log a message with the specific Marker at the WARN level.
524 *
525 * @param marker The marker specific to this log statement
526 * @param msg the message string to be logged
527 */
528 public void warn(Marker marker, String msg);
529
530 /**
531 * This method is similar to {@link #warn(String, Object)} method except that the
532 * marker data is also taken into consideration.
533 *
534 * @param marker the marker data specific to this log statement
535 * @param format the format string
536 * @param arg the argument
537 */
538 public void warn(Marker marker, String format, Object arg);
539
540 /**
541 * This method is similar to {@link #warn(String, Object, Object)}
542 * method except that the marker data is also taken into
543 * consideration.
544 *
545 * @param marker the marker data specific to this log statement
546 * @param format the format string
547 * @param arg1 the first argument
548 * @param arg2 the second argument
549 */
550 public void warn(Marker marker, String format, Object arg1, Object arg2);
551
552 /**
553 * This method is similar to {@link #warn(String, Object[])}
554 * method except that the marker data is also taken into
555 * consideration.
556 *
557 * @param marker the marker data specific to this log statement
558 * @param format the format string
559 * @param argArray an array of arguments
560 */
561 public void warn(Marker marker, String format, Object[] argArray);
562
563
564 /**
565 * This method is similar to {@link #warn(String, Throwable)} method
566 * except that the marker data is also taken into consideration.
567 *
568 * @param marker the marker data for this log statement
569 * @param msg the message accompanying the exception
570 * @param t the exception (throwable) to log
571 */
572 public void warn(Marker marker, String msg, Throwable t);
573
574
575 /**
576 * Is the logger instance enabled for the ERROR level?
577 * @return True if this Logger is enabled for the ERROR level,
578 * false otherwise.
579 */
580 public boolean isErrorEnabled();
581
582 /**
583 * Log a message at the ERROR level.
584 *
585 * @param msg the message string to be logged
586 */
587 public void error(String msg);
588
589 /**
590 * Log a message at the ERROR level according to the specified format
591 * and argument.
592 *
593 * <p>This form avoids superfluous object creation when the logger
594 * is disabled for the ERROR level. </p>
595 *
596 * @param format the format string
597 * @param arg the argument
598 */
599 public void error(String format, Object arg);
600
601 /**
602 * Log a message at the ERROR level according to the specified format
603 * and arguments.
604 *
605 * <p>This form avoids superfluous object creation when the logger
606 * is disabled for the ERROR level. </p>
607 *
608 * @param format the format string
609 * @param arg1 the first argument
610 * @param arg2 the second argument
611 */
612 public void error(String format, Object arg1, Object arg2);
613
614 /**
615 * Log a message at the ERROR level according to the specified format
616 * and arguments.
617 *
618 * <p>This form avoids superfluous object creation when the logger
619 * is disabled for the ERROR level. </p>
620 *
621 * @param format the format string
622 * @param argArray an array of arguments
623 */
624 public void error(String format, Object[] argArray);
625
626 /**
627 * Log an exception (throwable) at the ERROR level with an
628 * accompanying message.
629 *
630 * @param msg the message accompanying the exception
631 * @param t the exception (throwable) to log
632 */
633 public void error(String msg, Throwable t);
634
635
636 /**
637 * Similar to {@link #isErrorEnabled()} method except that the
638 * marker data is also taken into consideration.
639 *
640 * @param marker The marker data to take into consideration
641 */
642 public boolean isErrorEnabled(Marker marker);
643
644 /**
645 * Log a message with the specific Marker at the ERROR level.
646 *
647 * @param marker The marker specific to this log statement
648 * @param msg the message string to be logged
649 */
650 public void error(Marker marker, String msg);
651
652 /**
653 * This method is similar to {@link #error(String, Object)} method except that the
654 * marker data is also taken into consideration.
655 *
656 * @param marker the marker data specific to this log statement
657 * @param format the format string
658 * @param arg the argument
659 */
660 public void error(Marker marker, String format, Object arg);
661
662 /**
663 * This method is similar to {@link #error(String, Object, Object)}
664 * method except that the marker data is also taken into
665 * consideration.
666 *
667 * @param marker the marker data specific to this log statement
668 * @param format the format string
669 * @param arg1 the first argument
670 * @param arg2 the second argument
671 */
672 public void error(Marker marker, String format, Object arg1, Object arg2);
673
674 /**
675 * This method is similar to {@link #error(String, Object[])}
676 * method except that the marker data is also taken into
677 * consideration.
678 *
679 * @param marker the marker data specific to this log statement
680 * @param format the format string
681 * @param argArray an array of arguments
682 */
683 public void error(Marker marker, String format, Object[] argArray);
684
685
686 /**
687 * This method is similar to {@link #error(String, Throwable)}
688 * method except that the marker data is also taken into
689 * consideration.
690 *
691 * @param marker the marker data specific to this log statement
692 * @param msg the message accompanying the exception
693 * @param t the exception (throwable) to log
694 */
695 public void error(Marker marker, String msg, Throwable t);
696
697 }