Book Image

Odoo Development Essentials

Book Image

Odoo Development Essentials

Overview of this book

Table of Contents (17 chapters)
Odoo Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

More server configuration options


The Odoo server supports quite a few other options. We can check all available options with the --help option:

$ ./odoo.py --help

It's worth while to have an overview on the most important ones.

Odoo server configuration files

Most of the options can be saved in a configuration file. By default, Odoo will use the .openerp-serverrc file in your home directory. Conveniently, there is also the --save option to store the current instance configuration into that file:

$ ~/odoo-dev/odoo/odoo.py --save --stop-after-init  # save configuration to file

Here we also used the --stop-after-init option, to have the server stop after it finishes its actions. This option is often used when running tests or asking to run a module upgrade to check if it installs correctly.

Now we can inspect what was saved in this default configuration file:

$ more ~/.openerp_serverrc  # show the configuration file

This will show all configuration options available with the default values for them. Editing them will be effective the next time you start an Odoo instance. Type q to quit and go back to the prompt.

We can also choose to use a specific configuration file, using the --conf=<filepath> option. Configuration files don't need to have all those the options you've just seen. Only the ones that actually change a default value need to be there.

Changing the listening port

The --xmlrpc-server=<port> command allows us to change the default 8069 port where the server instance listens. This can be used to run more than one instances at the same time, on the same server.

Let's try that. Open two terminal windows. On the first one run:

$ ~/odoo-dev/odoo.py --xmlrpc-port=8070

and on the other run:

$ ~/odoo-dev/odoo.py --xmlrpc-port=8071

And there you go: two Odoo instances on the same server listening on different ports. The two instances can use the same or different databases. And the two could be running the same or different versions of Odoo.

Logging

The --log-level option allows us to set the log verbosity. This can be very useful to understand what is going on in the server. For example, to enable the debug log level use: --log-level=debug

The following log levels can be particularly interesting:

  • debug_sql to inspect SQL generated by the server

  • debug_rpc to detail the requests received by the server

  • debug_rpc_answer to detail the responses sent by the server

By default the log output is directed to standard output (your console screen), but it can be directed to a log file with the option --logfile=<filepath>.

Finally, the --debug option will bring up the Python debugger (pdb) when an exception is raised. It's useful to do a post-mortem analysis of a server error. Note that it doesn't have any effect on the logger verbosity. More details on the Python debugger commands can be found here: https://docs.python.org/2/library/pdb.html#debugger-commands.