Deactivating trytond logging when running a proteus script

How can I deactivate trytond logging when running a proteus script? Since short time I get the logging of trytond at debug level on stderr and I don’t know why. My Tryton version is 6.0.34 and the trytond.conf has the following content:

[database]
uri = postgresql://***:***@localhost:5432/
language = de
list = false

[web]
listen = localhost:8100
root = /home/***/TRYTON/Vers6.0skr04/sao

(The asteriks are my username and password.)

I use proteus a described in the Tryton documentation. This is the command to connect with trytond:

import proteus
confProteus = proteus.config.set_trytond('postgresql://***:***@localhost:5432/Vers6.0skr04', config_file='trytond.conf')

If further informations are necessary, please let me know.

Thanks a lot for any hint.

trytond use the stdlib logging module. So you can configure it in your proteus script.
Normally the default logging level is not set.

If I try

from trytond.config import logger
import logging

logger.setLevel(logging.ERROR)

in my proteus script, there is no effect. INFO and DEBUG logging messages are further appearing in stderr.

Then you have something else after that that reset the level.

Hi, maybe there’s a better way but I have done something like this

trytond_logs = ['trytond.modules', 'trytond.pool', 'trytond.cache',
    'trytond.backend.postgresql.database', 'passlib.utils.compat',
    'passlib.registry']


def main(options):
    ...
    # Minimize trytond logs, just errors
    for log_name in trytond_logs:
        log = logging.getLogger(log_name)
        log.setLevel(logging.ERROR)

Thank You! It works fine.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.