I did the following:
/usr/lib/python2.7/dist-packages/openerp/models.py
sudo service odoo restart
But my print debug lines aren't appearing in /var/log/odoo/odoo-server.log
Am I missing any steps above? How to debug Python code in Odoo in general? Thanks!
1- In your python file you can define a _logger
import logging
_logger = logging.getLogger(__name__)
class MyClass(models.Model):
# [...]
_logger.debug("Debug message")
Modify this attribute in your configuration file
log_level = debug
Restart the service, and the message will be printed in your log file:
2015-08-23 17:32:05,401 2249 DEBUG ? openerp.service.server: Debug message
2 - You can use pudb
to set a breakpoint like following:
class MyClass(models.Model):
# [...]
import pudb;pu.db # This will create a breakpoint
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With