The log configuration when Tomcat Encounters "Error listenerStart" or "Error filterStart" and no detailed logs exist.

Source: Internet
Author: User
Tags processing instruction
Technorati label: Tomcat log

Author: lizongbo published at: PM. Tuesday, December 4 th, 2007
Copyright Disclaimer: You can reprint the document at will. During reprinting, you must mark the original source and author information of the article in the form of a hyperlink and this copyright statement.
Http://618119.com/archives/2007/12/04/37.html

After the web application was deployed to Tomcat yesterday, it cannot be started successfully and the Console does not have a detailed error message,
There are at most two rows of prompt information, for example:
Severe: Error listenerStart
Severe: Context [/lizongbo] startup failed due to previous errors

Or

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

Find the information in the logs directory, except for the two statements, there is no other auxiliary content.
Troubleshooting is difficult because the default logs of Tomcat do not output some error information to the console or file,
At this time, you need to configure Tomcat's own log to enable detailed debugging logs.

The configuration in Tomcat 5.5 and Tomcat 6.0 is basically the same, but the directories in the related files are different.

The first file to be prepared is:

1. log4j. jar,: http://www.apache.org/dist/logging/--escaped_anchor:e0a22b16b97ca8dedb8d5b8c15ffbcaa--/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
Configuration content:

Log4j. rootlogger = error, R

Log4j. appender. Console = org. Apache. log4j. leleappender
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 = 10 MB
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

# The log level cannot be too low. If debug is configured, too much log information is output, resulting in a very slow Tomcat startup.

4. Juli replacement file required by Tomcat 6.0:
Http://www.apache.org/dist/--escaped_anchor:079305423cce36d6691457475e081123--/tomcat-6/v6.0.14/bin/extras/tomcat-juli-adapters.jar
Http://www.apache.org/dist/--escaped_anchor:079305423cce36d6691457475e081123--/tomcat-6/v6.0.14/bin/extras/tomcat-juli.jar

In tomcat6.0,

Copy the tomcat-juli-adapters.jar, log4j-1.2.15.jar, log4j. properties to D:/Java/apachetomcat6.0.14/lib.

Copy the tomcat-juli.jar to D:/Java/Apache-Tomcat-6.0.14/bin.

Start Tomcat and you can see lizongbo. Log in D:/Java/Apache-Tomcat-6.0.14/logs.

In tomcat5.5,

Copy the commons-logging-1.1.jar, log4j-1.2.15.jar, to D:/Java/Apache-Tomcat-5.5.25/common/lib.
Copy log4j. properties to D:/Java/apache-tomcat-5.5.25/common/classes.

Start tomcat and you can see lizongbo. log in D:/Java/apache-tomcat-5.5.25/logs.

At this time, you can analyze the log files and find that the following errors may occur:
(The following are some low-level errors I encountered)
1. The classe file used by webapps is not copied to the WEB-INF/classes directory.
(Java. lang. NoClassDefFoundError, and this information may not be output to the console by default, especially when spring is used. Yesterday was a careless low-level error)
2. The lib file is not completely copied. The lib file is missing.
3. There are multiple different versions of jar files in the same library under lib, causing version conflict.
4. The jar in lib does not correspond to the tomcat version (The problem I encountered is that the web application runs normally on tomcat 5.5, and an error occurs when I switch to tomcat 6.0,
For example, a webapp using struts reports the following error in Tomcat 6.
"Parse Fatal Error at line 17 column 6: The processing instruction
Target matching "[xX] [mM] [lL]" is not allowed ")

If you are willing to read English, refer to the instructions on the official website:
Http://tomcat.apache.org/tomcat-6.0-doc/logging.html
Http://tomcat.apache.org/tomcat-5.5-doc/logging.html

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.