I am new to using log4j and am getting the standard error "log4j:ERROR No appenders could be found for category (Actions). log4j:ERROR Please initialize the log4j system properly." I don't know if this means that Tomcat, Struts, or the Application (Chiki) is not initialized properly. The manual has the following for Tomcat, and I don't know if I should immediately get into that. Could someone kick me to the right place to start? I did not have this problem with Tomcat 4.1.12, so I assume this is some difference in Tomcat 4.1.18. However, the error seems to be related to Struts actions, so I am not sure where to start. Thanks for any assistance, which I don't really expect, since I have asked this question before and have not gotten an answer.



package com.foo;

import org.apache.log4j.PropertyConfigurator;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.io.IOException;

public class Log4jInit extends HttpServlet {

public
void init() {
String prefix = getServletContext().getRealPath("/");
String file = getInitParameter("log4j-init-file");
// if the log4j-init-file is not set, then no point in trying
if(file != null) {
PropertyConfigurator.configure(prefix+file);
}
}

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

Define the following servlet in the web.xml file for your web-application.


<servlet>
<servlet-name>log4j-init</servlet-name>
<servlet-class>com.foo.Log4jInit</servlet-class>

<init-param>
<param-name>log4j-init-file</param-name>
<param-value>WEB-INF/classes/log4j.lcf</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>




LEGAL NOTICE

This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you


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

Reply via email to