Repository: pytorch
Issue: [bug] torch.distributed.elastic logging: Failed to print the first info statement
Labels: triaged,module: elastic,oncall: r2p

## 🐛 Bug

When the info log level is set, the first info message https://github.com/pytorch/pytorch/blob/master/torch/distributed/run.py#L678 does not show up. 

Ref https://stackoverflow.com/questions/7016056/python-logging-not-outputting-anything/56144390#56144390

## To Reproduce

Steps to reproduce the behavior:

1. Set environment variable `export LOGLEVEL=DEBUG`
1. run `python -m torch.distributed.run --standalone --nnodes=1 --nproc_per_node=2 ...`

```
*****************************************
Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded,
please further tune the variable for optimal performance in your application as needed.
*****************************************
INFO:torch.distributed.launcher.api:Starting elastic_operator with launch configs:
  entrypoint       : pyt.py
  min_nodes        : 1
  max_nodes        : 1
  nproc_per_node   : 2
  run_id           : 7ea2920b-2fea-44e6-aa01-4ce7321b6ddc
  rdzv_backend     : c10d
  rdzv_endpoint    : localhost:29400
  rdzv_configs     : {'timeout': 900}
  max_restarts     : 0
  monitor_interval : 5
  log_dir          : None
  metrics_cfg      : {}
```

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

```
INFO:__main__:
**************************************
Rendezvous info:
--rdzv_backend=c10d --rdzv_endpoint=localhost:29400 --rdzv_id=7ea2920b-2fea-44e6-aa01-4ce7321b6ddc
**************************************

*****************************************
Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded,
please further tune the variable for optimal performance in your application as needed.
*****************************************
INFO:torch.distributed.launcher.api:Starting elastic_operator with launch configs:
  entrypoint       : pyt.py
  min_nodes        : 1
  max_nodes        : 1
  nproc_per_node   : 2
  run_id           : 7ea2920b-2fea-44e6-aa01-4ce7321b6ddc
  rdzv_backend     : c10d
  rdzv_endpoint    : localhost:29400
  rdzv_configs     : {'timeout': 900}
  max_restarts     : 0
  monitor_interval : 5
  log_dir          : None
  metrics_cfg      : {}
```

is shown.

## Environment

CMake version: version 3.19.6
Libc version: glibc-2.17

Python version: 3.9.6 (default, Jul 30 2021, 16:35:19)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-3.10.107-1-tlinux2_kvm_guest-0049-x86_64-with-glibc2.17
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.19.2
[pip3] torch==1.10.0a0+git07b00fc
[pip3] torchvision==0.8.0a0
[conda] _pytorch_select           0.1                       cpu_0
[conda] blas                      1.0                         mkl
[conda] libmklml                  2019.0.5                      0
[conda] mkl                       2020.2                      256
[conda] mkl-include               2021.3.0           h06a4308_520
[conda] mkl-service               2.3.0            py39he8ac12f_0
[conda] mkl_fft                   1.3.0            py39h54f3939_0
[conda] mkl_random                1.0.2            py39h63df603_0
[conda] numpy                     1.19.2           py39h89c1606_0
[conda] numpy-base                1.19.2           py39h2ae0177_0
[conda] pytorch                   1.7.1           cpu_py39h6a09485_0
[conda] torch                     1.10.0a0+git07b00fc          pypi_0    pypi
[conda] torchvision               0.8.2           cpu_py39ha229d99_0

## Additional context

<!-- Add any other context about the problem here. -->


cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @agolynski @SciPioneer @H-Huang @mrzzd @cbalioglu @gcramer23