add --logdir option to dump logs files of each stage.