Repository: streamlit/streamlit

Issue:
streamlit `--log-level` appears to have no affect to resultant logging level
### Summary

The CLI argument settings `--log-level` appear to have no affect. `log.debug` is never rendered  or changing the logging level does not appear to suppress logs not required.

### Steps to reproduce

Code snippet:

```
import logging
import streamlit as st
import pandas as pd

log.info("Test LOG INFO")
log.debug("Test LOG DEBUG")
log.warning("Test LOG WARNING")
log.error("Test LOG ERROR")

st.write("Here's our first attempt at using data to create a table:")
st.write(pd.DataFrame({
    'first column': [1, 2, 3, 4],
    'second column': [10, 20, 30, 40]
}))
```

**Actual behavior:**

1. for all debug  `streamlit --log_level=debug run  logging_test_app.py` produces
![image](https://user-images.githubusercontent.com/11743864/148130163-cbef3d60-5541-45f3-aa9e-0d7194a659d6.png)
not rendering `log.debug("Test LOG DEBUG")`

2. for only error  `streamlit --log_level=error  run  logging_test_app.py`  but produces same output
![image](https://user-images.githubusercontent.com/11743864/148130488-5d6e1004-9eac-4cfb-a8ae-b712d105341c.png)
only `log.error("Test LOG ERROR")` should be present


**Expected behavior:**
for case 1 the line `log.debug(..)` should be rendered with the other in the terminal
for case 2 only the `log.error(..)`  should be the only log line  rendered in the terminal

### Is this a regression?

 no

### Debug info

- Streamlit version: 1.3.1
- Python version: 3.9.2
- Using : Poetry 
- OS version: Windows 10
- Browser version: N/A

### Additional information
to ensure no enviromental or instance issues I  have tested  a very basic python script and with various logging levels as described above selected. In all cases the correct log results are rendered in the terminal.
![image](https://user-images.githubusercontent.com/11743864/148132632-0882c903-113d-448a-a3f1-7e951d6f2020.png)
![image](https://user-images.githubusercontent.com/11743864/148132688-426e367a-47d5-4d66-b7bf-e1bbc9fe8c8a.png)

```python
import logging
logging.basicConfig(level=logging.ERROR)
# logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)

print("-"*80)
print(f"Logging Level: {logging.getLevelName(log.getEffectiveLevel())}")
log.info("Test LOG INFO")
log.debug("Test LOG DEBUG")
log.warning("Test LOG WARNING")
log.error("Test LOG ERROR")
print("-"*80)
```





Discussion:
Thanks for reporting this @auphofBSF!

I just confirmed the bug. I'm not sure when this stopped working, but it seems like this flag has been broken for awhile (rolling back to version 0.67 still shows the same behavior).

The reason that this slipped by unnoticed for so long is likely because the `logger.level` [config option](https://docs.streamlit.io/library/advanced-features/configuration#set-configuration-options) does work correctly, and that option can be set via CLI flag (I believe the placement has to be after the command being run):

```bash
$ streamlit run my_app.py --logger.level=debug
```

Since we have a working way of setting the log level (and I'm fairly certain that it's one used by most people in practice) I'll most likely proceed with this bug by removing the broken flag after double-checking that we're okay with dropping it entirely in favor of the working one as opposed to fixing it and supporting both.
Thank you @vdonato , I confirm  `streamlit run my_app.py --logger.level=debug` works correctly ✅

I was following `streamlit --help`  and should have done `streamlit run --help`  

However it would be good to (clarify/eliminate/fix/provide-warning)  when using  `--log_level`   as in
`streamlit --log_level=debug run my_app.py`

**Thanks for prompt response confirming issue and in general to you and team Streamlit  for providing such a great APP environment**

Resolving patch:
diff --git a/lib/streamlit/cli.py b/lib/streamlit/cli.py
--- a/lib/streamlit/cli.py
+++ b/lib/streamlit/cli.py
@@ -95,9 +95,13 @@ def main(ctx, log_level="info"):
     """
 
     if log_level:
-        import streamlit.logger
+        from streamlit.logger import get_logger
 
-        streamlit.logger.set_log_level(log_level.upper())
+        LOGGER = get_logger(__name__)
+        LOGGER.warning(
+            "Setting the log level using the --log_level flag is unsupported."
+            "\nUse the --logger.level flag (after your streamlit command) instead."
+        )
 
 
 @main.command("help")


Test patch:
diff --git a/lib/tests/streamlit/cli_test.py b/lib/tests/streamlit/cli_test.py
--- a/lib/tests/streamlit/cli_test.py
+++ b/lib/tests/streamlit/cli_test.py
@@ -305,15 +305,16 @@ def test_hello_command(self):
             positional_args = mock_main_run.call_args[0]
             self.assertEqual(positional_args[0], hello.__file__)
 
-    def test_hello_command_with_logs(self):
-        """Tests the log level gets specified (using hello as an example"""
+    @patch("streamlit.logger.get_logger")
+    def test_hello_command_with_logs(self, get_logger):
+        """Tests setting log level using --log_level prints a warning."""
         from streamlit.hello import hello
 
-        with patch("streamlit.cli._main_run"), patch(
-            "streamlit.logger.set_log_level"
-        ) as mock_set_log_level:
+        with patch("streamlit.cli._main_run"):
             self.runner.invoke(cli, ["--log_level", "error", "hello"])
-            mock_set_log_level.assert_called_with("ERROR")
+
+            mock_logger = get_logger()
+            mock_logger.warning.assert_called_once()
 
     def test_hello_command_with_flag_config_options(self):
         with patch("validators.url", return_value=False), patch(