Language modeling logging
Author: Ganeshgit96
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->
     
- `transformers` version:4.0.0-rc-1
- Platform:Linux
- Python version:Python 3.7.9
- PyTorch version (GPU?):1.4.0
- Tensorflow version (GPU?):1.14.0
- Using GPU in script?:Yes
- Using distributed or parallel set-up in script?:Yes

### Who can help
<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.
 
 albert, bert, GPT2, XLM: @LysandreJik 
 tokenizers: @mfuntowicz
 Trainer: @sgugger
 Speed and Memory Benchmarks: @patrickvonplaten
 Model Cards: @julien-c
 TextGeneration: @TevenLeScao 
 examples/distillation: @VictorSanh
 nlp datasets: [different repo](https://github.com/huggingface/nlp)
 rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)
 Text Generation: @patrickvonplaten @TevenLeScao
 Blenderbot: @patrickvonplaten
 Bart: @patrickvonplaten
 Marian: @patrickvonplaten
 Pegasus: @patrickvonplaten
 mBART: @patrickvonplaten
 T5: @patrickvonplaten
 Longformer/Reformer: @patrickvonplaten
 TransfoXL/XLNet: @TevenLeScao
 RAG: @patrickvonplaten, @lhoestq
 FSMT: @stas00
 examples/seq2seq: @patil-suraj
 examples/bert-loses-patience: @JetRunner
 tensorflow: @jplu
 examples/token-classification: @stefan-it
 documentation: @sgugger
 -->
@sgugger
## Information

Model I am using (Bert, XLNet ...): BERT

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [ X] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [X ] my own task or dataset: (give details below)

## To reproduce

Steps to reproduce the behavior:

1.
2.
3.

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->

I am new to the logging package and I would like to know if we can redirect all the contents occurring in the screen to a text file when I am running the language modeling script. I am not sure if this is the correct forum to ask but can you please help me with this?

Comments:
I think @LysandreJik will know more what to do for the logging. Also, we usually ask questions like this on the [forum](https://discuss.huggingface.co/) and keep issues for bugs/feature requests.

If you want to output everything to a file, you can redirect the standard output/standard error to a file. We use the official `logging` package for logs, and they have a full chapter en redirecting to a file: https://docs.python.org/3/howto/logging.html#logging-to-a-file

It is also possible to redirect the output from the script (without modifying anything). I use the following code to both have the output on my screen (console) and a copy in my log files (with stderr having the python logging logs):

```bash
python run_your_script.py \
    > >(tee -a stdout.log) \
    2> >(tee -a stderr.log >&2)
```

(Found this gem on StackOverflow somewhere.)

@Querela and @LysandreJik, thanks a lot for the help. closing the issues.