• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

logging JSP exceptions

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I log exceptions thrown by my JSP pages? I want to catch and log ALL errors (whether thrown by Action classes, business objects or JSPs...).

If I understand the process correctly, I should be able to extend the Struts ExceptionHandler and use something like log4j to log exceptions. The problem I have is that JSP errors don't seem to be being directed to my new Global Exception Handler, which I've configured in struts-config.xml

Currently when a JSP generated exception crops up, the application displays a blank screen because the response is already committed, so the forward to my error.jsp fails too!

I can get the exceptions from the server logs, but I also want them to be logged to my application log, so that everything is centralised. Am I missing the point? Am I not supposed to want to log JSP errors?

For instance, I know what caused the following, and can fix it, but how do I get a handle on it to log it!

Thanks for any assistance:


 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please show us:

1- The global-excpetion entry in your struts-config.xml file
2- The code in your exception handler.

If you want to keep the original function of the exception handler, you must end your overridden execute method with:

return super.execute(....);
[ August 31, 2006: Message edited by: Merrill Higginson ]
 
Daniel Dalton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No problem:



and:

 
We find this kind of rampant individuality very disturbing. But not this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic