Fix duplicated logging statements in a better way