- log4j
- logback
To decide log4j or logback depends at the time of deployment ,agnostic to code
ex-
import org.slf4j.Logger;import org.slf4j.LoggerFactory;public class HelloWorld{ public static void main(String[] args) { Logger logger = LoggerFactory.getLogger(HelloWorld.class); logger.info("Hello World"); }} |
For above code all you need is slf4j
- SLF4j binding jar file
- Desired logging framework jar files (log4j or logback)
There are reasons to use logback ovr log4j because of all the improvments.
Please read below -