← Back to team overview

credativ team mailing list archive

[Merge] lp:~credativ/openobject-server/trunk-logging-config into lp:openobject-server

 

mistotebe has proposed merging lp:~credativ/openobject-server/trunk-logging-config into lp:openobject-server.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~credativ/openobject-server/trunk-logging-config/+merge/183668

The server.conf file does not allow the user to fully customize server logging configuration, e.g. it was impossible to set up syslog with a different facility or even UDP to a different host.

Proposing with changes as proposed during the review and discussed on OpenDays:
- keeping the config file separate
- not interfering with the current means of logging configuration unless the user decides to
-- 
https://code.launchpad.net/~credativ/openobject-server/trunk-logging-config/+merge/183668
Your team credativ is subscribed to branch lp:~credativ/openobject-server/trunk-logging-config.
=== modified file 'openerp/netsvc.py'
--- openerp/netsvc.py	2013-05-28 10:27:33 +0000
+++ openerp/netsvc.py	2013-09-03 14:13:12 +0000
@@ -21,6 +21,7 @@
 
 
 import logging
+import logging.config
 import logging.handlers
 import os
 import release
@@ -156,6 +157,9 @@
     for logconfig_item in logging_configurations:
         _logger.debug('logger level set: "%s"', logconfig_item)
 
+    if tools.config['log_config']:
+        logging.config.fileConfig(tools.config['log_config'], disable_existing_loggers=tools.config['log_config_only'])
+
 DEFAULT_LOG_CONFIGURATION = [
     'openerp.workflow.workitem:WARNING',
     'openerp.netsvc.rpc.request:INFO',

=== modified file 'openerp/tools/config.py'
--- openerp/tools/config.py	2013-03-28 09:50:06 +0000
+++ openerp/tools/config.py	2013-09-03 14:13:12 +0000
@@ -169,6 +169,8 @@
 
         # Logging Group
         group = optparse.OptionGroup(parser, "Logging Configuration")
+        group.add_option("--log-config", dest="log_config", help="file with logging configuration")
+        group.add_option("--log-config-only", dest="log_config_only", my_default=False, help="file with logging configuration")
         group.add_option("--logfile", dest="logfile", help="file where the server log will be stored")
         group.add_option("--logrotate", dest="logrotate", action="store_true", my_default=False, help="enable logfile rotation")
         group.add_option("--syslog", action="store_true", dest="syslog", my_default=False, help="Send the log to the syslog server")
@@ -375,7 +377,8 @@
                 'xmlrpc', 'syslog', 'without_demo', 'timezone',
                 'xmlrpcs_interface', 'xmlrpcs_port', 'xmlrpcs',
                 'static_http_enable', 'static_http_document_root', 'static_http_url_prefix',
-                'secure_cert_file', 'secure_pkey_file', 'dbfilter', 'log_handler', 'log_level'
+                'secure_cert_file', 'secure_pkey_file', 'dbfilter', 'log_handler', 'log_level',
+                'log_config', 'log_config_only', 
                 ]
 
         for arg in keys:


Follow ups