Discussions

XML & Web services: Problems with log4j and tomcat

  1. Problems with log4j and tomcat (1 messages)

    Hi ,

    This is a problem i've been encountering every now and then and i was able to fix at times by redeploying my app and restarting tomcat ... if that makes any sense .

    Anywais , I just moved to a new linux server , still on tomcat 5.0.28 , and for a day and a half I have not been able to get log4j to tell me why the app can't be deployed .

    Normally I'd get a list of exceptions , messages , stack traces . All I get now is :

    Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Skipped installing application listeners due to previous error(s)
    Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext start
    SEVERE: Error listenerStart
    Jun 28, 2005 11:27:52 AM org.apache.catalina.core.StandardContext start
    SEVERE: Context startup failed due to previous errors

    I tried both with the log4j.properties file in myapp/WEB-INF/classes :


    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.Target=System.out
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

    log4j.rootLogger=debug, stdout

    and the log4j.properties file in TOMCAT_HOME/common/classes :

    log4j.rootLogger=ERROR, A1
    log4j.appender.A1=org.apache.log4j.ConsoleAppender
    log4j.appender.A1.layout=org.apache.log4j.PatternLayout

    log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

    log4j.logger.org.apache=DEBUG

    ------------------

    I added the log4j jar in my app , in common/lib , server/lib , shared/lib . I tried only with the global log4j.properties or only with my application's log4j.properties .

    NOTHING works .

    I'm in desperate need of getting this done , it's normally a 5 minute thing and i've been at it for a day and a half .

    Any help will be greately apreciated .

    thanks
  2. Problems with log4j and tomcat[ Go to top ]

    Hi Hector-

    Are you using commons-logging in your own code? I've never had commons-logging break tomcat before, but I've heard of it.

    My advice is this:
    * If possible, use log4j directly in your code. This should hopefully be fairly easy to do, but you'll lose some of the messages if you were relying on the logging that tomcat does on it's own through commons-logging. IMHO, not having to battle commons-logging is worth it.
    * If this isn't feasible, there are a number of places on the web which document this problem. Here's a good article.

    I hope you get your problem solved. I've had a number of problems configuring commons-logging correctly when using tomcat. Finally, I decided to use log4j directly.

    HTH,

    P