Alejandro Velasco wrote:
> Hi all.
> I've been reading with attention the user group for a while and learned 
> so much from all of you... ;-) Now I dare to put a question.
> 
> I'm testing now the new features in nigthly builds and face this problem.
> 
> In latest nigthly build, I try to run an app that works ok with 1.0.2, 
> beneath Tomcat 4.0.1 standalone, and I get these messages:
> 
> log4j:ERROR No appenders could be found for category 
> (org.apache.commons.digester.Digester).
> log4j:ERROR Please initialize the log4j system properly.
> 
> I put the example application in webapps and the errors are exactly the 
> same.
> 
> Despite the errors, the applications (mine and example) seems to work 
> correctly...
> 
> What has changed in nightly that needs an appender?
> How can I get rid of these error messages (I do NOT want by now to use 
> log4j)?
> Could anybody post an example log4j.properties I could use to avoid 
> these errors?

The recent common-logging package (which struts uses) now defaults to 
log4j if it can find it. Try removing log4j from your classpath.

Alternatively, you can initialize log4j before struts starts. Put this 
in your web.xml file (before the struts reference);

     <servlet>
         <servlet-name>log4j-init</servlet-name>
 
<servlet-class>com.ecomda.common.config.Log4jInitServlet</servlet-class>
         <init-param>
             <param-name>log4j-init-file</param-name>
             <param-value>/WEB-INF/log4j.properties</param-value>
         </init-param>
         <load-on-startup>1</load-on-startup>
     </servlet>

The servlet looks like this;

package com.ecomda.common.config;

import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.IOException;
import org.apache.log4j.PropertyConfigurator;

public class Log4jInitServlet extends HttpServlet {

     public void init() {
         String prefix = getServletContext().getRealPath("/");
         String file = getInitParameter("log4j-init-file");

         if (file != null) {
             PropertyConfigurator.configure(prefix+file);
         }
     }

     public void doGet(HttpServletRequest req, HttpServletResponse res) { }
}

And the log4j.properties goes in WEB-INF;

# Set root category priority to DEBUG and its only appender to A1.

log4j.rootCategory=DEBUG,A1,F1
log4j.category.com=DEBUG,A1,F1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# log4j.appender.A1.layout.ConversionPattern=%d %-4r [%t](%F:%L)  %-5p 
%c %x - %m%n
log4j.appender.A1.layout.ConversionPattern=%d [%t](%F:%L) %-5p %x - %m%n

# F1 is set to be a RollingFileAppender that uses PatternLayout, add F1 
to the desired categories to enable file trace
log4j.appender.F1=org.apache.log4j.RollingFileAppender
log4j.appender.F1.layout=org.apache.log4j.PatternLayout
log4j.appender.F1.layout.ConversionPattern=%p %t %c - %m%n
log4j.appender.F1.File=epd.log
log4j.appender.F1.MaxFileSize=100KB
log4j.appender.F1.MaxBackupIndex=1

log4j.category.org=DEBUG,A1,F1




-- 
-Torgeir


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to