0 Replies Latest reply on Oct 15, 2007 10:48 AM by khelenek

    custom ejb exception handler?

    khelenek

      I'm curious if there are any hooks into the handling of runtime exceptions that propagate up through an EJB. The default behavior is to rollback a transaction and log the error. What I would like to be able to do is add my own custom logging here to add additional information on errors.

      Let me back up and present the problem. Sometimes I get a hibernate runtime exception, which logs a stacktrace showing a series of "caused by's", until finally reaching something like this:

      Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into some_table... was aborted. Call getNextException to see the cause.
      

      I would really like to get that getNextException() part logged as it is usually the most useful part of the exception. And i want to do it in a "global" sort of way without catching, logging, and rethrowing on every ejb method i have.

      Thought also about making my own log4j appender but I'm not sure if that approach would work. Any other ideas or suggestions?

      Thanks!
      Kris