1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache license, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the license for the specific language governing permissions and 15 * limitations under the license. 16 */ 17 package org.apache.logging.log4j; 18 19 import org.apache.logging.log4j.message.Message; 20 import org.apache.logging.log4j.message.MessageFactory; 21 22 /** 23 * This is the central interface in the log4j package. Most logging operations, except configuration, are done through 24 * this interface. 25 */ 26 public interface Logger { 27 28 /** 29 * Logs an exception or error that has been caught. 30 * 31 * @param level The logging Level. 32 * @param t The Throwable. 33 */ 34 void catching(Level level, Throwable t); 35 36 /** 37 * Logs an exception or error that has been caught. 38 * 39 * @param t The Throwable. 40 */ 41 void catching(Throwable t); 42 43 /** 44 * Logs a message with the specific Marker at the {@link Level#DEBUG DEBUG} level. 45 * 46 * @param marker the marker data specific to this log statement 47 * @param msg the message string to be logged 48 */ 49 void debug(Marker marker, Message msg); 50 51 /** 52 * Logs a message with the specific Marker at the {@link Level#DEBUG DEBUG} level. 53 * 54 * @param marker the marker data specific to this log statement 55 * @param msg the message string to be logged 56 * @param t A Throwable or null. 57 */ 58 void debug(Marker marker, Message msg, Throwable t); 59 60 /** 61 * Logs a message object with the {@link Level#DEBUG DEBUG} level. 62 * 63 * @param marker the marker data specific to this log statement 64 * @param message the message object to log. 65 */ 66 void debug(Marker marker, Object message); 67 68 /** 69 * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable} 70 * <code>t</code> passed as parameter. 71 * 72 * @param marker the marker data specific to this log statement 73 * @param message the message to log. 74 * @param t the exception to log, including its stack trace. 75 */ 76 void debug(Marker marker, Object message, Throwable t); 77 78 /** 79 * Logs a message object with the {@link Level#DEBUG DEBUG} level. 80 * 81 * @param marker the marker data specific to this log statement 82 * @param message the message object to log. 83 */ 84 void debug(Marker marker, String message); 85 86 /** 87 * Logs a message with parameters at the {@link Level#DEBUG DEBUG} level. 88 * 89 * @param marker the marker data specific to this log statement 90 * @param message the message to log; the format depends on the message factory. 91 * @param params parameters to the message. 92 * @see #getMessageFactory() 93 */ 94 void debug(Marker marker, String message, Object... params); 95 96 /** 97 * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable} 98 * <code>t</code> passed as parameter. 99 * 100 * @param marker the marker data specific to this log statement 101 * @param message the message to log. 102 * @param t the exception to log, including its stack trace. 103 */ 104 void debug(Marker marker, String message, Throwable t); 105 106 /** 107 * Logs a message with the specific Marker at the {@link Level#DEBUG DEBUG} level. 108 * 109 * @param msg the message string to be logged 110 */ 111 void debug(Message msg); 112 113 /** 114 * Logs a message with the specific Marker at the {@link Level#DEBUG DEBUG} level. 115 * 116 * @param msg the message string to be logged 117 * @param t A Throwable or null. 118 */ 119 void debug(Message msg, Throwable t); 120 121 /** 122 * Logs a message object with the {@link Level#DEBUG DEBUG} level. 123 * 124 * @param message the message object to log. 125 */ 126 void debug(Object message); 127 128 /** 129 * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable} 130 * <code>t</code> passed as parameter. 131 * 132 * @param message the message to log. 133 * @param t the exception to log, including its stack trace. 134 */ 135 void debug(Object message, Throwable t); 136 137 /** 138 * Logs a message object with the {@link Level#DEBUG DEBUG} level. 139 * 140 * @param message the message object to log. 141 */ 142 void debug(String message); 143 144 /** 145 * Logs a message with parameters at the {@link Level#DEBUG DEBUG} level. 146 * 147 * @param message the message to log; the format depends on the message factory. 148 * @param params parameters to the message. 149 * @see #getMessageFactory() 150 */ 151 void debug(String message, Object... params); 152 153 /** 154 * Logs a message at the {@link Level#DEBUG DEBUG} level including the stack trace of the {@link Throwable} 155 * <code>t</code> passed as parameter. 156 * 157 * @param message the message to log. 158 * @param t the exception to log, including its stack trace. 159 */ 160 void debug(String message, Throwable t); 161 162 /** 163 * Logs entry to a method. 164 */ 165 void entry(); 166 167 /** 168 * Logs entry to a method. 169 * 170 * @param params The parameters to the method. 171 * @doubt Use of varargs results in array creation which can be a substantial portion of no-op case. LogMF/LogSF 172 * provides several overrides to avoid vararg except in edge cases. (RG) LogMF and LogSF implement these in 173 * LogXF which calls logger.callAppenders. callAppenders is part of the implementation and cannot be used by 174 * the API. Adding more methods here and in AbstractLogger is sufficient. 175 */ 176 void entry(Object... params); 177 178 /** 179 * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level. 180 * 181 * @param marker the marker data specific to this log statement 182 * @param msg the message string to be logged 183 */ 184 void error(Marker marker, Message msg); 185 186 /** 187 * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level. 188 * 189 * @param marker the marker data specific to this log statement 190 * @param msg the message string to be logged 191 * @param t A Throwable or null. 192 */ 193 void error(Marker marker, Message msg, Throwable t); 194 195 /** 196 * Logs a message object with the {@link Level#ERROR ERROR} level. 197 * 198 * @param marker the marker data specific to this log statement. 199 * @param message the message object to log. 200 */ 201 void error(Marker marker, Object message); 202 203 /** 204 * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable} 205 * <code>t</code> passed as parameter. 206 * 207 * @param marker the marker data specific to this log statement. 208 * @param message the message object to log. 209 * @param t the exception to log, including its stack trace. 210 */ 211 void error(Marker marker, Object message, Throwable t); 212 213 /** 214 * Logs a message object with the {@link Level#ERROR ERROR} level. 215 * 216 * @param marker the marker data specific to this log statement. 217 * @param message the message object to log. 218 */ 219 void error(Marker marker, String message); 220 221 /** 222 * Logs a message with parameters at the {@link Level#ERROR ERROR} level. 223 * 224 * @param marker the marker data specific to this log statement. 225 * @param message the message to log; the format depends on the message factory. 226 * @param params parameters to the message. 227 * @see #getMessageFactory() 228 * 229 * @doubt Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs 230 * array creation expense on every call. (RG) I assume you meant error, not info. It isn't possible to be 231 * misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for 232 * 1, 2 or 3 parameters. 233 */ 234 void error(Marker marker, String message, Object... params); 235 236 /** 237 * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable} 238 * <code>t</code> passed as parameter. 239 * 240 * @param marker the marker data specific to this log statement. 241 * @param message the message object to log. 242 * @param t the exception to log, including its stack trace. 243 */ 244 void error(Marker marker, String message, Throwable t); 245 246 /** 247 * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level. 248 * 249 * @param msg the message string to be logged 250 */ 251 void error(Message msg); 252 253 /** 254 * Logs a message with the specific Marker at the {@link Level#ERROR ERROR} level. 255 * 256 * @param msg the message string to be logged 257 * @param t A Throwable or null. 258 */ 259 void error(Message msg, Throwable t); 260 261 /** 262 * Logs a message object with the {@link Level#ERROR ERROR} level. 263 * 264 * @param message the message object to log. 265 */ 266 void error(Object message); 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 message the message object to log. 273 * @param t the exception to log, including its stack trace. 274 */ 275 void error(Object message, Throwable t); 276 277 /** 278 * Logs a message object with the {@link Level#ERROR ERROR} level. 279 * 280 * @param message the message object to log. 281 */ 282 void error(String message); 283 284 /** 285 * Logs a message with parameters at the {@link Level#ERROR ERROR} level. 286 * 287 * @param message the message to log; the format depends on the message factory. 288 * @param params parameters to the message. 289 * @see #getMessageFactory() 290 * 291 * @doubt Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs 292 * array creation expense on every call. (RG) I assume you meant error, not info. It isn't possible to be 293 * misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for 294 * 1, 2 or 3 parameters. 295 */ 296 void error(String message, Object... params); 297 298 /** 299 * Logs a message at the {@link Level#ERROR ERROR} level including the stack trace of the {@link Throwable} 300 * <code>t</code> passed as parameter. 301 * 302 * @param message the message object to log. 303 * @param t the exception to log, including its stack trace. 304 */ 305 void error(String message, Throwable t); 306 307 /** 308 * Logs exit from a method. 309 */ 310 void exit(); 311 312 /** 313 * Logs exiting from a method with the result. This may be coded as <br /> 314 * return logger.exit(myResult); 315 * 316 * @param <R> The type of the parameter and object being returned. 317 * @param result The result being returned from the method call. 318 * @return the result. 319 */ 320 <R> R exit(R result); 321 322 /** 323 * Logs a message with the specific Marker at the {@link Level#FATAL FATAL} level. 324 * 325 * @param marker the marker data specific to this log statement 326 * @param msg the message string to be logged 327 */ 328 void fatal(Marker marker, Message msg); 329 330 /** 331 * Logs a message with the specific Marker at the {@link Level#FATAL FATAL} level. 332 * 333 * @param marker the marker data specific to this log statement 334 * @param msg the message string to be logged 335 * @param t A Throwable or null. 336 */ 337 void fatal(Marker marker, Message msg, Throwable t); 338 339 /** 340 * Logs a message object with the {@link Level#FATAL FATAL} level. 341 * 342 * @param marker The marker data specific to this log statement. 343 * @param message the message object to log. 344 */ 345 void fatal(Marker marker, Object message); 346 347 /** 348 * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable} 349 * <code>t</code> passed as parameter. 350 * 351 * @param marker The marker data specific to this log statement. 352 * @param message the message object to log. 353 * @param t the exception to log, including its stack trace. 354 */ 355 void fatal(Marker marker, Object message, Throwable t); 356 357 /** 358 * Logs a message object with the {@link Level#FATAL FATAL} level. 359 * 360 * @param marker The marker data specific to this log statement. 361 * @param message the message object to log. 362 */ 363 void fatal(Marker marker, String message); 364 365 /** 366 * Logs a message with parameters at the {@link Level#FATAL FATAL} level. 367 * 368 * @param marker The marker data specific to this log statement. 369 * @param message the message to log; the format depends on the message factory. 370 * @param params parameters to the message. 371 * @see #getMessageFactory() 372 * 373 * @doubt Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs 374 * array creation expense on every call.(RG) I assume you meant fatal, not info. It isn't possible to be 375 * misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for 376 * 1, 2 or 3 parameters. 377 */ 378 void fatal(Marker marker, String message, Object... params); 379 380 /** 381 * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable} 382 * <code>t</code> passed as parameter. 383 * 384 * @param marker The marker data specific to this log statement. 385 * @param message the message object to log. 386 * @param t the exception to log, including its stack trace. 387 */ 388 void fatal(Marker marker, String message, Throwable t); 389 390 /** 391 * Logs a message with the specific Marker at the {@link Level#FATAL FATAL} level. 392 * 393 * @param msg the message string to be logged 394 */ 395 void fatal(Message msg); 396 397 /** 398 * Logs a message with the specific Marker at the {@link Level#FATAL FATAL} level. 399 * 400 * @param msg the message string to be logged 401 * @param t A Throwable or null. 402 */ 403 void fatal(Message msg, Throwable t); 404 405 /** 406 * Logs a message object with the {@link Level#FATAL FATAL} level. 407 * 408 * @param message the message object to log. 409 */ 410 void fatal(Object message); 411 412 /** 413 * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable} 414 * <code>t</code> passed as parameter. 415 * 416 * @param message the message object to log. 417 * @param t the exception to log, including its stack trace. 418 */ 419 void fatal(Object message, Throwable t); 420 421 /** 422 * Logs a message object with the {@link Level#FATAL FATAL} level. 423 * 424 * @param message the message object to log. 425 */ 426 void fatal(String message); 427 428 /** 429 * Logs a message with parameters at the {@link Level#FATAL FATAL} level. 430 * 431 * @param message the message to log; the format depends on the message factory. 432 * @param params parameters to the message. 433 * @see #getMessageFactory() 434 * 435 * @doubt Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs 436 * array creation expense on every call.(RG) I assume you meant fatal, not info. It isn't possible to be 437 * misinterpreted as the previous method is for that signature. Methods should be added to avoid varargs for 438 * 1, 2 or 3 parameters. 439 */ 440 void fatal(String message, Object... params); 441 442 /** 443 * Logs a message at the {@link Level#FATAL FATAL} level including the stack trace of the {@link Throwable} 444 * <code>t</code> passed as parameter. 445 * 446 * @param message the message object to log. 447 * @param t the exception to log, including its stack trace. 448 */ 449 void fatal(String message, Throwable t); 450 451 /** 452 * Gets the Level associated with the Logger. 453 * 454 * @return the Level associate with the Logger. 455 */ 456 Level getLevel(); 457 458 /** 459 * Gets the message factory used to convert message Objects and Strings into actual log Messages. 460 * 461 * @return the message factory. 462 */ 463 MessageFactory getMessageFactory(); 464 465 /** 466 * Gets the logger name. 467 * 468 * @return the logger name. 469 */ 470 String getName(); 471 472 /** 473 * Logs a message with the specific Marker at the {@link Level#INFO INFO} level. 474 * 475 * @param marker the marker data specific to this log statement 476 * @param msg the message string to be logged 477 */ 478 void info(Marker marker, Message msg); 479 480 /** 481 * Logs a message with the specific Marker at the {@link Level#INFO INFO} level. 482 * 483 * @param marker the marker data specific to this log statement 484 * @param msg the message string to be logged 485 * @param t A Throwable or null. 486 */ 487 void info(Marker marker, Message msg, Throwable t); 488 489 /** 490 * Logs a message object with the {@link Level#INFO INFO} level. 491 * 492 * @param marker the marker data specific to this log statement 493 * @param message the message object to log. 494 */ 495 void info(Marker marker, Object message); 496 497 /** 498 * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable} 499 * <code>t</code> passed as parameter. 500 * 501 * @param marker the marker data specific to this log statement 502 * @param message the message object to log. 503 * @param t the exception to log, including its stack trace. 504 */ 505 void info(Marker marker, Object message, Throwable t); 506 507 /** 508 * Logs a message object with the {@link Level#INFO INFO} level. 509 * 510 * @param marker the marker data specific to this log statement 511 * @param message the message object to log. 512 */ 513 void info(Marker marker, String message); 514 515 /** 516 * Logs a message with parameters at the {@link Level#INFO INFO} level. 517 * 518 * @param marker the marker data specific to this log statement 519 * @param message the message to log; the format depends on the message factory. 520 * @param params parameters to the message. 521 * @see #getMessageFactory() 522 * 523 * @doubt Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs 524 * array creation expense on every call. (RG) It isn't possible to be misinterpreted as the previous method 525 * is for that signature. Methods should be added to avoid varargs for 1, 2 or 3 parameters. 526 */ 527 void info(Marker marker, String message, Object... params); 528 529 /** 530 * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable} 531 * <code>t</code> passed as parameter. 532 * 533 * @param marker the marker data specific to this log statement 534 * @param message the message object to log. 535 * @param t the exception to log, including its stack trace. 536 */ 537 void info(Marker marker, String message, Throwable t); 538 539 /** 540 * Logs a message with the specific Marker at the {@link Level#INFO INFO} level. 541 * 542 * @param msg the message string to be logged 543 */ 544 void info(Message msg); 545 546 /** 547 * Logs a message with the specific Marker at the {@link Level#INFO INFO} level. 548 * 549 * @param msg the message string to be logged 550 * @param t A Throwable or null. 551 */ 552 void info(Message msg, Throwable t); 553 554 /** 555 * Logs a message object with the {@link Level#INFO INFO} level. 556 * 557 * @param message the message object to log. 558 */ 559 void info(Object message); 560 561 /** 562 * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable} 563 * <code>t</code> passed as parameter. 564 * 565 * @param message the message object to log. 566 * @param t the exception to log, including its stack trace. 567 */ 568 void info(Object message, Throwable t); 569 570 /** 571 * Logs a message object with the {@link Level#INFO INFO} level. 572 * 573 * @param message the message object to log. 574 */ 575 void info(String message); 576 577 /** 578 * Logs a message with parameters at the {@link Level#INFO INFO} level. 579 * 580 * @param message the message to log; the format depends on the message factory. 581 * @param params parameters to the message. 582 * @see #getMessageFactory() 583 * 584 * @doubt Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs 585 * array creation expense on every call. (RG) It isn't possible to be misinterpreted as the previous method 586 * is for that signature. Methods should be added to avoid varargs for 1, 2 or 3 parameters. 587 */ 588 void info(String message, Object... params); 589 590 /** 591 * Logs a message at the {@link Level#INFO INFO} level including the stack trace of the {@link Throwable} 592 * <code>t</code> passed as parameter. 593 * 594 * @param message the message object to log. 595 * @param t the exception to log, including its stack trace. 596 */ 597 void info(String message, Throwable t); 598 599 /** 600 * Checks whether this Logger is enabled for the {@link Level#DEBUG DEBUG} Level. 601 * 602 * @return boolean - {@code true} if this Logger is enabled for level DEBUG, {@code false} otherwise. 603 */ 604 boolean isDebugEnabled(); 605 606 /** 607 * Checks whether this Logger is enabled for the {@link Level#DEBUG DEBUG} Level. 608 * 609 * @param marker The marker data specific to this log statement. 610 * @return boolean - {@code true} if this Logger is enabled for level DEBUG, {@code false} otherwise. 611 */ 612 boolean isDebugEnabled(Marker marker); 613 614 /** 615 * Checks whether this Logger is enabled for the the given Level. 616 * <p> 617 * Note that passing in {@link Level#OFF OFF} always returns {@code true}. 618 * </p> 619 * 620 * @param level the level to check 621 * @return boolean - {@code true} if this Logger is enabled for level, {@code false} otherwise. 622 */ 623 boolean isEnabled(Level level); 624 625 /** 626 * Checks whether this logger is enabled at the specified level and an optional Marker. 627 * 628 * @param level The Level to check. 629 * @param marker The marker data specific to this log statement. 630 * @return boolean - {@code true} if this Logger is enabled for level {@link Level#WARN WARN}, {@code false} 631 * otherwise. 632 */ 633 boolean isEnabled(Level level, Marker marker); 634 635 /** 636 * Checks whether this Logger is enabled for the {@link Level#ERROR ERROR} Level. 637 * 638 * @return boolean - {@code true} if this Logger is enabled for level {@link Level#ERROR ERROR}, {@code false} 639 * otherwise. 640 */ 641 boolean isErrorEnabled(); 642 643 /** 644 * Checks whether this Logger is enabled for the {@link Level#ERROR ERROR} Level. 645 * 646 * @param marker The marker data specific to this log statement. 647 * @return boolean - {@code true} if this Logger is enabled for level {@link Level#ERROR ERROR}, {@code false} 648 * otherwise. 649 */ 650 boolean isErrorEnabled(Marker marker); 651 652 /** 653 * Checks whether this Logger is enabled for the {@link Level#FATAL FATAL} Level. 654 * 655 * @return boolean - {@code true} if this Logger is enabled for level {@link Level#FATAL FATAL}, {@code false} 656 * otherwise. 657 */ 658 boolean isFatalEnabled(); 659 660 /** 661 * Checks whether this Logger is enabled for the {@link Level#FATAL FATAL} Level. 662 * 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#FATAL FATAL}, {@code false} 665 * otherwise. 666 */ 667 boolean isFatalEnabled(Marker marker); 668 669 /** 670 * Checks whether this Logger is enabled for the {@link Level#INFO INFO} Level. 671 * 672 * @return boolean - {@code true} if this Logger is enabled for level INFO, {@code false} otherwise. 673 */ 674 boolean isInfoEnabled(); 675 676 /** 677 * Checks whether this Logger is enabled for the {@link Level#INFO INFO} Level. 678 * 679 * @param marker The marker data specific to this log statement. 680 * @return boolean - {@code true} if this Logger is enabled for level INFO, {@code false} otherwise. 681 */ 682 boolean isInfoEnabled(Marker marker); 683 684 /** 685 * Checks whether this Logger is enabled for the {@link Level#TRACE TRACE} level. 686 * 687 * @return boolean - {@code true} if this Logger is enabled for level TRACE, {@code false} otherwise. 688 */ 689 boolean isTraceEnabled(); 690 691 /** 692 * Checks whether this Logger is enabled for the {@link Level#TRACE TRACE} level. 693 * 694 * @param marker The marker data specific to this log statement. 695 * @return boolean - {@code true} if this Logger is enabled for level TRACE, {@code false} otherwise. 696 */ 697 boolean isTraceEnabled(Marker marker); 698 699 /** 700 * Checks whether this Logger is enabled for the {@link Level#WARN WARN} Level. 701 * 702 * @return boolean - {@code true} if this Logger is enabled for level {@link Level#WARN WARN}, {@code false} 703 * otherwise. 704 */ 705 boolean isWarnEnabled(); 706 707 /** 708 * Checks whether this Logger is enabled for the {@link Level#WARN WARN} Level. 709 * 710 * @param marker The marker data specific to this log statement. 711 * @return boolean - {@code true} if this Logger is enabled for level {@link Level#WARN WARN}, {@code false} 712 * otherwise. 713 */ 714 boolean isWarnEnabled(Marker marker); 715 716 /** 717 * Logs a message with the specific Marker at the given level. 718 * 719 * @param level the logging level 720 * @param marker the marker data specific to this log statement 721 * @param msg the message string to be logged 722 */ 723 void log(Level level, Marker marker, Message msg); 724 725 /** 726 * Logs a message with the specific Marker at the given level. 727 * 728 * @param level the logging level 729 * @param marker the marker data specific to this log statement 730 * @param msg the message string to be logged 731 * @param t A Throwable or null. 732 */ 733 void log(Level level, Marker marker, Message msg, Throwable t); 734 735 /** 736 * Logs a message object with the given level. 737 * 738 * @param level the logging level 739 * @param marker the marker data specific to this log statement 740 * @param message the message object to log. 741 */ 742 void log(Level level, Marker marker, Object message); 743 744 /** 745 * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as 746 * parameter. 747 * 748 * @param level the logging level 749 * @param marker the marker data specific to this log statement 750 * @param message the message to log. 751 * @param t the exception to log, including its stack trace. 752 */ 753 void log(Level level, Marker marker, Object message, Throwable t); 754 755 /** 756 * Logs a message object with the given level. 757 * 758 * @param level the logging level 759 * @param marker the marker data specific to this log statement 760 * @param message the message object to log. 761 */ 762 void log(Level level, Marker marker, String message); 763 764 /** 765 * Logs a message with parameters at the given level. 766 * 767 * @param level the logging level 768 * @param marker the marker data specific to this log statement 769 * @param message the message to log; the format depends on the message factory. 770 * @param params parameters to the message. 771 * @see #getMessageFactory() 772 */ 773 void log(Level level, Marker marker, String message, Object... params); 774 775 /** 776 * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as 777 * parameter. 778 * 779 * @param level the logging level 780 * @param marker the marker data specific to this log statement 781 * @param message the message to log. 782 * @param t the exception to log, including its stack trace. 783 */ 784 void log(Level level, Marker marker, String message, Throwable t); 785 786 /** 787 * Logs a message with the specific Marker at the given level. 788 * 789 * @param level the logging level 790 * @param msg the message string to be logged 791 */ 792 void log(Level level, Message msg); 793 794 /** 795 * Logs a message with the specific Marker at the given level. 796 * 797 * @param level the logging level 798 * @param msg the message string to be logged 799 * @param t A Throwable or null. 800 */ 801 void log(Level level, Message msg, Throwable t); 802 803 /** 804 * Logs a message object with the given level. 805 * 806 * @param level the logging level 807 * @param message the message object to log. 808 */ 809 void log(Level level, Object message); 810 811 /** 812 * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as 813 * parameter. 814 * 815 * @param level the logging level 816 * @param message the message to log. 817 * @param t the exception to log, including its stack trace. 818 */ 819 void log(Level level, Object message, Throwable t); 820 821 /** 822 * Logs a message object with the given level. 823 * 824 * @param level the logging level 825 * @param message the message object to log. 826 */ 827 void log(Level level, String message); 828 829 /** 830 * Logs a message with parameters at the given level. 831 * 832 * @param level the logging level 833 * @param message the message to log; the format depends on the message factory. 834 * @param params parameters to the message. 835 * @see #getMessageFactory() 836 */ 837 void log(Level level, String message, Object... params); 838 839 /** 840 * Logs a message at the given level including the stack trace of the {@link Throwable} <code>t</code> passed as 841 * parameter. 842 * 843 * @param level the logging level 844 * @param message the message to log. 845 * @param t the exception to log, including its stack trace. 846 */ 847 void log(Level level, String message, Throwable t); 848 849 /** 850 * Logs a formatted message using the specified format string and arguments. 851 * 852 * @param level The logging Level. 853 * @param marker the marker data specific to this log statement. 854 * @param format The format String. 855 * @param params Arguments specified by the format. 856 */ 857 void printf(Level level, Marker marker, String format, Object... params); 858 859 /** 860 * Logs a formatted message using the specified format string and arguments. 861 * 862 * @param level The logging Level. 863 * @param format The format String. 864 * @param params Arguments specified by the format. 865 */ 866 void printf(Level level, String format, Object... params); 867 868 /** 869 * Logs an exception or error to be thrown. This may be coded as <br /> 870 * throw logger.throwing(debug, myException); 871 * 872 * @param <T> the Throwable type. 873 * @param level The logging Level. 874 * @param t The Throwable. 875 * @return the Throwable. 876 */ 877 <T extends Throwable> T throwing(Level level, T t); 878 879 /** 880 * Logs an exception or error to be thrown. This may be coded as <br /> 881 * throw logger.throwing(myException); 882 * 883 * @param <T> the Throwable type. 884 * @param t The Throwable. 885 * @return the Throwable. 886 */ 887 <T extends Throwable> T throwing(T t); 888 889 /** 890 * Logs a message with the specific Marker at the {@link Level#TRACE TRACE} level. 891 * 892 * @param marker the marker data specific to this log statement 893 * @param msg the message string to be logged 894 */ 895 void trace(Marker marker, Message msg); 896 897 /** 898 * Logs a message with the specific Marker at the {@link Level#TRACE TRACE} level. 899 * 900 * @param marker the marker data specific to this log statement 901 * @param msg the message string to be logged 902 * @param t A Throwable or null. 903 */ 904 void trace(Marker marker, Message msg, Throwable t); 905 906 /** 907 * Logs a message object with the {@link Level#TRACE TRACE} level. 908 * 909 * @param marker the marker data specific to this log statement 910 * @param message the message object to log. 911 */ 912 void trace(Marker marker, Object message); 913 914 /** 915 * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable} 916 * <code>t</code> passed as parameter. 917 * <p/> 918 * <p> 919 * See {@link #debug(String)} form for more detailed information. 920 * </p> 921 * 922 * @param marker the marker data specific to this log statement 923 * @param message the message object to log. 924 * @param t the exception to log, including its stack trace. 925 */ 926 void trace(Marker marker, Object message, Throwable t); 927 928 /** 929 * Logs a message object with the {@link Level#TRACE TRACE} level. 930 * 931 * @param marker the marker data specific to this log statement 932 * @param message the message object to log. 933 */ 934 void trace(Marker marker, String message); 935 936 /** 937 * Logs a message with parameters at the {@link Level#TRACE TRACE} level. 938 * 939 * @param marker the marker data specific to this log statement 940 * @param message the message to log; the format depends on the message factory. 941 * @param params parameters to the message. 942 * @see #getMessageFactory() 943 */ 944 void trace(Marker marker, String message, Object... params); 945 946 /** 947 * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable} 948 * <code>t</code> passed as parameter. 949 * <p/> 950 * <p> 951 * See {@link #debug(String)} form for more detailed information. 952 * </p> 953 * 954 * @param marker the marker data specific to this log statement 955 * @param message the message object to log. 956 * @param t the exception to log, including its stack trace. 957 */ 958 void trace(Marker marker, String message, Throwable t); 959 960 /** 961 * Logs a message with the specific Marker at the {@link Level#TRACE TRACE} level. 962 * 963 * @param msg the message string to be logged 964 */ 965 void trace(Message msg); 966 967 /** 968 * Logs a message with the specific Marker at the {@link Level#TRACE TRACE} level. 969 * 970 * @param msg the message string to be logged 971 * @param t A Throwable or null. 972 */ 973 void trace(Message msg, Throwable t); 974 975 /** 976 * Logs a message object with the {@link Level#TRACE TRACE} level. 977 * 978 * @param message the message object to log. 979 */ 980 void trace(Object message); 981 982 /** 983 * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable} 984 * <code>t</code> passed as parameter. 985 * <p/> 986 * <p> 987 * See {@link #debug(String)} form for more detailed information. 988 * </p> 989 * 990 * @param message the message object to log. 991 * @param t the exception to log, including its stack trace. 992 */ 993 void trace(Object message, Throwable t); 994 995 /** 996 * Logs a message object with the {@link Level#TRACE TRACE} level. 997 * 998 * @param message the message object to log. 999 */ 1000 void trace(String message); 1001 1002 /** 1003 * Logs a message with parameters at the {@link Level#TRACE TRACE} level. 1004 * 1005 * @param message the message to log; the format depends on the message factory. 1006 * @param params parameters to the message. 1007 * @see #getMessageFactory() 1008 */ 1009 void trace(String message, Object... params); 1010 1011 /** 1012 * Logs a message at the {@link Level#TRACE TRACE} level including the stack trace of the {@link Throwable} 1013 * <code>t</code> passed as parameter. 1014 * <p/> 1015 * <p> 1016 * See {@link #debug(String)} form for more detailed information. 1017 * </p> 1018 * 1019 * @param message the message object to log. 1020 * @param t the exception to log, including its stack trace. 1021 */ 1022 void trace(String message, Throwable t); 1023 1024 /** 1025 * Logs a message with the specific Marker at the {@link Level#WARN WARN} level. 1026 * 1027 * @param marker the marker data specific to this log statement 1028 * @param msg the message string to be logged 1029 */ 1030 void warn(Marker marker, Message msg); 1031 1032 /** 1033 * Logs a message with the specific Marker at the {@link Level#WARN WARN} level. 1034 * 1035 * @param marker the marker data specific to this log statement 1036 * @param msg the message string to be logged 1037 * @param t A Throwable or null. 1038 */ 1039 void warn(Marker marker, Message msg, Throwable t); 1040 1041 /** 1042 * Logs a message object with the {@link Level#WARN WARN} level. 1043 * 1044 * @param marker the marker data specific to this log statement 1045 * @param message the message object to log. 1046 */ 1047 void warn(Marker marker, Object message); 1048 1049 /** 1050 * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable} 1051 * <code>t</code> passed as parameter. 1052 * 1053 * @param marker the marker data specific to this log statement 1054 * @param message the message object to log. 1055 * @param t the exception to log, including its stack trace. 1056 */ 1057 void warn(Marker marker, Object message, Throwable t); 1058 1059 /** 1060 * Logs a message object with the {@link Level#WARN WARN} level. 1061 * 1062 * @param marker the marker data specific to this log statement 1063 * @param message the message object to log. 1064 */ 1065 void warn(Marker marker, String message); 1066 1067 /** 1068 * Logs a message with parameters at the {@link Level#WARN WARN} level. 1069 * 1070 * @param marker the marker data specific to this log statement. 1071 * @param message the message to log; the format depends on the message factory. 1072 * @param params parameters to the message. 1073 * @see #getMessageFactory() 1074 * 1075 * @doubt Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs 1076 * array creation expense on every call. (RG) I assume you meant warn, not info. It isn't possible to be 1077 * misinterpreted as the previous method is for that signature.Methods should be added to avoid varargs for 1078 * 1, 2 or 3 parameters. 1079 */ 1080 void warn(Marker marker, String message, Object... params); 1081 1082 /** 1083 * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable} 1084 * <code>t</code> passed as parameter. 1085 * 1086 * @param marker the marker data specific to this log statement 1087 * @param message the message object to log. 1088 * @param t the exception to log, including its stack trace. 1089 */ 1090 void warn(Marker marker, String message, Throwable t); 1091 1092 /** 1093 * Logs a message with the specific Marker at the {@link Level#WARN WARN} level. 1094 * 1095 * @param msg the message string to be logged 1096 */ 1097 void warn(Message msg); 1098 1099 /** 1100 * Logs a message with the specific Marker at the {@link Level#WARN WARN} level. 1101 * 1102 * @param msg the message string to be logged 1103 * @param t A Throwable or null. 1104 */ 1105 void warn(Message msg, Throwable t); 1106 1107 /** 1108 * Logs a message object with the {@link Level#WARN WARN} level. 1109 * 1110 * @param message the message object to log. 1111 */ 1112 void warn(Object message); 1113 1114 /** 1115 * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable} 1116 * <code>t</code> passed as parameter. 1117 * 1118 * @param message the message object to log. 1119 * @param t the exception to log, including its stack trace. 1120 */ 1121 void warn(Object message, Throwable t); 1122 1123 /** 1124 * Logs a message object with the {@link Level#WARN WARN} level. 1125 * 1126 * @param message the message object to log. 1127 */ 1128 void warn(String message); 1129 1130 /** 1131 * Logs a message with parameters at the {@link Level#WARN WARN} level. 1132 * 1133 * @param message the message to log; the format depends on the message factory. 1134 * @param params parameters to the message. 1135 * @see #getMessageFactory() 1136 * 1137 * @doubt Likely to misinterpret existing log4j client code that intended to call info(Object,Throwable). Incurs 1138 * array creation expense on every call. (RG) I assume you meant warn, not info. It isn't possible to be 1139 * misinterpreted as the previous method is for that signature.Methods should be added to avoid varargs for 1140 * 1, 2 or 3 parameters. 1141 */ 1142 void warn(String message, Object... params); 1143 1144 /** 1145 * Logs a message at the {@link Level#WARN WARN} level including the stack trace of the {@link Throwable} 1146 * <code>t</code> passed as parameter. 1147 * 1148 * @param message the message object to log. 1149 * @param t the exception to log, including its stack trace. 1150 */ 1151 void warn(String message, Throwable t); 1152 }