For myself, I created a Log4jPluginAction:
/** * @version 1.0 * @author */ public class Log4jPluginAction implements PlugIn {
public void init(ActionServlet actionServlet, ModuleConfig config)
throws ServletException {
//BasicConfigurator.configure();
String realPath = actionServlet.getServletContext().getRealPath(".");
DOMConfigurator.configure(realPath + "/WEB-INF/classes/log4j.xml");
}
public void destroy() {
} }
Plugins are guaranteed to be executed before any of your other code, so its perfect for initializing log4j.
You have to define this plugin in your Web Deployment Descriptor. The log4j.xml file is in the root of my
Java Resources directory. (i'm on wsad, so things may be slightly different in terminology)
Geeta Ramani wrote:
Already did that: that's how the Java app worked ok I guess.. But cannot seem to amke it work for my struts app..(:( But thanks for the reply! Any other suggestions?
-----Original Message----- From: Mike Zatko [mailto:[EMAIL PROTECTED] Sent: Friday, April 23, 2004 3:24 PM To: Struts Users Mailing List Subject: Re: [OT - OT - Friday!!] Eclipse, Struts app and log4j
1. Right click project -> Properties 2. Select Java Build Path 3. Click Libraries Tab 4. Add Log4j jar
Geeta Ramani wrote:
Hello all:work was a piece of cake. Throw the jar in the classpath, put the log4j.properties in WEB-INF/classes, restart tomcat and bob's your uncle.
I have always worked with Sun Studio One and making log4j
However the company i work for now uses eclipse and Iassumed (wrongly as it turns out) that I could integrate log4j easily into this IDE too. *Wrong!!*. I have googled till I'm going cross-eyed. One person suggested I create a log4j plug-in. Another suggested I create a Log4jInit servlet. But I can't help thinking "Come **on**, can it be that involved??!!"
So folks, if you've successfully solved this problem, makemy day, will ya? In words of two syllables or less, please - my brain's fried already..(:(
a main method and all) to talk to log4j within eclipse and no, it did not invlove writing servlets and plugins and what not. My problems arise when I try to get my *Struts app* to recognize log4j. (hey, maybe this makes it on-topic after all!! ;))Many thanks in advance! Geeta
P.S Btw, I did manage to create a Java **application** (with
P.P.S. Oh yeah, I guess it may help to show you the error Iget. Here it is:
--log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester). log4j:WARN Please initialize the log4j system properly.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Michael H. Zatko WebSphere Developer Boscov's Information Services Work: 610-929-7317 Home: 610-562-2407
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Michael H. Zatko WebSphere Developer Boscov's Information Services Work: 610-929-7317 Home: 610-562-2407
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]