Logback is intended as a successor to the popular log4j project, picking up where log4j leaves off. Configuring the logback to bootstrap in the project is describe here. For more information, see the reference manual.

Dependencies

<!-- Logging -->
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>jcl-over-slf4j</artifactId>
  <version>1.7.13</version>
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>ch.qos.logback</groupId>
  <artifactId>logback-classic</artifactId>
  <version>1.1.3</version>
</dependency>

Configuring logback

Create a xml file with named logback.xml under resource directory of the web application.

Logging

Now to log out,

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

class MyApp {
	private static final Logger log = LoggerFactory.getLogger(Myapp.class);

	public void doSomething() {
		log.debug("**** Recieved request ****");
	}
}