L
L
LucemFerre2014-04-03 23:05:25
Java
LucemFerre, 2014-04-03 23:05:25

How to understand why log4j is being cut down?

I deploy, so, my application ... Spring is there, on the tomcat ... Everything seems to be going well, and then bam, and ....

03-Apr-2014 23:59:52.083 SEVERE [RMI TCP Connection(5)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Error filterStart
03-Apr-2014 23:59:52.084 SEVERE [RMI TCP Connection(5)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.XmlWebApplicationContext).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

I must say right away that log4j.properties lies in place, the logs normally fall, up to a certain point. In the settings, everything is extremely simple:
log4j.rootLogger=DEBUG, CONSOLE

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

Last lines before it crashes:
2014-04-03 23:59:52,067 [RMI TCP Connection(5)-127.0.0.1] DEBUG org.springframework.web.filter.CharacterEncodingFilter - Initializing filter 'encodingFilter'
2014-04-03 23:59:52,080 [RMI TCP Connection(5)-127.0.0.1] DEBUG org.springframework.web.filter.CharacterEncodingFilter - Filter 'encodingFilter' configured successfully
2014-04-03 23:59:52,081 [RMI TCP Connection(5)-127.0.0.1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletConfigInitParams] PropertySource with lowest search precedence
2014-04-03 23:59:52,081 [RMI TCP Connection(5)-127.0.0.1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [servletContextInitParams] PropertySource with lowest search precedence
2014-04-03 23:59:52,081 [RMI TCP Connection(5)-127.0.0.1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [jndiProperties] PropertySource with lowest search precedence
2014-04-03 23:59:52,081 [RMI TCP Connection(5)-127.0.0.1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
2014-04-03 23:59:52,082 [RMI TCP Connection(5)-127.0.0.1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
2014-04-03 23:59:52,082 [RMI TCP Connection(5)-127.0.0.1] DEBUG org.springframework.web.context.support.StandardServletEnvironment - Initialized StandardServletEnvironment with PropertySources [servletConfigInitParams,servletContextInitParams,jndiProperties,systemProperties,systemEnvironment]
2014-04-03 23:59:52,082 [RMI TCP Connection(5)-127.0.0.1] DEBUG org.springframework.web.filter.DelegatingFilterProxy - Initializing filter 'springSecurityFilterChain'

The other tomcat-catalina logs are empty. So I understand that, most likely, something is wrong with dependencies, but without logs it is too difficult to understand. The goal is to deal with the logger, understand why this happens, and fix it. :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
A_Gura, 2014-04-04
@LucemFerre

Log4j even gave you a link to explain the problem: logging.apache.org/log4j/1.2/faq.html#noconfig
Use Log4jConfigListener in your web.xml (or in your web application initialization code if you are not using web.xml):

<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>/WEB-INF/log4j.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question