I’m using Hibernate validator implementation of JSR 303 to validate some entities in my program and I need to log the data which are not correct. I can have the list of ConstraintViolation as a result of JSR 303 validation, but it contains only metadata of failed validations. The offending values itself are not available anywhere for me to log them (I would have to map constraint violations back to the entities which is awful).
I have found a trace log in ConstraintTree class in Hibernate which logs all validated values, but that’s useles for me to (I can’t tell which one failed).
Is there some magic logger name which triggers logging of failed validation values?
ConstraintViolation.getInvalidValue()doesn’t return value you need?BTW, Hibernate (since 4.0.0) and hibernate-validator (since 4.3.) use
jboss-logginginstead oflog4j.