Re: common-logging, Struts, Log4j

2003-06-26 Thread Markus Holzem
By default the property-files
 commons-logging.properties
 log4j.properties
are located in the directory WEB-INF/classes
Usually you put them in your workbench in the root of the Java Source 
directory. If you build with ant you simply copy them there from your 
chosen source directory

Markus

rablists wrote:

Hi. I have problem in using the common-logging with struts and 
Log4j. I am basically lost. I  have short questions, I appreciate if 
anyone can help me little bit. these are the questions with examples:

The file outputfile.log that I specify in 
log4j.appender.LOGFILE.File=outputfile.log where it is located? 
where I find it? is it physical file?

I dont know why my configuration is not working, although I put the 
following files in the classpath WEB-INF/classes/org/myclasses/:

commons-logging.properties:
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL
ogger
log4j.properties:
log4j.rootLogger=DEBUG, rolling
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%
n
log4j.appender.rolling=org.apache.log4j.RollingFileAppender
log4j.appender.rolling.File=outputfile.log
log4j.appender.rolling.MaxFileSize=100KB
log4j.appender.rolling.MaxBackupIndex=1
log4j.appender.rolling.layout=org.apache.log4j.PatternLayout
log4j.appender.rolling.layout.ConversionPattern=%d{ABSOLUTE} - %p %
c - %m%n
What else should I specify, or configure to make it to work? I have 
log4j-1.2.4.jar in my WEB-INF/lib/

Should I set any system propreties? or web.xml? or struts-config? 

In my classes I am doing that:
 protected static final org.apache.commons.logging.Log log = 
org.apache.commons.logging.LogFactory.getLog(this.class);

   if (log.isDebugEnabled()) 
 log.debug(getMessage( + locale + , + key + ));

(How can I enable/disable the Debug or Trace?)

Thank you in advance. I am really stuck and I couldnt make it to 
work. I am using tomcat 4.18

Rabih



-
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: Validator problem with integers

2003-06-19 Thread Markus Holzem
Hi Brad,

use mask instead of integer. That should do the job. Error message 
states, that the entry is invalid. BTW, arg1 has to be used both for 
minlength and maxlength since {1} is the argument in the error message.

I found that mask can solve nearly all validation problems if they are 
constrained to one field. If you have interdependent fields you still 
have to go back and implement ActionForm::validate.

field property=dayPhone3 depends=required,mask,minlength,maxlength
 arg0 key=Daytime Phone box 3 resource=false/
 arg1 name=minlength key=${var:minlength} resource=false /
 arg1 name=maxlength key=${var:maxlength} resource=false /
   var
 var-namemask/var-name
 var-value^[0-9]*$/var-value
   /var
   var
 var-nameminlength/var-name
 var-value4/var-value
   /var
   var
 var-namemaxlength/var-name
 var-value4/var-value
   /var
 /field
Markus

Brad Plies wrote:

Hi folks,

Using struts-RC2, when using Validator with a dependency
on integer validation, I have a problem with the validator
assuming that any integer starting with zero 0 is
necessarily octal.  In one example, I have a form where
people enter phone numbers.  Which is split up into 3 text
boxes.  Area code, 3 digits, last 4 digits.  A fairly common
way to break it up.
Here is the validation.xml entry for one such field:

field
  property=dayPhone3
  depends=required, integer, minlength, maxlength
  arg0 key=Daytime Phone box 3 resource=false/
  arg1 name=minlength key=${var:minlength} resource=false/
  arg2 name=maxlength key=${var:maxlength} resource=false/
  var
var-namemaxlength/var-name
var-value4/var-value
  /var
  var
var-nameminlength/var-name
var-value4/var-value
  /var
/field
Numbers like 0897 will cause the ... must be an integer message.
Obviously it is not a valid octal number, and I know that the format
of these numbers would appear as an attempt at an octal number.
How do you prevent octal interpretation but still ensure that
the field is numeric?  I'm being a tad lazy here, because I
know I could always write my own pluggable validator, but
I'd like to use what already exists if possible.


-
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]


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]


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 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

Re: Singletons in Tomcat

2003-06-06 Thread Markus Holzem
I usually story Singletons in the ServletContext which is unique for
an application. I often think that ServletContext should be better
named ApplicationContext because that is actually what it represents.
I don't feel comfortable to leave Singletons hanging around on static.
variables. The benefit of ServletContext is, that you can easily
participate on the lifecycle of the ServletContext
(ServletContextListener::contextInitialized and ~::contextDestroyed)
and take appropriate actions when your Singleton acquires any system
resources.
Markus

Brian Kidney wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
If I have a class in my application which is a singleton, is there only one object per server (Tomcat in my case), or is it unique to the session (ie. each user gets a different instance)?

Brian

-BEGIN PGP SIGNATURE-
Version: PGP 8.0
iQA/AwUBPt92MuLP0vXx30WgEQKtFQCfX4gkSYSwqx9+Zij4IfQU9DxA6L4An2gY
hUqwLgvXo/4W5scinkxmIF7j
=Osto
-END PGP SIGNATURE-


-
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]


Struts 1.1 on z/OS with WebSphere Application Server 4.0

2003-06-04 Thread Markus Holzem
Does anyone have experiences with Struts running on an IBM mainframe?
I'm particularly interested in WebSphere 4.0 (z/OS, *not* z/Linux).
I've tried to find anything in the archive, but I only found
references on WebSphere running on Wintel, Linux or Solaris. Since
WebSphere on z/OS is only 99.9% compatible to the other platforms
I'm a bit anxious about giving it a try.
I'd be very much obliged, if anyone could give some hints for running
Struts 1.1 on this platform.
Markus



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