How to Log an Info Message in Python with logger.info
An info message records that something went as planned: a file was read, a step finished. logger.info logs one at the INFO level, and it can fill values into the message for you. This guide logs two progress messages, one of them with values, with real output from Python 3.15.2.
Syntax
logger.info(<message>, <value>, ...)
| Part | What it means |
|---|---|
logger | A logger from logging.getLogger(<name>) |
<message> | The text of the message. Each %s in it is a placeholder for one value |
<value>, ... | Optional. The values for the placeholders, in order |
Python's logging reference says info "Logs a message with level INFO on this logger. The arguments are interpreted as for debug()." Under debug(), the values "are merged into msg using the string formatting operator", and "No % formatting operation is performed on msg when no args are supplied." The Logging HOWTO describes the INFO level as "Confirmation that things are working as expected."
The Example
A script logs two progress messages under the logger name report, as if it were reading a sales file: a plain one, and one with the number of rows and the file name filled in.
Prerequisites
- uv and Python 3. This guide uses uv 0.13.10 with Python 3.15.2, in a project made with
uv init.
Step 1: Write the Script
basicConfig sets up logging: level=logging.INFO lets INFO messages through, and format prints each message's level, the logger's name and the message.
import logging
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(name)s: %(message)s")
logger = logging.getLogger("report")
logger.info("Reading the sales file")
logger.info("Read %s rows from %s", 42, "sales.csv")

- The first call has no values, so its message is logged as it is.
- The second call has two
%splaceholders and two values:42goes into the first and"sales.csv"into the second.
Step 2: Run It
uv run python progress.py
INFO report: Reading the sales file
INFO report: Read 42 rows from sales.csv

Both messages appeared at the INFO level, under the name report. In the second one, the placeholders became 42 and sales.csv.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Leaving the level at its default | The HOWTO: "The default level is WARNING". Without level=logging.INFO, the script printed nothing from logger.info | Pass level=logging.INFO to basicConfig |
Passing a value without a %s for it | logger.info("Read rows from the sales file", 42) printed --- Logging error --- and TypeError: not all arguments converted during string formatting (required 0, got 1) instead of the message. The script carried on with the next line | Put one %s in the message for each value |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
logger.info prints nothing | The level is WARNING, the default | Pass level=logging.INFO to basicConfig |
--- Logging error ---, then not all arguments converted during string formatting | The call passes more values than the message has %s placeholders | Add the missing %s, or remove the extra value |
FAQ
When should I use info instead of debug or warning?
The HOWTO's table of levels answers it. DEBUG is "Detailed information, typically of interest only when diagnosing problems." INFO is "Confirmation that things are working as expected." WARNING is "An indication that something unexpected happened, or indicative of some problem in the near future". So a finished step is INFO, the details you need only while hunting a bug are DEBUG, and anything a person should look at is WARNING or higher.
Why not just use print()?
A log message carries its level and the logger's name, and raising the level turns INFO messages off without touching the logger.info lines. print() always prints.
Conclusion
logger.info("Read %s rows from %s", 42, "sales.csv") printed INFO report: Read 42 rows from sales.csv once the level was set to INFO. Use it for routine progress, with one %s for each value.
Additional Resources
- logging: Logger.info — the method and its arguments.
- Logging HOWTO — the levels and when to use each.
