File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logging JSP exceptions

 
Daniel Dalton
Ranch Hand
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • 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:


 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem:



and:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic