I just create a class that wraps the log statements and would have a function like this:
public static void debug(String message, String aCategory) { Category cat = Category.getInstance(aCategory); cat.debug(message); } then when I need to use this I would call something like: MyLogger.debug("Message", this.getClass().getName()); Hope that helps. ----- Original Message ----- From: "Mike Jasnowski" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Friday, August 22, 2003 8:33 AM Subject: RE: Generating logs w/Log4J in ActionClass > Sorry, this is with commons logging not log4j specifically > > -----Original Message----- > From: Mike Jasnowski [mailto:[EMAIL PROTECTED] > Sent: Friday, August 22, 2003 9:29 AM > To: Struts Users Mailing List > Subject: RE: Generating logs w/Log4J in ActionClass > > > In your action class, retrieve your log instance > > Log LOG = LogFactory.getLog(YourAction.class); > > Then wherever you need to log: > > if (LOG.isDebugEnabled()) { > LOG.debug("Log your debug msg here"); > } > > Replace isDebugEnabled() with whatever level you want to use. > > HTH, > Mike J > > -----Original Message----- > From: Kapadia Mitesh-C23457 [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 21, 2003 11:55 AM > To: [EMAIL PROTECTED] > Subject: Generating logs w/Log4J in ActionClass > > > I have the appropriate configurations completed to use Log4J w/Tomcat. > However, how would I invoke Log4J from within my action class to generate > DEBUG statements? > I have the following package imported: > import org.apache.log4j.*; > Any examples would be most appreciated. > Thanks in advance. > - Mitesh > > > --------------------------------------------------------------------- > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]