SLF4J、Log4j、Logback三者之间的关系

1.SLF4J、Log4j、Logback三者之间的关系 SLF4J是中日志设计的门面模式,而Log4j和Logback是日志框架的具体实现。
2.Spring项目,自定义日志配置文件加载位置 Web Application If using Spring in a web application, add the following servlet context listener declaration to web.xml:

ch.qos.logback.ext.spring.web.LogbackConfigListener

【SLF4J、Log4j、Logback三者之间的关系】This will start up the Logback environment and shut it down in sync with your web application's lifecycle. This listener should be registered before ContextLoaderListener in web.xml, when using custom Logback initialization. For Servlet 2.2 containers and Servlet 2.3 ones that do not initialize listeners before servlets, use LogbackConfigServlet. See the LogbackConfigListener and WebLogbackConfigurer javadoc for details.
If you want to specify the logback.xml config file in a location other than the default (root of the classpath), you can specify its location using a Spring resource path with system propertyplaceholders in a logbackConfigLocation servlet context param in web.xml:
logbackConfigLocation/WEB-INF/logback-${os.name}.xml

3.参考文章 1.slf4j log4j logback关系详解和相关用法
2.【飞天奔月出品】剖析logback4:spring LogbackConfigListener

    推荐阅读