Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Write Better Python Buggy Logs Log Messages

Petko Draganov
PLUS
Petko Draganov
Courses Plus Student 2,005 Points

Log "The French have the Grail" as a WARNING level message.

I know im close to true but ... almost

starter.py
# Write your code bel
import logging
logging.basicConfig(level=logging.WARNING)
logging.warning("The French have the Grail")

2 Answers

You were not supposed to remove the logging level from DEBUG because when you set the warning level at DEBUG it allows the logger to know what level they should start paying attention to in terms of the messages, we want the logger to see all levels of logging messages so we start at DEBUG. Also without specifying the filename when you run your script it will not know what needs to be DEBUGGED. So this should pass the test, I'm also still learning so i hope my explanation was okay.

import logging

logging.basicConfig(filename='cc.log', level=logging.DEBUG) logging.debug("oh no") logging.warning("The French have the Grail")

Write your code below here