• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Unexpected Error Logging

 
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone point me in the right direction on where I would want to begin creating an error log for my jsp pages. I don't have a problem throwing and logging expected errors in JSP when they occur...I need to somehow log error messages that are unexpected.
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you set up a JSP called for example "myError.jsp" with this directive
<%@ page isErrorPage="true" %>
and then use <%@ page errorPage="myError.jsp" %>
in other pages, then any runtime exceptions in a JSP will cause "myError.jsp" to be executed. In this page you can do the logging.
I would <jsp:forward page="LoggingServlet"/> to a Servlet and do the logging there since I prefer not to have too much Java code in a JSP.
 
Ronnie Phelps
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't know that this approach would apply to any runtime exception. Thanks Tony that was very helpful.
 
I just had the craziest dream. This tiny ad was in it.
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic