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