Logback一共需要以下配置文件
<!-- logback -->
<dependency>
<groupId> org.logback-extensions</groupId >
<artifactId> logback-ext-spring</ artifactId>
<version> 0.1.4</ version>
</dependency>
<dependency>
<groupId> org.slf4j</groupId >
<artifactId> slf4j-api</artifactId >
<version> 1.6.4</version >
</dependency>
<dependency>
<groupId> org.slf4j</groupId >
<artifactId> jcl-over-slf4j </artifactId>
<version> 1.6.4</version >
</dependency>
<dependency>
<groupId> ch.qos.logback</groupId >
<artifactId> logback-core </artifactId>
<version> 1.1.6</version >
</dependency>
<dependency>
<groupId> ch.qos.logback</groupId >
<artifactId> logback-access </artifactId>
<version> 1.1.6</version >
</dependency>
<dependency>
<groupId> ch.qos.logback</groupId >
<artifactId> logback-classic </artifactId>
<version> 1.1.6</version >
</dependency>
然后是web.xml
的配置
<context-param>
<param-name>logbackConfigLocation</param-name>
<param-value>classpath:resource/logback.xml</param-value>
</context-param>
<listener>
<listener-class>ch.qos.logback.ext.spring.web.LogbackConfigListener</listener-class>
</listener>
有了这些配置准备工作就算是完成了。