# How to Log to Stdout with Python?

If you are new to logging in Python, please feel free to start with our [Introduction to Python logging](https://betterstack.com/community/guides/logging/how-to-start-logging-with-python/) to get started smoothly. Otherwise, here is how to log to Stdout with Python:

## Using Basic Configuration

Python, by default, logs to a console. You can call the function on the module:

```python
import logging

logging.warning("Warning.")

OUTPUT
WARNING:root:Warning.
```

Python already provides default formatting.


[info]
## 🔭 Want to centralize and monitor your python logs?
Go to [Better Stack](https://betterstack.com/logs/) and start your log management in 5 minutes.
[/info]

## Using Provided Classes

You can also use the provided classes:

```python
import logging

logger = logging.getLogger("nameOfTheLogger")
ConsoleOutputHandler = logging.StreamHandler()

logger.addHandler(ConsoleOutputHandler)

logger.warning("Warning.")
```

Create a new logger and a new handler. Assign the class `StreamHandler` to the
handler and assign the handler to the logger. The output will be the following:

```
[output]
Warning.
```

If you would like to have more options when it comes to logging your apps, have a look at our [Guide to logging with Loguru](https://betterstack.com/community/guides/logging/loguru/), which is the most popular third-party logging framework for Python.

[ad-logs]