|
|
@ -1,4 +1,28 @@ |
|
|
|
# Tasks |
|
|
|
# Troubleshooting |
|
|
|
## Use Debug mode |
|
|
|
|
|
|
|
Here are the several steps to activate the Debug mode when you develop a Odoo module: |
|
|
|
|
|
|
|
1. Add the following line in the `compose.yml`: |
|
|
|
``` |
|
|
|
- "--log-level=debug" |
|
|
|
``` |
|
|
|
2. Add the following code in your Python file : |
|
|
|
``` |
|
|
|
import logging #At the beginning of your file |
|
|
|
|
|
|
|
_logger = logging.getLogger(__name__) #Before the class where you want to add logs |
|
|
|
|
|
|
|
_logger.debug('Create a %s with vals %s', self._name, vals) # To display a DEBUG message |
|
|
|
_logger.info('FYI: This is happening') # To display an INFO message |
|
|
|
_logger.warning('WARNING: I don't think you want this to happen!') # To display a WARNING message |
|
|
|
_logger.error('ERROR: Something really bad happened!') # To display an ERROR message |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
Then consult the logs. |
|
|
|
|
|
|
|
|
|
|
|
## Getting logs |
|
|
|
|
|
|
|
There are 2 ways to get Odoo logs : |
|
|
@ -13,4 +37,6 @@ To get the last logs: `compose logs odoo --tail=200` |
|
|
|
### Via logs files |
|
|
|
In production (not in dev environment), you can consult the logs in the file `odoo.log` in the repository `/srv/datastore/data/odoo/var/log/odoo` |
|
|
|
|
|
|
|
# Troubleshooting |
|
|
|
|
|
|
|
|
|
|
|
|