The log configuration when Tomcat encounters an "error Listenerstart" or "error Filterstart" issue with no verbose logs.

Source: Internet
Author: User
Tags processing instruction

After the Web app was deployed to Tomcat yesterday, it failed to start successfully, and the console did not have a detailed error message.
At most, there are two lines of information, such as:
Severity: Error Listenerstart
Severity: Context [/lizongbo] startup failed due to previous errors

Or

Severity: Error filterstart
Org.apache.catalina.core.StandardContext start
Severity: Context startup failed due to previous errors

Find the information in the logs directory, in addition to these two words, there is no other auxiliary content.
It is difficult to find errors, in this case, because the default log of Tomcat itself does not output some error messages to the console or file.
At this point, you need to configure the log of Tomcat itself to enable verbose debug logging.

The configuration in Tomcat 5.5 and Tomcat 6.0 is basically the same, except that the directory where the relevant files are placed differs.

The first files you need to prepare are:

1.log4j.jar,: Http://www.apache.org/dist/logging/log4j/1.2.15/apache-log4j-1.2.15.zip
2.Tomcat 5.5 Required Commons-logging.jar,: Http://www.apache.org/dist/commons/logging/binaries/commons-logging-1.1.zip

3.log4j configuration file:
Log4j.properties
The configuration content is:

Log4j.rootlogger=error,r

Log4j.appender.console=org.apache.log4j.consoleappender
Log4j.appender.console.layout=org.apache.log4j.patternlayout
log4j.appender.console.layout.conversionpattern=[%p]%t-%c-%m%n

Log4j.appender.r=org.apache.log4j.rollingfileappender
Log4j.appender.r.file=${catalina.home}/logs/lizongbo.log
log4j.appender.r.maxfilesize=10mb
log4j.appender.r.maxbackupindex=10
Log4j.appender.r.layout=org.apache.log4j.patternlayout
log4j.appender.r.layout.conversionpattern=[%p]%t-%c-%m%n

Log4j.logger.org.apache.catalina=info,r,console

#日志级别不能太低, if configured for debug, there is too much log information for the output, which causes Tomcat to start very slowly.

Juli replacement files required for 4.Tomcat 6.0:

Http://www.apache.org/dist/tomcat/tomcat-6/v6.0.14/bin/extras/tomcat-juli-adapters.jar

Http://www.apache.org/dist/tomcat/tomcat-6/v6.0.14/bin/extras/tomcat-juli.jar

In the Tomcat6.0,

Copy the tomcat-juli-adapters.jar,log4j-1.2.15.jar,log4j.properties to the D:\Java\ApacheTomcat6.0.14\lib below.

Copy the Tomcat-juli.jar to the D:\Java\apache-tomcat-6.0.14\bin\ below.

Then start tomcat and you'll see Lizongbo.log under the D:\Java\apache-tomcat-6.0.14\logs.

In the Tomcat5.5,

Copy the Commons-logging-1.1.jar,log4j-1.2.15.jar to the D:\Java\apache-tomcat-5.5.25\common\lib below.
Copy the log4j.properties to the D:\Java\apache-tomcat-5.5.25\common\classes below.

Then start tomcat and you'll see Lizongbo.log under the D:\Java\apache-tomcat-5.5.25\logs.

At this time, and then through the log file analysis, you will find that this error may occur:
(Here are some of the mistakes I've encountered, mostly low-level errors)
1.webapps the Classe file to be used is not copied to the Web-inf/classes directory at all
(Java.lang.NoClassDefFoundError, this information may not be output to the console by default, especially with spring, yesterday is this careless low-level error)
2. To use the Lib file is not copied, the lack of Lib
There are several different versions of the jar file for the same library under 3.lib, which causes version conflicts.
The jar under 4.lib does not correspond to the Tomcat version (the problem I have is that the web app is working properly on Tomcat5.5, and Tomcat6.0 on the error
For example, a struts-webapp in Tomcat 6 reported the following error
"Parse Fatal Error at line 6:the processing instruction
Target matching "[Xx][mm][ll]" is not allowed ")

If you are willing to read English, you can refer to the official website:

Http://tomcat.apache.org/tomcat-6.0-doc/logging.html

Http://tomcat.apache.org/tomcat-5.5-doc/logging.html

The log configuration when Tomcat encounters an "error Listenerstart" or "error Filterstart" issue with no verbose logs.

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.