Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

error-page with exception-type still causes log message with level=ERROR

Simon Kitching

2007-01-31


Hi All,

I would like to have my servlet throw an exception when a certain
problem occurs, and use an error-page definition to display an
appropriate error page:

<error-page>
<exception-type>
 au.com.nti.tns.workbench.error.WebappInternalError
</exception-type>
<location>/my_error_page.jsp</location>
</error-page>


This works fine. However I get an ERROR-level log message for each
exception thrown:

2007-01-31 17:48:01,875 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/workbench].[proxy]]
  Servlet.service() for servlet proxy threw exception
au.com.nti.tns.workbench.error.WebappInternalError
 at
au.com.nti.tns.workbench.sitemesh.SiteMeshProxyServlet.execute(SiteMeshProxyServlet.java:168)
 at
au.com.nti.tns.workbench.sitemesh.SiteMeshProxyServlet.doGet(SiteMeshProxyServlet.java:67)
 at javax.servlet.http.HttpServlet.service (HttpServlet.java:697)


(NB: the servlet in question is called "proxy", the webapp is "/workbench").

I would like to avoid this ERROR in the logs, but do not want to set
logging to FATAL for the category
"org.apache.catalina.core.ContainerBase" if I can avoid it. Perhaps
there is some config option that can be set, or maybe I should make my
custom exception subclass a special value?

It seems rather odd that even though I have an error-page declaration
explicitly handling this exception type that an ERROR is still logged.

And yes I could use an http "error code" rather than throwing an
exception, but I want to pass additional data through to the error page
from the servlet, and embedding it in the thrown exception seems the
most natural implementation.

I have searched the catalina source but cannot find where this exception
is being logged from. Googling this error message and searching the
email forums turned up nothing either.

I am using JBoss 4.0.5 which includes tomcat 5.5.20.

Thanks in advance,

Simon

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.