---
title: "Python Logging: Why Logger Defaults to WARN and How to Change It"
description: "Learn how Python's logging module defaults to WARN level and how to configure it for DEBUG output, with code examples demonstrating different logging behaviors."
image: "https://www.sethserver.com/static/images/logging-info-does-not-print-1-1.webp"
---

# Python Logging: Why Logger Defaults to WARN and How to Change It

When debugging and profiling Python software you'll find yourself relying on Python's built-in logging module. Something that is very simple to overlook is the fact that the root logger defaults to WARN and not DEBUG. Note the output of the simple logging statements below.

import logging
log = logging.getLogger(\_\_name\_\_)
log.debug('this is debug')
log.info('this is info')
log.warning('this is warning')
log.error('this is error')
log.critical('this is really bad')

$ python3 testlogging.py
this is warning
this is error
this is really bad

The root logger only prints out warnings, errors and criticalities. To increase the logging level set the [logging.basicConfig](https://docs.python.org/3/library/logging.html#logging.basicConfig) to DEBUG.

import logging
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(\_\_name\_\_)
log.debug('this is debug')
log.info('this is info')
log.warning('this is warning')
log.error('this is error')
log.critical('this is really bad')

$ python3 testlogging.py
DEBUG:\_\_main\_\_:this is debug
INFO:\_\_main\_\_:this is info
WARNING:\_\_main\_\_:this is warn
ERROR:\_\_main\_\_:this is error
CRITICAL:\_\_main\_\_:this is really bad

You'll also notice that the basicConfig changes the log format to include the log message type and log name.

Good luck and happy logging!

-Sethers


```json
{"@context": "https://schema.org", "@type": "BlogPosting", "headline": "Python Logging: Why Logger Defaults to WARN and How to Change It", "datePublished": "2020-12-01T00:00:00", "dateModified": "2025-12-22T19:35:10", "image": {"@type": "ImageObject", "url": "https://www.sethserver.com/static/images/logging-info-does-not-print-1-1.webp", "width": 400, "height": 400}, "url": "https://www.sethserver.com/python/logging-info-does-not-print.html", "author": {"@type": "Person", "name": "Seth Black", "url": "https://www.linkedin.com/in/seth-black-tx"}, "publisher": {"@type": "Organization", "name": "Sethserver", "logo": {"@type": "ImageObject", "url": "https://www.sethserver.com/static/images/PaperAirplane512.png"}}, "description": "Learn how Python's logging module defaults to WARN level and how to configure it for DEBUG output, with code examples demonstrating different logging behaviors.", "articleSection": "Technology"}
{"@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{"@type": "ListItem", "position": 1, "name": "sethserver", "item": "https://www.sethserver.com/"}, {"@type": "ListItem", "position": 2, "name": "Python", "item": "https://www.sethserver.com/python/"}, {"@type": "ListItem", "position": 3, "name": "Python Logging: Why Logger Defaults to WARN and How to Change It", "item": "https://www.sethserver.com/python/logging-info-does-not-print.html"}]}
```
