Add some protection against StackOverflowErrors caused by a hibernate bug if the root logger (or a specific hibernate logger) is set to DEBUG or TRACE.