Log et configuration WSGI

82 views
Skip to first unread message

Fabien Castarède

unread,
Jun 1, 2016, 5:26:47 AM6/1/16
to tryton-fr
Lorsqu'on démarre le serveur trytond via la commande trytond, on peut indiquer une fichier de configuration des log via le paramètre --logconf. En lançant Tryton via un process WSGI, comment peut-on intégrer cette configuration des log ?

Cédric Krier

unread,
Jun 1, 2016, 6:20:02 AM6/1/16
to tryton-fr
Pour moi, c'est la tâche du serveur WSGI de configurer le logging dans
ce cas. Par exemple, gunicorn a une option "--log-config".

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Fabien Castarède

unread,
Jun 1, 2016, 10:58:17 AM6/1/16
to tryton-fr


Le mercredi 1 juin 2016 12:20:02 UTC+2, Cédric Krier a écrit :
On 2016-06-01 02:26, Fabien Castarède wrote:
> Lorsqu'on démarre le serveur trytond via la commande trytond, on peut
> indiquer une fichier de configuration des log via le paramètre --logconf.
> En lançant Tryton via un process WSGI, comment peut-on intégrer cette
> configuration des log ?

Pour moi, c'est la tâche du serveur WSGI de configurer le logging dans
ce cas. Par exemple, gunicorn a une option "--log-config".

J'utilise uwsgi pour lancer un script wsgi.py qui fournit l'application WSGI. Dans la configuration de uwsgi je ne vois pas comment configurer le logger dans Tryton. Du coup j'ai fait autrement, en modifiant mon script wsgi.py pour configurer le logger :

wsgi.py :
import logging.config
from trytond.application import app

logconf = 'trytond-logconf.ini'
logging.config.fileConfig(logconf)
logging.getLogger('server').info('using %s as logging '
    'configuration file', logconf)
logging.captureWarnings(True)
application = app


Reply all
Reply to author
Forward
0 new messages