Log only if there is anything to log.