I have been asked to put a check on a particular field and then log a error if it fails the check. I am planning to add the check within setter of bean itself as i don't want to put it at various places that set this value.
Is it a good idea to handle exceptions , log errors within Beans which are just supposed to be carrier objects.
The only problem i could see is if It's serializable. You should be make the logger reference as transient. Rest it shouldn't make any problem but still never seen and hence think its good not to keep logging inside bean. You can alternatively throw exception and catch in respective caller if that can be an alternative.