Log only if necessary.