tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: How to debug Error: listenerStart?
Date Mon, 06 Apr 2009 21:14:49 GMT
Hash: SHA1


On 4/2/2009 3:03 PM, Caldarale, Charles R wrote:
>> From: Dan Armbrust []
>> Subject: Re: How to debug Error: listenerStart?
>> my webapp dynamically configures log4j with a pattern like this:
>> LogManager.resetConfiguration();
>> PropertyConfigurator.configure(properties);
> I think that's too late - the logger needs to be ready first thing so that webapp-related
log entries can be created during deployment.

In my webapp, I have a <listener> defined first that does this:

public class Log4jListener
    implements ServletContextListener
    private Logger logger;

    public void contextInitialized(ServletContextEvent e)
        // Trigger loading of the file from the classpath.
        new PropertyConfigurator();

        logger = Logger.getLogger(this.getClass());"Log4j initialized");

    public void contextDestroyed(ServletContextEvent e)
  "Log4j was loaded by application classloader;
shutting down.");

  "Log4j was loaded by some other ClassLoader; not
shutting down.");

This appears to load my configuration correctly, but I don't see any
Tomcat messages in my log4j.log file. It's possible that Tomcat doesn't
make much to say, though.

I find messages like this in catalina.out after a successful startup:

AbandonedObjectPool is used
   LogAbandoned: true
   RemoveAbandoned: true
   RemoveAbandonedTimeout: 30

I am using a <Context>-configured DataSource, which I might have
predicted would log to the app-configured logger, but it doesn't: it
logs to stdout.

>> INFO: Deploying web application archive ap.war
>> log4j:WARN No appenders could be found for logger
>> (org.apache.commons.digester.Digester).
>> log4j:WARN Please initialize the log4j system properly.
> Those are indications that usage of the logger has already commenced.

Yup, and it's probably commons-digester that triggered the configuration
of log4j.

>> What would I need to do to make log4j within my webapp 
>> have a temporary configuration which would log to the 
>> console until the point when my webapp executes it's 
>> dynamic configuration?
> Create a log4j.xml or file in WEB-INF/classes.


- -chris
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message