Logging re-initialized in make_app()

Wolfgang Scherer Wolfgang.Scherer at gmx.de
Wed Dec 11 23:34:34 UTC 2019


Hi,

Am 08.12.19 um 20:20 schrieb Thomas De Schampheleire:
> Hi Wolfgang,
>
> El mié., 4 dic. 2019 a las 2:11, Mads Kiilerich (<mads at kiilerich.com>) escribió:
>> On 12/4/19 1:36 AM, Wolfgang Scherer wrote:
>>> When following the instructions for WSGI dispatch at https://kallithea.readthedocs.io/en/latest/setup.html#apache-with-mod-wsgi any attempt to pass defaults to the logging initialization fails later, when logging is initialized again in :func:`make_app` of |kallithea/config/middleware.py|.
>>>
>>> See http://sw-amt.ws/kallithea-deploy/html/overview.html#bug-logging-re-initialized-in-make-app for a full description of the bug.
>>>
>>> Attached is a patch, that works for me.
>>
>> Thanks for the report and patch!
>>
>> It seems like some different strategies could be:
>>
>> 1. don't initialize logging in the WSGI script - just rely on what is
>> happening in make_app.
This is not a good idea, since the administrator may wish to specify run-time configuration defaults.
>>
>> 2. don't initialize logging in make_app - make sure it is initialized in
>> all code paths that end up in make_app ... such as WSGI script and
>> kallithea-cli.
This is the correct solution. I have checked all initialization pathes: gearbox serve, kallithea-cli, kallithea mod_wsgi (and pserve, paster serve).
>>
>> Do you have any experience with these alternative approaches ... or
>> thoughts about why they might be good or bad?
> Any feedback on this?

I finished the analysis of logging initialization (http://sw-amt.ws/kallithea-deploy/html/overview.html#bug-logging-re-initialized-in-make-app). Since I don't think that all the packages will be updated any time soon, I will stay with the minimum required corrections in Kallithea (see attached patch).

The initialization schema is generally

1. Initialize logging (each toolkit rolls their own, but defaults
   :attr:`__file__` and :attr:`here` are always set)
2. Load WSGI application (:func:`paste.deploy.loadapp`)

Wolfgang

-------------- next part --------------
A non-text attachment was scrubbed...
Name: kallithea-logging.patch
Type: text/x-patch
Size: 2185 bytes
Desc: not available
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20191212/2a577634/attachment.bin>


More information about the kallithea-general mailing list