Double log output from commons-logging with log4j

2003-06-19 Thread Markus Holzem
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


AW: Double log output from commons-logging with log4j

2003-06-19 Thread Kroeger, Joerg
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]



Re: AW: Double log output from commons-logging with log4j

2003-06-19 Thread Markus Holzem
No, it is really the same, even the same timestamp:

...

[Servlet.Engine.Transports:10] (18:07:45,802) 
apache.struts.action.RequestProcessor.processActionCreate -   Creating 
new Action instance

[Servlet.Engine.Transports:10] (18:07:45,802) 
apache.struts.action.RequestProcessor.processActionCreate -   Creating 
new Action instance

LogonAction::execute called

[Servlet.Engine.Transports:10] (18:07:46,142) 
app.control.LogonAction.execute - User A123456 logged on

[Servlet.Engine.Transports:10] (18:07:46,142) 
app.control.LogonAction.execute - User A123456 logged on

...

Kroeger, Joerg wrote:

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]





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


Re: AW: Double log output from commons-logging with log4j

2003-06-19 Thread amr

You are assigning your console appender twice.
  log4j.rootLogger=WARN,Console
  log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console
  log4j.logger.app=DEBUG,Console

log4j.logger.app will inherit the appender from rootLogger, so you can just
do
log4j.rootLogger=WARN,Console
log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console
log4j.logger.app=DEBUG

and that should take care of your extra messages.



   

  Markus Holzem

  [EMAIL PROTECTED]To:   Struts Users Mailing List 
[EMAIL PROTECTED]
  cc: 

   Subject:  Re: AW: Double log output 
from commons-logging with log4j 
  06/19/2003 12:11 

  PM   

  Please respond to

  Struts Users

  Mailing List

   

   





No, it is really the same, even the same timestamp:

...

[Servlet.Engine.Transports:10] (18:07:45,802)
apache.struts.action.RequestProcessor.processActionCreate -   Creating
new Action instance

[Servlet.Engine.Transports:10] (18:07:45,802)
apache.struts.action.RequestProcessor.processActionCreate -   Creating
new Action instance

LogonAction::execute called

[Servlet.Engine.Transports:10] (18:07:46,142)
app.control.LogonAction.execute - User A123456 logged on

[Servlet.Engine.Transports:10] (18:07:46,142)
app.control.LogonAction.execute - User A123456 logged on

...

Kroeger, Joerg wrote:

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

Re: AW: Double log output from commons-logging with log4j

2003-06-19 Thread Markus Holzem
Thanks!

[EMAIL PROTECTED] wrote:

You are assigning your console appender twice.
 

log4j.rootLogger=WARN,Console
log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console
log4j.logger.app=DEBUG,Console
   

log4j.logger.app will inherit the appender from rootLogger, so you can just
do
log4j.rootLogger=WARN,Console
log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console
log4j.logger.app=DEBUG
and that should take care of your extra messages.



  
 Markus Holzem
 [EMAIL PROTECTED]To:   Struts Users Mailing List [EMAIL PROTECTED]
 cc: 
  Subject:  Re: AW: Double log output from commons-logging with log4j 
 06/19/2003 12:11 
 PM   
 Please respond to
 Struts Users
 Mailing List
  
  



No, it is really the same, even the same timestamp:

...

[Servlet.Engine.Transports:10] (18:07:45,802)
apache.struts.action.RequestProcessor.processActionCreate -   Creating
new Action instance
[Servlet.Engine.Transports:10] (18:07:45,802)
apache.struts.action.RequestProcessor.processActionCreate -   Creating
new Action instance
LogonAction::execute called

[Servlet.Engine.Transports:10] (18:07:46,142)
app.control.LogonAction.execute - User A123456 logged on
[Servlet.Engine.Transports:10] (18:07:46,142)
app.control.LogonAction.execute - User A123456 logged on
...

Kroeger, Joerg wrote:

 

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