Odoo 11 Development Essentials(Third Edition)
上QQ阅读APP看书,第一时间看更新

Managing server log messages

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 the --log-level=debug option.

The following log levels can be particularly interesting:

  • debug_sql to inspect SQL queries generated by the server
  • debug_rpc to detail requests received by the server
  • debug_rpc_answer to detail responses sent by the server
In fact, --log-level is a simplified way to set the Odoo logging verbosity. You might like to know that the more complete --log-handler option allows you to selectively turn on/off specific loggers.

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

Finally, the --dev=all option will bring up the Python debugger (pdb) when an exception is raised. It's useful for doing a postmortem analysis of a server error. Note that it doesn't have any effect on logger verbosity. More details on the Python debugger commands can be found at https://docs.python.org/3/library/pdb.html#debugger-commands.