Tomcat Log log4j,slf4j,logback conflict

Source: Internet
Author: User

Problem Description:

Start Tomcat and discover that Tomcat cannot start, Catalina.out has the following error log:

INFO [Localhost-startstop-1]org.apache.catalina.core.applicationcontext.log Closing Spring Rootwebapplicationcontext

SEVERE [Localhost-startstop-1]org.apache.catalina.core.standardcontext.listenerstop Exception sending Contextdestroyed event to listener instance of Classorg.springframework.web.context.ContextLoaderListener

Java.lang.NoClassDefFoundError:Could Notinitialize class Org.apache.log4j.Log4jLoggerFactory

Atorg.apache.log4j.LogManager.getLogger (logmanager.java:44)

Atorg.slf4j.impl.Log4jLoggerFactory.getLogger (log4jloggerfactory.java:73)

Atorg.slf4j.LoggerFactory.getLogger (loggerfactory.java:270)

Atorg.apache.commons.logging.impl.SLF4JLogFactory.getInstance (slf4jlogfactory.java:156)

Atorg.apache.commons.logging.impl.SLF4JLogFactory.getInstance (slf4jlogfactory.java:132)

Atorg.apache.commons.logging.LogFactory.getLog (logfactory.java:274)

Atorg.springframework.web.context.contextcleanuplistener.<clinit> (contextcleanuplistener.java:43)

Atorg.springframework.web.context.ContextLoaderListener.contextDestroyed (contextloaderlistener.java:145)

Atorg.apache.catalina.core.StandardContext.listenerStop (standardcontext.java:4860)

Atorg.apache.catalina.core.StandardContext.stopInternal (standardcontext.java:5495)

Atorg.apache.catalina.util.LifecycleBase.stop (lifecyclebase.java:224)

Atorg.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:159)

Atorg.apache.catalina.core.containerbase$startchild.call (containerbase.java:1407)

Atorg.apache.catalina.core.containerbase$startchild.call (containerbase.java:1397)

Atjava.util.concurrent.FutureTask.run (futuretask.java:266)

Atjava.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1142)

Atjava.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:617)

Atjava.lang.Thread.run (thread.java:745)

Problem Analysis:

Check the Lib library below and discover that the log4j and logback combinations have been updated today, with the following packages in total:


Slf4j-api-1.7.5.jar

Slf4j-log4j12-1.6.1.jar

Log4j-1.2.16.jar

Log4j-over-slf4j-1.7.5.jar

Logback-core-1.1.2.jar

Logback-classic-1.1.2.jar

By querying the data found that the package Slf4j-log4j12-1.6.1.jar and log4j conflict.


Workaround:

normal after deletion, Delete this: Slf4j-log4j12-1.6.1.jar


Common combinations of attachments:

Log4j+slf4j

Slf4j-api-1.7.5.jar

Slf4j-log4j12-1.6.1.jar

Log4j-1.2.16.jar



Slf4j+logback

Logback-core-1.1.2.jar

Logback-classic-1.1.2.jar

Slf4j-api-1.7.5.jar




Resources:

Http://logback.qos.ch/documentation.html

Http://logging.apache.org/log4j/1.2/

http://www.slf4j.org/


This article from "Ruffian Cook actor" blog, reproduced please contact the author!

Tomcat Log Log4j,slf4j,logback conflicts

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.