title: When to use logger during Exceptionhandling?
body: <p>I am newbie at Java and I don't know when to use logger. For example is it logical when I use logger in following example. How to say "Okay I should use logger here". To be clear, I am not asking which logger should I use, but should I use logger at all?  </p>
  
  <pre><code> public boolean isValid(Object bean, ConstraintValidatorContext ctx) {
          try {
              if (Assert.isNull(bean)) {
                  throw new NullPointerException(EXC_MSG_BEAN_NULL);
              }
  
              String dependentFieldActualValue;
              dependentFieldActualValue = BeanUtils.getProperty(bean, dependentField);
              boolean isActualEqual = stringEquals(dependentFieldValue, dependentFieldActualValue);
  
              if (isActualEqual == ifInEqualThenValidate) {
                  return true; // The condition is not met =&gt; Do not validate at all.
              }
              return isTargetValid(bean, ctx); // Perform the actual validation on the target field
          } catch (ReflectiveOperationException e) {
              throw new RuntimeException(e);
          }
      }
  </code></pre>