set_verbosity_info not working
Author: sanderland
Pull request: no
Labels: name: bug

### System Info

Transformers version: 4.18

### Issue

The example at https://huggingface.co/docs/transformers/main_classes/logging does not work.
Workaround in example is using transformers.trainer.logger instead of get_logger.

### Who can help?

Not sure

### Information

- [X] The official example scripts
- [x] My own modified scripts

### Reproduction

```
import transformers
from transformers.utils import logging

logging.set_verbosity_info()
logger = logging.get_logger(__name__)
logger.info("set_verbosity_info before get_logger INFO")
logger.warning("WARN")

logging.set_verbosity_info()
logger.info("set_verbosity_info after get_logger INFO")

transformers.trainer.logger.info("TRAINER LOG INFO")
```
currently outputs
```
WARN
TRAINER LOG INFO
```
missing the info on the logger, so there is a disconnect between get_logger and set_verbosity_info

### Expected behavior

output
```
WARN
set_verbosity_info before get_logger INFO
set_verbosity_info after get_logger INFO
TRAINER LOG INFO
```



Comments:
Hello @sanderland! The `logging` utility of the `transformers` library is made to control the logging of the library itself, not of scripts outside of it.

It's based off of the way you instantiate the logger with `logging.get_logger` -> all files in the `transformers` module will have `transformers` as their parent, therefore all loggers in the library will follow it.

If for some reason you want to leverage it as well, you could replace `__name__` by something related to `transformers` so that the logging utility understands it's dealing with something similar.

For example something like that:
```diff
import transformers
from transformers.utils import logging

logging.set_verbosity_info()
- logger = logging.get_logger(__name__)
+ logger = logging.get_logger('transformers')
logger.info("set_verbosity_info before get_logger INFO")
logger.warning("WARN")

logging.set_verbosity_info()
logger.info("set_verbosity_info after get_logger INFO")

transformers.trainer.logger.info("TRAINER LOG INFO")
```
which should use the parent logger.
You can also define your own logger with:
```diff
import transformers
from transformers.utils import logging

logging.set_verbosity_info()
- logger = logging.get_logger(__name__)
+ logger = logging.get_logger('transformers.my_cool_module')
logger.info("set_verbosity_info before get_logger INFO")
logger.warning("WARN")

logging.set_verbosity_info()
logger.info("set_verbosity_info after get_logger INFO")

transformers.trainer.logger.info("TRAINER LOG INFO")
```
(replace `my_cool_module` with what you want)

Both output the following:
```
set_verbosity_info before get_logger INFO
WARN
set_verbosity_info after get_logger INFO
TRAINER LOG INFO
```

Thanks! In any case,  https://huggingface.co/docs/transformers/main_classes/logging still seems really really strange in its example for 'Here is an example of how to use logging in a module'.


You're right, the documentation here seems incorrect. Would you like to open a PR to update it with what you've identified in this issue?

Closing this as we have a PR now :)