Print to Console

Hi, I need to print to console during testing my custom module.
I already create logging configuration, which logging level = DEBUG and execute it when starting the app like below:

trytond -c trytond.conf --logconf logging.conf

Inside my code block I do something like:

import logging

logger = logging.getLogger(__name__)

def method_name():
      logger.info(">>>>>>>>>>>>>>>> HELLO")

OR

def method_name():
     print(">>>>>>>>>>>>> HELLO")

I am still unable to see both message printed in my console… can anybody help? again I am very new to python programming.

Best regards
Bromo

Hi Bromo,

If you’re not seeing output from print() or logger.info() in your console, it’s likely due to the logging level configuration in Tryton. By default, Tryton only displays messages of level ERROR in the console. To see INFO or DEBUG messages, you need to adjust the verbosity level when starting the server.​
Here’s how you can do it:

  1. For INFO level messages:

trytond -c trytond.conf -v

  1. For DEBUG level messages:

trytond -c trytond.conf -v --dev

The -v or --verbose flag increases the verbosity level, allowing INFO messages to be displayed. Adding the --dev flag further increases verbosity to include DEBUG messages.

1 Like

2 posts were split to a new topic: Can I override create method

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