[Plone 5.2/WSGI] maillogger alternative?

The maillogger is a ZServer related functionality that is no longer available with Plone 5.2 running under WSGI.
What would be a suitable replacement (apart from external services like Sentry)?

mailinglogger is a standalone library (https://pypi.org/project/mailinglogger/) providing handlers for the standard Python logging framework, and most WSGI servers either don't interfere with Python logging or provide a way to configure it. It shouldn't be too difficult to put the pieces together.

I use tha.logcheck for my Plone4, a bit out dated, but still usable.

There is a write-up at https://reinout.vanrees.org/weblog/2009/03/31/logchecker-zope-logfiles.html

No more in pypi, but can get it at
https://dist.sixfeetup.com/public/tha.logcheck-0.6.1.tar.gz

Here is a slightly modified wsgi.ini with mail integration.
Downside is that the wsgi.ini auto-generated by the zope2instance recipe from the hardcoded wsgi_ini_template inside recipe.py. Perhaps it would make sense to extend the recipe configuration with an optional template file that could be used instead of the default wsgi.ini template.

[server:main]
paste.server_factory = plone.recipe.zope2instance:main
use = egg:plone.recipe.zope2instance#main
fast-listen = 0.0.0.0:11001
threads = 2

[app:zope]
use = egg:Zope#main
zope_conf = /home/dgho-test/onkopedia_buildout/parts/instance1/etc/zope.conf

[filter:translogger]
use = egg:Paste#translogger
setup_console_handler = False

[pipeline:main]
pipeline =
    translogger
    egg:Zope#httpexceptions
    zope

[loggers]
keys = root, plone, waitress, wsgi

[handlers]
keys = console, accesslog, eventlog, mailer

[formatters]
keys = generic, message

[logger_root]
level = INFO
handlers = console, eventlog, mailer

[logger_plone]
level = INFO
handlers = eventlog, mailer
qualname = plone

[logger_waitress]
level = INFO
handlers = eventlog, mailer
qualname = waitress

[logger_wsgi]
level = INFO
handlers = accesslog
qualname = wsgi
propagate = 0

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[handler_accesslog]
class = FileHandler
args = ('/home/dgho-test/onkopedia_buildout/var/log/instance1-access.log','a')
level = INFO
formatter = message

[handler_eventlog]
class = FileHandler
args = ('/home/dgho-test/onkopedia_buildout/var/log/instance1.log', 'a')
level = NOTSET
formatter = generic

[handler_mailer]
class = handlers.SMTPHandler
args = ('localhost', 'onkopedia@onkopedia.com', ['info@zopyx.com'], 'Error Onkopedia')
level = ERROR
formatter = generic



[formatter_generic]
format = %(asctime)s %(levelname)-7.7s [%(name)s:%(lineno)s][%(threadName)s] %(message)s

[formatter_message]
format = %(message)s

1 Like

+1. The included template is meant as a 80% case and is never going to cover every scenario.