plone / plone.recipe.zope2instance

zc.buildout recipe to setup and configure a Zope 2 instance.
https://pypi.org/project/plone.recipe.zope2instance
6 stars 23 forks source link

"./bin/instance logtail" now needs a logfile argument #85

Closed jensens closed 5 years ago

jensens commented 5 years ago

Usually, with ZServer, it was enough to do a ./bin/instance logtail. Now with WSGI this is not sufficient.

So, ./bin/instance logtail var/log/instance.log works.

Is this by intend? Or is it a regression?

MrTango commented 5 years ago

@petschki any idea?

MrTango commented 5 years ago

ah no @tschorr was working on that ;)

tschorr commented 5 years ago

I wasn't. I guess nobody was, that's why it's broken 8-)

dataflake commented 5 years ago

I have looked at it a little bit and I'm not sure if it's possible to bring this back in a sane way.

With WSGI, Zope does not use its own logging configuration anymore, and we cannot just read log file paths out of zope.conf. Logging is configured in the WSGI .ini configuration.

Yes, I can find that file while startup is processing, but I can't rely on finding specific names or contents because plone.recipe.zope2instance allows users to create and use their own WSGI configuration. As far as logging configuration goes, it's free form.

The logging module doesn't have any functions to e.g. say "read this configuration and give me information about it", like what handlers and their file paths are defined. It just allows you to load it and reconfigure the logging system with it. Even if you just load it and the configuration is changed there's no good way to ask the logging module about all its loggers and their handlers. Since logger naming is essentially unknown at that point (with user-created WSGI configurations there may not be a plone logger) the only logger you will always get reliably is the un-named root logger.

The best I can think of is to do the following in plone.recipe.zope2instance.ctl.main:

Feels a bit scary and convoluted.