You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matthew Lehrian <ml...@crosscurrent.com> on 2002/07/16 22:19:55 UTC

Help with enabling Struts logging

Hello,

Please forgive what I believe to be a newbie question.  I tried RTFM and 
the RTFMLA (mailing list archives).  I dunno, maybe my brain isn't 
functioning at the moment.  Anyway.  I have a simple Tomcat 4.0.4 
installation with Struts 1.1b1.  I haven't done anything to the logging 
configuration.  I would like the lines:

	if (log.isDebugEnabled()) {...

to return true and the for results of the lines:

	log.debug("...

to get print to System.out.

I can't for the life of me figure out how to enable debugging for 
Struts.  Please HELP!

Thanks!
Matthew



     protected ActionForm processActionForm(HttpServletRequest request,
                                            HttpServletResponse response,
                                            ActionMapping mapping) {

         // Create (if necessary a form bean to use
         ActionForm instance = RequestUtils.createActionForm
             (request, mapping, appConfig, servlet);
         if (instance == null) {
             return (null);
         }

         // Store the new instance in the appropriate scope
         if (log.isDebugEnabled()) {
             log.debug(" Storing ActionForm bean instance in scope '" +
                 mapping.getScope() + "' under attribute key '" +
                 mapping.getAttribute() + "'");
         }
         if ("request".equals(mapping.getScope())) {
             request.setAttribute(mapping.getAttribute(), instance);
         } else {
             HttpSession session = request.getSession();
             session.setAttribute(mapping.getAttribute(), instance);
         }
         return (instance);

     }


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help with enabling Struts logging

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 16 Jul 2002, Matthew Lehrian wrote:

> Date: Tue, 16 Jul 2002 16:19:55 -0400
> From: Matthew Lehrian <ml...@crosscurrent.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts List <st...@jakarta.apache.org>
> Subject: Help with enabling Struts logging
>
> Hello,
>
> Please forgive what I believe to be a newbie question.  I tried RTFM and
> the RTFMLA (mailing list archives).  I dunno, maybe my brain isn't
> functioning at the moment.  Anyway.  I have a simple Tomcat 4.0.4
> installation with Struts 1.1b1.  I haven't done anything to the logging
> configuration.  I would like the lines:
>
> 	if (log.isDebugEnabled()) {...
>
> to return true and the for results of the lines:
>
> 	log.debug("...
>
> to get print to System.out.
>
> I can't for the life of me figure out how to enable debugging for
> Struts.  Please HELP!
>

Struts 1.1 uses the commons-logging package as a logging wrapper.
Configuring it (or, more properly, configuring how it uses your underlying
logging implementation) is documented on the Package Documentation page of
the org.apache.commons.logging package, available online at:

  http://jakarta.apache.org/commons/logging/api/

The convention in Struts (and many other packages) is to use the fully
qualified name of the class as the name of the logger to be written to.
Thus, you can turn on debug level logging for all of Struts internal
components by setting the logging level for "org.apache.struts", or be
more specific if you need to (org.apache.struts.action.RequestProcessor).

> Thanks!
> Matthew

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help with enabling Struts logging

Posted by Chuck Cavaness <ch...@attbi.com>.
My chapter on Logging with Struts Applications should be posted on 
theserverside.com tonight or tomorrow. When it shows up, download it and 
read it and see if it helps. That will be a good test on how effective it 
is. Any feedback you can provide will be very helpful.

You can find it (when it's actually posted) here: 
http://www.theserverside.com/resources/strutsreview.jsp

Chuck


At 04:19 PM 7/16/2002 -0400, you wrote:
>Hello,
>
>Please forgive what I believe to be a newbie question.  I tried RTFM and 
>the RTFMLA (mailing list archives).  I dunno, maybe my brain isn't 
>functioning at the moment.  Anyway.  I have a simple Tomcat 4.0.4 
>installation with Struts 1.1b1.  I haven't done anything to the logging 
>configuration.  I would like the lines:
>
>         if (log.isDebugEnabled()) {...
>
>to return true and the for results of the lines:
>
>         log.debug("...
>
>to get print to System.out.
>
>I can't for the life of me figure out how to enable debugging for 
>Struts.  Please HELP!
>
>Thanks!
>Matthew
>
>
>
>     protected ActionForm processActionForm(HttpServletRequest request,
>                                            HttpServletResponse response,
>                                            ActionMapping mapping) {
>
>         // Create (if necessary a form bean to use
>         ActionForm instance = RequestUtils.createActionForm
>             (request, mapping, appConfig, servlet);
>         if (instance == null) {
>             return (null);
>         }
>
>         // Store the new instance in the appropriate scope
>         if (log.isDebugEnabled()) {
>             log.debug(" Storing ActionForm bean instance in scope '" +
>                 mapping.getScope() + "' under attribute key '" +
>                 mapping.getAttribute() + "'");
>         }
>         if ("request".equals(mapping.getScope())) {
>             request.setAttribute(mapping.getAttribute(), instance);
>         } else {
>             HttpSession session = request.getSession();
>             session.setAttribute(mapping.getAttribute(), instance);
>         }
>         return (instance);
>
>     }
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>