Hi,
I have used option two.
The code for my servlet is below. It works for me. If you have any
suggestions, enhancements please send me a note.
Alex
package com.sirius.struts.action;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.log4j.*;
public class
Thanks, gentlemen. I start to get the idea but am still fuzzy on how to
issue logging requests in my custom Action classes. Do I have to
declare a static Category variable in each and every Action class I
write? Please share some code on how logging is actually done, now that
I know how to set
{
log.debug(exit mymethod);
}
}
}
Dave
-Original Message-
From: Eric L. Ma [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 16 January 2002 3:58 p.m.
To: 'Struts Users Mailing List'
Subject: RE: How to use Log4j with a startup logging servlet
Thanks, gentlemen. I start to get
I use method 2, but it doesn't require a call into that servlet. I just use
it to initialize log4j. After this servlet loads, I just call log4j object
methods, and it works. I believe (someone correct me if I'm wrong) that the
servlet loads in the same JVM, so you have access to its objects in
Hi,
I use Log4J, but don't understand your question exactly. I think it's
easier than you think;-)
In my action classes and servlets and so on I have the usual line:
static Category cat = Category.getInstance( SuchAction.class.getName() );
in web.xml I have:
servlet
If you're using Tomcat 4.0.x then the documentation shows how to use a
servlet to configure Log4J. Essentially you create a normal servlet, slap it
in your web.xml and configure it to load on startup.
I do this in all my web apps and also use the same method to init Velocity.
Here's a sample
6 matches
Mail list logo