Text code is like this:
import sys
import argparse
import logging
import torch.distributed as dist

def parse_args():
    parse = argparse.ArgumentParser()
    parse.add_argument('--local_rank', dest='local_rank', type=int, default=-1,)
    return parse.parse_args()

args = parse_args()
torch.cuda.set_device(args.local_rank)
dist.init_process_group(
    backend='nccl',
    #  init_method='tcp://127.0.0.1:{}'.format(cfg.port),
    init_method='env://',
    world_size=torch.cuda.device_count(),
    rank=args.local_rank
)


def set_logger():
    logfile = 'log.txt'
    log_level = logging.INFO
    FORMAT = '%(levelname)s %(filename)s(%(lineno)d): %(message)s'
    logging.basicConfig(level=log_level, format=FORMAT, filename=logfile)
    logging.root.addHandler(logging.StreamHandler(sys.stdout))

set_logger()
logger = logging.getLogger()
logger.info('acb')

If I launch the code like this:
CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 test.py

I will see no log message. This is not same as pytorch 1.7.