Repository: Lightning-AI/pytorch-lightning

Issue:
versions after .5.2.1 do not print weights summary
ubuntu 18.04.3lts, no virtual environment

Model summary is not printed in versions .5.3, .5.3.1, and .5.3.2. trainer.weights_summary is set to 'full', but nothing is printed on screen.


Discussion:
This is because they recently changed from printing to logging (#282, #457) and the summary is logged as info, but the log level is set to warning and above.
With 
`logging.getLogger().setLevel(logging.INFO)`
you can see the summary, but the formatting is messed up because of the "INFO" text in front.
The summary logging happens [here](https://github.com/williamFalcon/pytorch-lightning/blob/9785a3e78e6c5b5ff2bde45d36f5e1165dbe16ab/pytorch_lightning/core/lightning.py#L320).
@Borda @Ir1d How do we have to configure the logging so it always shows the summary?
We have moved from `print` to standard Python `logging`
Yes, when it didn't print a quick look at the code showed the shift to logging. And it is easy to just print the summary myself - so no need to change - I just thought it best to bring it to your attention in case this was not intended.
I believe that the logging should be visible in terminal... 
Ahh I didn't notice this case before, thx for bringing this up @sneiman @awaelchli 

A possible fix would be to simply use print here? since `summarize()` seems to be called outside the tqdm loop.

@williamFalcon what do you think?

We can also consider removing the level msgs like this: https://stackoverflow.com/questions/46584670/remove-the-log-level-printing-in-python-logging
We can also check of the LOG_LEVEL is INFO then `print` just for this case. So we still respect the LOGGING LEVEL but have correct formatting 
@awaelchli 
Hi, the logging level is set [here](https://github.com/williamFalcon/pytorch-lightning/blob/a6d64ac013868160fafdda6a0794dc6709301967/pytorch_lightning/trainer/trainer.py#L244), should it behave the same with `logging.getLogger().setLevel(logging.INFO)` ?

@jeffling I agree with you, I'll open a PR soon.

Resolving patch:
diff --git a/pytorch_lightning/__init__.py b/pytorch_lightning/__init__.py
--- a/pytorch_lightning/__init__.py
+++ b/pytorch_lightning/__init__.py
@@ -28,9 +28,11 @@
     from .trainer.trainer import Trainer
     from .core.lightning import LightningModule
     from .core.decorators import data_loader
+    import logging
 
     __all__ = [
         'Trainer',
         'LightningModule',
         'data_loader',
     ]
+    logging.basicConfig(level=logging.INFO)
diff --git a/pytorch_lightning/core/lightning.py b/pytorch_lightning/core/lightning.py
--- a/pytorch_lightning/core/lightning.py
+++ b/pytorch_lightning/core/lightning.py
@@ -1022,7 +1022,7 @@ def load_from_checkpoint(cls, checkpoint_path):
 
     def summarize(self, mode):
         model_summary = ModelSummary(self, mode=mode)
-        logging.info(model_summary)
+        logging.info('\n' + model_summary.__str__())
 
     def freeze(self):
         """Freeze all params for inference
diff --git a/pytorch_lightning/trainer/trainer.py b/pytorch_lightning/trainer/trainer.py
--- a/pytorch_lightning/trainer/trainer.py
+++ b/pytorch_lightning/trainer/trainer.py
@@ -240,9 +240,6 @@ def __init__(self,
         self.amp_level = amp_level
         self.init_amp(use_amp)
 
-        # set logging options
-        logging.basicConfig(level=logging.INFO)
-
     @property
     def slurm_job_id(self):
         try:


Test patch: