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