Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

Odoo Logging 的配置,使用和实现



  • Odoo Logging Configuration, Usage and Implementation <br />转自本人博客([url=http://www.mindissoftware.com/2014/09/07/Odoo-logging-configuration-usage-implementation/]http://www.mindissoftware.com/2014/09/07/Odoo-logging-configuration-usage-implementation/[/url] <br /><br />Overview<br />Logging provides valuable runtime debugging/monitoring information when an application is on production. It is also a helpful tool in debugging application in development phase. This blog describes the logging configuration, usage and implementation in Odoo 8.0.<br /><br />logging configuration<br />Odoo uses the Python standard logging library. However, it uses a special configuration syntax to configure logging levels for its modules. Following are a complete list of Odoo logging configuration options:<br /><br />logfile: the log filename. If not set, use stdout.<br />logrotate: True/False. If True, create a daily log file and keep 30 files.<br />log_db: Ture/False. If Ture, also write log to 'ir_logging' table in database.<br />log_level: any value in the list of ['debug_rpc_answer', 'debug_rpc', 'debug', 'debug_sql', 'info', 'warn', 'error', 'critical']. Odoo changed the log_level meaning here because this level values are mapped to a set of predefined 'module:log_level' pairs. Even this option is not set, there is a set of predefined settings. See the following implementation section for details.<br />log_handler: can be a list of 'module:log_level' pairs. The default value is ':INFO' -- it means the default logging level is 'INFO' for all modules.<br />logging in your code<br />Using logging in an Odoo addon is simple. The following is an example with the recommended use of different logging levels:<br /><br />import logging<br /><br />_logger = logging.getLogger(name)<br /><br />_logger.debug("debug message for debugging only")<br />_logger.info("information message to report important modular event")<br />_logger.warning("warning message to report minor issues")<br />_logger.error("error message to report failed operations")<br />_logger.critical("critical message -- so bad that the module cannot work")<br /><br />Examples of logging configuration are listed below. Please pay attention to the syntax of log_handler -- not quotation or square bracket around the value.<br /><br />log_level = debug_sql<br />log_handler = openerp.addons.my_addon1:DEBUG,openerp.addons.my_addon2:DEBUG<br /><br />## Odoo logging implementation<br /><br />Odoo logging functions are defined in openerpr/netsvc.py.<br />Logging initialization is defined in the init_logger() function.<br />After calling tools.translated.resetlocal(), it sets a <br />logging format that consists of the following fields:<br /><br />> time, process id, logging level, database name, module name,<br />> and logging message. <br /><br />If a logfile configuration option is provided, it uses a file <br />handler (one of TimedRotatingFileHandler, WatchedFileHandler,<br />and FileHandler) to log messages to a file. <br />If no logfile is configured, it logs messages to stdout.<br />If log_db is configured with a database name, it logs message <br />to the ir.logging table in the specified database. <br /><br />It reads log_level configuration option that is pre-mapped as one of the <br />following: <br /><br />```python<br />PSEUDOCONFIG_MAPPER = {<br />    'debug_rpc_answer': ['openerp:DEBUG','openerp.http.rpc.request:DEBUG', 'openerp.http.rpc.response:DEBUG'],<br />    'debug_rpc': ['openerp:DEBUG','openerp.http.rpc.request:DEBUG'],<br />    'debug': ['openerp:DEBUG'],<br />    'debug_sql': ['openerp.sql_db:DEBUG'],<br />    'info': [],<br />    'warn': ['openerp:WARNING', 'werkzeug:WARNING'],<br />    'error': ['openerp:ERROR', 'werkzeug:ERROR'],<br />    'critical': ['openerp:CRITICAL', 'werkzeug:CRITICAL'],<br />}<br />It reads log_handler configuration option that defines mappings of a module and its logging level. The default is :INFO. Then it combines the mapped value of log_level option, log_handler and the following default logging configuration:<br /><br />DEFAULT_LOG_CONFIGURATION = [<br />    'openerp.workflow.workitem:WARNING',<br />    'openerp.http.rpc.request:INFO',<br />    'openerp.http.rpc.response:INFO',<br />    'openerp.addons.web.http:INFO',<br />    'openerp.sql_db:INFO',<br />    ':INFO',<br />]<br />Finally, it set logging level for every module in the combined list of 'module:log_level' pairs.<br /><br />The init_logger() is called by parse_config() method in openerp/tools/config.py that is called by the main() method in openerp/cli/server.py.<br /><br />Note: it seems that the openerp/loglevels.py is not used by any module.



  • Odoo Logging Configuration, Usage and Implementation <br />转自本人博客([url=http://www.mindissoftware.com/2014/09/07/Odoo-logging-configuration-usage-implementation/]http://www.mindissoftware.com/2014/09/07/Odoo-logging-configuration-usage-implementation/[/url] <br /><br />Overview<br />Logging provides valuable runtime debugging/monitoring information when an application is on production. It is also a helpful tool in debugging application in development phase. This blog describes the logging configuration, usage and implementation in Odoo 8.0.<br /><br />logging configuration<br />Odoo uses the Python standard logging library. However, it uses a special configuration syntax to configure logging levels for its modules. Following are a complete list of Odoo logging configuration options:<br /><br />logfile: the log filename. If not set, use stdout.<br />logrotate: True/False. If True, create a daily log file and keep 30 files.<br />log_db: Ture/False. If Ture, also write log to 'ir_logging' table in database.<br />log_level: any value in the list of ['debug_rpc_answer', 'debug_rpc', 'debug', 'debug_sql', 'info', 'warn', 'error', 'critical']. Odoo changed the log_level meaning here because this level values are mapped to a set of predefined 'module:log_level' pairs. Even this option is not set, there is a set of predefined settings. See the following implementation section for details.<br />log_handler: can be a list of 'module:log_level' pairs. The default value is ':INFO' -- it means the default logging level is 'INFO' for all modules.<br />logging in your code<br />Using logging in an Odoo addon is simple. The following is an example with the recommended use of different logging levels:<br /><br />import logging<br /><br />_logger = logging.getLogger(name)<br /><br />_logger.debug("debug message for debugging only")<br />_logger.info("information message to report important modular event")<br />_logger.warning("warning message to report minor issues")<br />_logger.error("error message to report failed operations")<br />_logger.critical("critical message -- so bad that the module cannot work")<br /><br />Examples of logging configuration are listed below. Please pay attention to the syntax of log_handler -- not quotation or square bracket around the value.<br /><br />log_level = debug_sql<br />log_handler = openerp.addons.my_addon1:DEBUG,openerp.addons.my_addon2:DEBUG<br /><br />## Odoo logging implementation<br /><br />Odoo logging functions are defined in openerpr/netsvc.py.<br />Logging initialization is defined in the init_logger() function.<br />After calling tools.translated.resetlocal(), it sets a <br />logging format that consists of the following fields:<br /><br />> time, process id, logging level, database name, module name,<br />> and logging message. <br /><br />If a logfile configuration option is provided, it uses a file <br />handler (one of TimedRotatingFileHandler, WatchedFileHandler,<br />and FileHandler) to log messages to a file. <br />If no logfile is configured, it logs messages to stdout.<br />If log_db is configured with a database name, it logs message <br />to the ir.logging table in the specified database. <br /><br />It reads log_level configuration option that is pre-mapped as one of the <br />following: <br /><br />```python<br />PSEUDOCONFIG_MAPPER = {<br />    'debug_rpc_answer': ['openerp:DEBUG','openerp.http.rpc.request:DEBUG', 'openerp.http.rpc.response:DEBUG'],<br />    'debug_rpc': ['openerp:DEBUG','openerp.http.rpc.request:DEBUG'],<br />    'debug': ['openerp:DEBUG'],<br />    'debug_sql': ['openerp.sql_db:DEBUG'],<br />    'info': [],<br />    'warn': ['openerp:WARNING', 'werkzeug:WARNING'],<br />    'error': ['openerp:ERROR', 'werkzeug:ERROR'],<br />    'critical': ['openerp:CRITICAL', 'werkzeug:CRITICAL'],<br />}<br />It reads log_handler configuration option that defines mappings of a module and its logging level. The default is :INFO. Then it combines the mapped value of log_level option, log_handler and the following default logging configuration:<br /><br />DEFAULT_LOG_CONFIGURATION = [<br />    'openerp.workflow.workitem:WARNING',<br />    'openerp.http.rpc.request:INFO',<br />    'openerp.http.rpc.response:INFO',<br />    'openerp.addons.web.http:INFO',<br />    'openerp.sql_db:INFO',<br />    ':INFO',<br />]<br />Finally, it set logging level for every module in the combined list of 'module:log_level' pairs.<br /><br />The init_logger() is called by parse_config() method in openerp/tools/config.py that is called by the main() method in openerp/cli/server.py.<br /><br />Note: it seems that the openerp/loglevels.py is not used by any module.



  • odoo8.0在IDE中调试时,debug哪个文件呢?<br />因为没有7.0的openerp-server,是要复制过去吗?



  • odoo 8.0 还是从 openerp-server 开始启动运行的。 这里有个以前发的不错的帖子 [url=http://shine-it.net/index.php?topic=14848.0]http://shine-it.net/index.php?topic=14848.0[/url]


登录后回复
 

与 Odoo 中文社区 的连接断开,我们正在尝试重连,请耐心等待