Make delicious recipes!

Logging Frameworks



  1. Log4J: Most commonly used logger. Very well tested over time and has lots of features.

  2. Logback: Successor of Log4J. It is better than Log4J because:
    1. It is claimed to be ten times faster than Logback.
    2. Much better filtering capabilities (example: conditional filtering in production systems).
    3. Can separate logs from each user to different files by using a new appender called ‘Sifting Appender’
    4. Includes package version information in stack traces.


  3. Java.util.logging: This is natively implemented inside Java but has less features than log4J.
    Intended to be used for simple logging only.

  4. TinyLog: Extremely simple and twice as fast as log4j.
    Unlike any other logger, it shows improves performance in multi-threading.

  5. SLF4J (Simple Logging Façade): Allows any logger to be plugged into a Java application at the time of deployment.
    This is done by selecting the respective binder-library.
    For example, if log4j is desired to be used, then slf4j-log4j12-1.7.5.jar can be used to bind the same during deployment and so on.

  6. Jakarta Commons Logging: JCL is also a façade over logging implementations like SLF4J but it is not as good as SLF4J.

  7. Log4jdbc: This is a logger developed by google.
    It uses SLF4J and substitutes question marks in SQL queries with actual values to make them more readable in the logs.
    It also prints timing information for each query.




Finally, the best combination to go for big production systems is
  1. Logback + SLF4J and
  2. Log4jdbc + SLF4J

For small projects, Java.util.logging is ideal.





Like us on Facebook to remain in touch
with the latest in technology and tutorials!


Got a thought to share or found a
bug in the code?
We'd love to hear from you:

Name:
Email: (Your email is not shared with anybody)
Comment:

Facebook comments:

Site Owner: Sachin Goyal