Try to expand your logging output to ensure it is only one thread working on
that request:
log4j.appender.Console.layout.ConversionPattern=[%t] (%d{HH:mm:ss,SSS})
%C{4}.%M - %m%n

-----Ursprüngliche Nachricht-----
Von: Markus Holzem [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 19. Juni 2003 16:21
An: Struts Users Mailing List
Betreff: Double log output from commons-logging with log4j


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.Log4jF
actory

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to