From 4814623d901d811561bd811fe082c43b46fb8d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 3 Oct 2022 21:37:47 +0900 Subject: [PATCH] stack/erp5: use haufe.requestmonitoring instead of Products.LongRequestLogger haufe.requestmonitoring already supports WSGI and Python3 and seems used and maintainted. --- software/erp5/test/test/test_erp5.py | 4 ---- stack/erp5/buildout.cfg | 4 ++-- stack/erp5/buildout.hash.cfg | 6 +++--- stack/erp5/instance-zope.cfg.in | 10 +++++++++- stack/erp5/site.zcml | 2 ++ stack/erp5/zope.conf.in | 15 ++++++++++----- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/software/erp5/test/test/test_erp5.py b/software/erp5/test/test/test_erp5.py index bea39c2d2..620952e01 100644 --- a/software/erp5/test/test/test_erp5.py +++ b/software/erp5/test/test/test_erp5.py @@ -893,10 +893,6 @@ class TestZopeMedusa(ZopeTestMixin, ERP5InstanceTestCase): class TestZopeWSGI(ZopeTestMixin, ERP5InstanceTestCase): wsgi = True - @unittest.expectedFailure - def test_long_request_log_rotation(self): - super().test_long_request_log_rotation() - @unittest.expectedFailure def test_basic_authentication_user_in_access_log(self): super().test_basic_authentication_user_in_access_log() diff --git a/stack/erp5/buildout.cfg b/stack/erp5/buildout.cfg index 7de55610f..da2185429 100644 --- a/stack/erp5/buildout.cfg +++ b/stack/erp5/buildout.cfg @@ -639,7 +639,7 @@ eggs = ${neoppod:eggs} # Other products Products.MimetypesRegistry Products.TIDStorage - Products.LongRequestLogger + haufe.requestmonitoring # BBB: Temporarily keep zope.app.testing awaiting we use newer version of CMF # (for tests like testCookieCrumbler). @@ -774,7 +774,7 @@ APacheDEX = 1.8 Pillow = 6.2.2 Products.CMFActionIcons = 2.1.3 Products.GenericSetup = 1.8.6 -Products.LongRequestLogger = 2.1.0 +haufe.requestmonitoring = 0.6.0 # Products.MimetypesRegistry 2.1 requires AccessControl>=3.0.0Acquisition. Products.MimetypesRegistry = 2.0.10 Products.PluggableAuthService = 1.10.0 diff --git a/stack/erp5/buildout.hash.cfg b/stack/erp5/buildout.hash.cfg index 15469b7c6..3c283def4 100644 --- a/stack/erp5/buildout.hash.cfg +++ b/stack/erp5/buildout.hash.cfg @@ -34,11 +34,11 @@ md5sum = 45cc45510b59ceb730b6e38448b5c0c3 [template-zope-conf] filename = zope.conf.in -md5sum = e8e1e76385d76cafbc6ad33e1c8573f2 +md5sum = ae1232116a1dd4a68fdfab286c849945 [site-zcml] filename = site.zcml -md5sum = 43556e5bca8336dd543ae8068512aa6d +md5sum = f45dc4568b63de39f49b8fecca5deef1 [template-my-cnf] filename = my.cnf.in @@ -86,7 +86,7 @@ md5sum = 0ac4b74436f554cd677f19275d18d880 [template-zope] filename = instance-zope.cfg.in -md5sum = 5ff5314df6a865104a4fdf621d0e620f +md5sum = e1d4aa00b7a2d04b37a703ec6ffe4b2f [template-balancer] filename = instance-balancer.cfg.in diff --git a/stack/erp5/instance-zope.cfg.in b/stack/erp5/instance-zope.cfg.in index 4cb536873..99e7f59d6 100644 --- a/stack/erp5/instance-zope.cfg.in +++ b/stack/erp5/instance-zope.cfg.in @@ -247,7 +247,15 @@ pem = {{dumps(storage_dict.pop(k))}} <= run-common instance-home = ${directory:instance} {% if wsgi -%} -wrapped-command-line = '{{ bin_directory }}/runwsgi' {% if webdav %}-w{% endif %} {{ ipv4 }}:${:port} {% if timerserver_interval %}--timerserver-interval={{ timerserver_interval }}{% endif %} '${:configuration-file}' +wrapped-command-line = + '{{ bin_directory }}/runwsgi' + --event-log-file={{ '${' ~ conf_parameter_name ~ ':event-log}' }} + --access-log-file={{ '${' ~ conf_parameter_name ~ ':z2-log}' }} + {% if longrequest_logger_interval > 0 %} --long-request-log-file={{ '${' ~ conf_parameter_name ~ ':longrequest-logger-file}' }} {% endif %} + {% if webdav %}-w{% endif %} + {{ ipv4 }}:${:port} + {% if timerserver_interval %}--timerserver-interval={{ timerserver_interval }}{% endif %} + '${:configuration-file}' {% else -%} wrapped-command-line = '{{ bin_directory }}/runzope' -C '${:configuration-file}' {%- endif %} diff --git a/stack/erp5/site.zcml b/stack/erp5/site.zcml index e947cd7e8..c35415541 100644 --- a/stack/erp5/site.zcml +++ b/stack/erp5/site.zcml @@ -23,4 +23,6 @@ <securityPolicy component="AccessControl.security.SecurityPolicy" /> + <include package="haufe.requestmonitoring" file="monitor.zcml"/> + </configure> diff --git a/stack/erp5/zope.conf.in b/stack/erp5/zope.conf.in index a471df596..4212b43da 100644 --- a/stack/erp5/zope.conf.in +++ b/stack/erp5/zope.conf.in @@ -55,11 +55,16 @@ trusted-proxy 0.0.0.0 </product-config> {% if 'longrequest-logger-interval' in parameter_dict -%} -<product-config LongRequestLogger> - logfile {{ parameter_dict['longrequest-logger-file'] }} - timeout {{ parameter_dict['longrequest-logger-timeout'] }} - interval {{ parameter_dict['longrequest-logger-interval'] }} -</product-config> +%import haufe.requestmonitoring +<requestmonitor requestmonitor> + period {{ parameter_dict['longrequest-logger-timeout'] }}s + verbosity 0 + <monitorhandler dumper> + factory Products.ERP5Type.patches.LongRequestLogger_dumper.factory + repeat -1 + time {{ parameter_dict['longrequest-logger-interval'] }}s + </monitorhandler> +</requestmonitor> {% endif -%} -- 2.30.9