- SLF4J - Discussion
- SLF4J - Useful Resources
- SLF4J - Quick Guide
- SLF4J - Profiling
- SLF4J - Migrator
- SLF4J - Parameterized logging
- SLF4J - Error Messages
- SLF4J - Hello world
- SLF4J - Referenced API
- SLF4J - Environment Setup
- SLF4J Vs Log4j
- SLF4J - Logging Frameworks
- SLF4J - Overview
- SLF4J - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
SLF4J Vs Log4j
What is log4j?
log4j is a repable, fast and flexible logging framework (APIs) written in Java, which is distributed under the Apache Software License.
log4j is highly configurable through external configuration files at runtime. It views the logging process in terms of levels of priorities and offers mechanisms to direct logging information to a great variety of destinations, such as a database, file, console, UNIX Syslog, etc. (for more details on log4j refer our
).Comparison SLF4J and Log4j
Unpke log4j, SLF4J (Simple Logging Facade for Java) is not an implementation of logging framework, it is an abstraction for all those logging frameworks in Java similar to log4J. Therefore, you cannot compare both. However, it is always difficult to prefer one between the two.
If you have a choice, logging abstraction is always preferable than logging framework. If you use a logging abstraction, SLF4J in particular, you can migrate to any logging framework you need at the time of deployment without opting for single dependency.
Observe the following diagram to have a better understanding.
Advertisements