Log4j - Dependencies

<dependency> 
    <groupId>log4j</groupId> 
    <artifactId>log4j</artifactId> 
    <version>1.2.17</version> 
</dependency>

doesn’t support Slf4j natively, so you will need to add the following:

<dependency> 
    <groupId>org.slf4j</groupId> 
    <artifactId>slf4j-log4j12</artifactId> 
</dependency>

Log4j - Configuration

define your appender and logger with their log levels in the log4j.xml or log4j.properties in src/main/resources

  • appender writes the log messages to a destination such as a file or database
  • logger and level defines the granularity of log messages that are written to the log file

TODO