Fabien,
Just a follow-up to my previous email.
I was able to get the calling URI of the page that caused the exception
along with the time of the exception to be stored in the application log of
Tomcat (or your webapp).
In my error page (error.jsp) I put:

<% // Log the calling URL to the log file.  All other info about the
exception is logged automatically.
application.log("Exception occured on page-> " + (String)
request.getAttribute("javax.servlet.error.request_uri"), exception);
%>

This placed the calling URI and date/time in my log file as shown:

2001-11-17 01:14:26 Exception occured on page-> /rfq/inqtableman.jsp
java.sql.SQLException: Error during query: Unexpected Exception:
java.sql.SQLException message given: Column not found: Unknown column
'inqmain.inqNumberZZZ' in 'order clause'
 at org.gjt.mm.mysql.Connection.execSQL(Connection.java:807)
 at org.gjt.mm.mysql.Connection.execSQL(Connection.java:740)
 at org.gjt.mm.mysql.Statement.executeQuery(Statement.java:159) . . . . . .
. (much more information written by Tomcat)

The above example is for an SQL exception, and you must have the exception
and error page defined in the web.xml file of your web application.
I did not need the code in the calling page that I wrote in the previous
email.
BTW I am using Tomcat 4.0, W2K

Hope this helps,
Barry

----- Original Message -----
From: "Barry White" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, November 16, 2001 3:17 PM
Subject: Re: error-page usage in web.xml


> Yes are correct in stating that the 404 error is not an exception... it is
> simply file not found error and must be handled seperatly from exception
> errors.
> I am currently exploring the exception error handling/page myself.
> You can get the URL of the page as follows:
>
> In the page you have the error, you put:
> <% request.setAttribute("sourcePage", request.getRequestURI()); %>
>
> then in your exception error page defined in web.xml (JSP) you get the URI
> by:
> <% request.getAttribute("sourcePage"); %>
>
> You would usually write the error URL in your log file for debugging
allong
> with the rest of the exception info.
>
> There are probably many beans available on the web that will do this quit
> nicely, but where is the fun in that?
> :)
> Barry
>
>
> ----- Original Message -----
> From: "Fabien Modoux" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, November 16, 2001 11:32 AM
> Subject: error-page usage in web.xml
>
>
> > Hello,
> >
> > I am having trouble understanding how to properly configure
> > the error-page section of my web.xml. I found some previous
> > posts, but could not find enough information.
> >
> > There are two types of error-page element: exception-type and
> > error-code. Are those complimentary -- i.e., they must both be
> > defined to handle all errors -- or is there some sort of overlap?
> > I did a few tests and I don't think 404 cannot be handled as an
> > exception, only with the error-code element. However I am
> > wondering about the difference between error-code 500 and
> > exception-type java.lang.Throwable, which one is the most general
> > one?
> >
> > I've also seen a post (#33290) saying that
> >
> > > Within the page, you can access (among others) the following request
> > > attribute created by the container:
> > >
> > >   <%
> > >     String requestURI = (String)
> > >      request.getAttribute("javax.servlet.error.request_uri");
> > >   %>
> >
> > I am using TC3.2.2 and the attribute has the value of the error
> > handler page, not of the page that created the error. Is the possible
> > to get the latter info?
> >
> > Thanks for your help,
> >
> > -Fabien
> >
> > ---------------------------------------------
> > Fabien Modoux,
> > Voicemate - http://www.voicemate.com
> >
> > --
> > To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> > For additional commands: <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to