struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Holzem <mar...@holzem.de>
Subject Double log output from commons-logging with log4j
Date Thu, 19 Jun 2003 14:21:06 GMT
Hi folks,

I'm hunting for some time the cause, why I get double output lines from 
log...

My LogonForm::execute looks similar to:

    public ActionForward execute(
        ActionMapping mapping,
        ActionForm form,
        HttpServletRequest request,
        HttpServletResponse response)
        throws Exception
    {
        System.out.println("LogonAction::execute called");
        // Obtain username and password from web tier
        LogonForm logonForm = (LogonForm) form;
        String userid = logonForm.getUserid()
        //....
        Log log = LogFactory.getLog(this.getClass());
        if (log.isDebugEnabled())
        {
            log.debug("User "+userid+" logged on");
        }
        // Return success
        return (mapping.findForward(Constants.SUCCESS));
    }

The output I get is:

  ...
  [DEBUG] org.apache.struts.action.RequestProcessor -   Creating new 
Action instance
  [DEBUG] org.apache.struts.action.RequestProcessor -   Creating new 
Action instance
  LogonAction::execute called
  [DEBUG] app.control.LogonAction - User A123456 logged on
  [DEBUG] app.control.LogonAction - User A123456 logged on
  ...

Since I get "LogonAction::execute called" only once I'm pretty sure that 
execute is only called once. I think it has probably to do with my 
commons-logging.properties or log4j.properties, but I really can't spot 
what I'm doing wrong:

commons-logging.properties:
  
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory

log4j.properties:
  # Logger catogory (DEBUG < INFO < WARN < ERROR < FATAL)
  log4j.rootLogger=WARN,Console
  log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console
  log4j.logger.app=DEBUG,Console
  # Appender Console
  # Pattern: level, category, message
  log4j.appender.Console=org.apache.log4j.ConsoleAppender
  log4j.appender.Console.layout=org.apache.log4j.PatternLayout
  log4j.appender.Console.layout.ConversionPattern=[%-5p] %c - %m

Both are stored in the WEB-INF/classes directory.

Can anybody give me a hint?

Thanks, Markus



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message