You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Markus Holzem <ma...@holzem.de> on 2003/06/19 16:21:06 UTC
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.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