You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul Benedict <pb...@apache.org> on 2007/08/02 06:05:44 UTC
Re: Exception Handling and Logging
My applications do not catch any errors. I let them bubble out of the
Action and into an ExceptionHandler object for logging. You can log
whatever you want -- including the user -- in the handler.
Paul
Richard Sayre wrote:
> After reading the Mail Reader walk through, it would seem the best
> practice for handling exceptions is throwing them back to your Action
> and having a result mapped to handle each specific exception.
>
> Is this the best way to do this?
>
> If I use this method how can I log the stack of each exception that
> was thrown? I know there is a logging interceptor but I have not
> found any docs on how to use it. I would like to make an error log of
> everything that happens in the application. Is it possible to log
> other information with the Exception such as the current user?
>
> Thank you,
>
> Rich
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Exception Handling and Logging
Posted by Richard Sayre <ri...@gmail.com>.
In my interceptor stack i added this parameter:
<interceptor-ref name="exception">
<param name="logEnabled">true</param>
</interceptor-ref>
I assume it is using either commons logging or log4j but I'm not sure
where the log file is or how to manipulate what information goes into
the log file.
On 8/6/07, Dave Newton <ne...@yahoo.com> wrote:
> --- Richard Sayre <ri...@gmail.com> wrote:
> > Do I open a file stream on the JSP page or is there
> a
> > better way to log this information?
>
> Use commons-logging and / or Log4J?
>
> d.
>
>
>
>
> ____________________________________________________________________________________
> Need a vacation? Get great deals
> to amazing places on Yahoo! Travel.
> http://travel.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Exception Handling and Logging
Posted by Dave Newton <ne...@yahoo.com>.
--- Richard Sayre <ri...@gmail.com> wrote:
> Do I open a file stream on the JSP page or is there
a
> better way to log this information?
Use commons-logging and / or Log4J?
d.
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Exception Handling and Logging
Posted by Richard Sayre <ri...@gmail.com>.
I set up my application to throw the Exceptions back and I am using
Exception mapping to redirect the user to an error page. The error
page displays the exception and stack trace. How do I log this to a
file instead? Do I open a file stream on the JSP page or is there a
better way to log this information?
On 8/2/07, Paul Benedict <pb...@apache.org> wrote:
> My applications do not catch any errors. I let them bubble out of the
> Action and into an ExceptionHandler object for logging. You can log
> whatever you want -- including the user -- in the handler.
>
> Paul
>
> Richard Sayre wrote:
> > After reading the Mail Reader walk through, it would seem the best
> > practice for handling exceptions is throwing them back to your Action
> > and having a result mapped to handle each specific exception.
> >
> > Is this the best way to do this?
> >
> > If I use this method how can I log the stack of each exception that
> > was thrown? I know there is a logging interceptor but I have not
> > found any docs on how to use it. I would like to make an error log of
> > everything that happens in the application. Is it possible to log
> > other information with the Exception such as the current user?
> >
> > Thank you,
> >
> > Rich
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Exception Handling and Logging
Posted by Richard Sayre <ri...@gmail.com>.
Hi Paul,
I know its been a while but I am now trying to log my exceptions.
Previously I was redirecting to a JSP and outputting the error. A
requirement has come up where the client does not want the user seeing
any stack traces etc. So I want to log the exception in the action
and then redirect to a generic error page.
I have the exception results and the exception mapping set up. I was
wondering what is the best way to log this. Right now I have my
Exception result directing to an action which calls my log class. The
problem is a can not seem to get the exceptionStack passed into this
action so I can not log all of the information.
Any ideas?
Thanks
Rich
On 8/2/07, Paul Benedict <pb...@apache.org> wrote:
> My applications do not catch any errors. I let them bubble out of the
> Action and into an ExceptionHandler object for logging. You can log
> whatever you want -- including the user -- in the handler.
>
> Paul
>
> Richard Sayre wrote:
> > After reading the Mail Reader walk through, it would seem the best
> > practice for handling exceptions is throwing them back to your Action
> > and having a result mapped to handle each specific exception.
> >
> > Is this the best way to do this?
> >
> > If I use this method how can I log the stack of each exception that
> > was thrown? I know there is a logging interceptor but I have not
> > found any docs on how to use it. I would like to make an error log of
> > everything that happens in the application. Is it possible to log
> > other information with the Exception such as the current user?
> >
> > Thank you,
> >
> > Rich
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org