tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter lin <peter....@labs.gte.com>
Subject Re: tricky question
Date Thu, 17 Oct 2002 14:12:52 GMT

Awesome!  thanks for the tip remy.  that did it.  for those who need to
do the same thing, in your custom error jsp, add the following code to
log the exception.

<%
Throwable tw = (Throwable)pageContext.findAttribute("Throwable");
if (tw != null ) {
  exception = tw;
}
try {
  exception.printStackTrace(new java.io.PrintWriter(out));
}catch (Exception e) {
  out.println("no exception");
}
%>

peter



Remy Maucherat wrote:
> 
> peter lin wrote:
> 
> > I'm hoping others have done this, since I can't think of a way.
> >
> > I modified my web.xml to redirect nullpointerexception and jspexception
> > to my own error page, but I still want to log the exception to the
> > localhost_log. I made test pages to purposely cause nullpointer and jsp
> > exceptions. so far it's good. When the request gets logged in access log
> > the status code is 200. No log in localhost_log appears.
> >
> > I don't see any way in the request/response API to get the stacktrace.
> >
> > Is this even possible?
> 
> You can get the Throwable from the atribute, and then use
> Throwable.printStackTrace(PrintStream).
> I think that's what you want, right ?
> 
> Remy
> 
> --
> To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message