I need to suppress output to log for specific exception (OptimisticLockException) from our logs as it is a very frequently thrown exception for one of our apps, and does not indicate an actual error. In our app, it is normal to get this exception when one component of our application has a db row locked (select for update) while another component tries to do the same. The simple filter-spec does not work as this exception may be nested in a caused-by of other catch/throws, hence unable to match on a regex in filter-spec.
I am trying to inject my own filter class into the PeriodicRotatingFileHandler that implements/overrides the isLoggable method (which would inspect the exception to suppress). Per jboss-as-logging_1_2.xsd, there is no filter element on PeriodicRotatingFileHandler. I am already trying to create a derived logger from the PeriodicRotatingFileHandler but hoping there is a cleaner way.