Manifest Academy

Home › Curriculum › Technical Foundations › Debugging Python: tracebacks, logging and pdb

Python for Odoo · 14 min · Python 3.12 + Odoo

Debugging Python: tracebacks, logging and pdb

Reading tracebacks bottom-up, using the logger, the Odoo shell and the debugger.

In this lesson

Key points

Real-world example

A scheduled sync failed every night with no visible error. Raising the module's logger to DEBUG with --log-handler showed a timeout on page 37 of the API. The fix (pagination with retries) took an hour once the log told the story.

Questions and answers

How do you show only your module's debug logs?

--log-handler=odoo.addons.<module>:DEBUG

What should you do before leaving the shell after experiments?

env.cr.rollback() unless you deliberately want to commit.

Read the full lesson, worked example and quiz