Thanks. You wouldn't mind telling where the output goes? Is it going to
STDOUT?

-----Original Message-----
From: David Friedman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 01, 2004 5:12 PM
To: Struts Users Mailing List
Subject: RE: form validation (How to setup commons-logging to debug)

Jim said it well by writing:
> com.yourcompany.youraplication.package1.yourclass
> The FQN of the class you want to debug.

But, I'm feeling wordy today (day off) so I'll explain even more.... (yap
yap yap, yeah, I know ... I'll be quiet after today ends)

............

By SOMECLASS or SOMEPACKAGE, I mean the names of your packages and classes.
If your class java file is named com.leung.struts.ExampleAction.java, then
the package is com.leung.struts.  The code to turn the logging level to
"debug" for the package would be:

org.apache.commons.logging.simplelog.log.com.leung.struts=debug

The code to turn the logging level to "warn" only for the ExampleAction java
class mentioned above would be:

org.apache.commons.logging.simplelog.log.com.leung.struts.ExampleAction=warn

Next, you might ask, why would I do different levels for the package and a
class within that package?  Well, some people want logging off in the
package but on for a particular class.  Others might want the reverse: A
package might have 10 classes in it, you could want logging turned on for 8
of them, so you turn logging on for the package but off for the two classes
you aren't interested in seeing display logging information.

Regards,
David

P.S. I guess it's now "Hey Jim, [STRUTS] Tag, you're it!"

-----Original Message-----
From: Leung, Albert [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 01, 2004 5:03 PM
To: Struts Users Mailing List
Subject: RE: form validation (How to setup commons-logging to debug)


I'm sorry. I've check the documentation at the Jakarta site and I still
don't know what you mean by
org.apache.commons.logging.simplelog.log.SOMECLASS=LEVEL

What is the SOMECLASS?

-----Original Message-----
From: David Friedman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 01, 2004 4:23 PM
To: Struts Users Mailing List
Subject: RE: form validation (How to setup commons-logging to debug)

I haven't done this (manually - I've been copying my blank setup) in a
while, but the basic steps are:

a) Make sure you have a commons-logging jar in WEB-INF/lib
I use commons-logging-1.0.3.jar (Struts v1.1) [Note: there is now a 1.0.4
version at http://jakarta.apache.org/commons

b) Create the file for commons-logging.properties file in WEB-INF/classes
and specify a logging service.  I use the included SimpleLog though some
people prefer log4j.  My commons-logging.properties file is:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
org.apache.commons.logging.simplelog.defaultlog=debug
org.apache.commons.logging.simplelog.showlogname=true
org.apache.commons.logging.simplelog.showdatetime=true

c) Create the properties file for the service you are using.  I use
SimpleLog so I setup the file WEB-INF/classes/simplelog.properties with
contents following one of these two patterns:
org.apache.commons.logging.simplelog.log.SOMECLASS=LEVEL
org.apache.commons.logging.simplelog.log.SOMEPACKAGE=LEVEL

The available levels are described at:
http://jakarta.apache.org/commons/logging/commons-logging-1.0.3/docs/api/org
/apache/commons/logging/Log.html,

trace (the least serious)
debug
info
warn
error
fatal (the most serious)
none (I use this to turn of logging for a class or package)

If you want all packages under the package com.leung.struts to log debug
information, you can include the line:
org.apache.commons.logging.simplelog.log.com.leung.struts=debug

If you want only the package com.leung.struts.actions.ExampleAction to trace
every possible action, you could include the line:
org.apache.commons.logging.simplelog.log.com.leung.actions.ExampleAction=tra
ce

If you want all validation information messages, you could include the line:
org.apache.commons.logging.simplelog.log.org.apache.struts.validator=info

d) Add the appropriate log lines in your Action subclass to there is
something to read in the logs.

d.1) The class must define a logging facility such as:
private Log log = LogFactory.getLog(this.getClass());

d.2) The class must use log.debug(), log.trace(), log.warn(), log.error(),
etc. as appropriate.  Some people prefer to use the log.isDebug() method
before deciding to invoke log.debug(String someTextStatusMessage) or the
appropriate log.isWHATEVER() for the other logging levels.

REMEMBER! If you don't put debug statements in the code, the logging
facility won't have anything to show you.

Also, I believe that if you have a log level of "info" all less serious
levels, in this case "debug" should show up in your log file.

I hope this helps.

Regards,
David

-----Original Message-----
From: Leung, Albert [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 01, 2004 3:41 PM
To: Struts Users Mailing List
Subject: RE: form validation


David,

I've checked everything thoroughly. I've eliminated spelling errors and
missing references. It would be a great help if you could show me how to
turn on debugging and commons logging.

Regards,

Albert

-----Original Message-----
From: David Friedman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 01, 2004 3:35 PM
To: Struts Users Mailing List
Subject: RE: form validation

Albert,

When all that is correctly setup, I've only ever had problems with a
misspelled forward inside my action or missing JSP/html/other pages. I've
had a blank page show up when the forward was "intup" and I meant "input".
Have you checked the code in your action?

Have you turned on the logging features or commons logging for further
details even up to the debug level?

Regards,
David

-----Original Message-----
From: Leung, Albert [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 01, 2004 3:26 PM
To: Struts Users Mailing List
Subject: RE: form validation


It definitely exists. The action definition, the input forms, form beans
definition, validation entries are exactly the same in both projects.

-----Original Message-----
From: Bill Siggelkow [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 01, 2004 3:14 PM
To: [EMAIL PROTECTED]
Subject: Re: form validation

Leung, Albert wrote:

> For some reason I can't get form validation to work for a particular
> project. If I take the same ValidatorForm, use the same validation entry
in
> formset, and update the struts-config to use the same form bean and action
> it works fine in another project. The project that has problems just gives
> me a blank page whenever it finds something wrong. There is no stack trace
> or log that can tell me what could be wrong.
>
>
>
> Please help!
>
>
>
> Albert
>
>
This can happen if the page specified by the "input" attribute does not
exist.


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

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


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