Skip to Content
Menu
This question has been flagged
3 Replies
3316 Rodiniai

Hi,

I'm starting to develop my first odoo module in odoo 14. For a while I could just print to the standard output using the print() method in Python, but for an unknown reason it started not working anymore. I also tried to use a logger but it doesn't work either.


When it used to work my output was logging me something each time I was moving from a page to another but it doesn't do it anymore. 


Anyone has an idea what could cause this ? 

Thanks !

Portretas
Atmesti
Best Answer

Hi,

If you need to use the logger in your functions, first you need to import the logging in your file using import logging

and add the logger;_LOGGER = logging.getLogger(__name__)

by doing these steps you can add logger in you functions by,example:_LOGGER.info("demo print")
-- 


Hope it helps

Portretas
Atmesti
Best Answer

Hello, Pierre-Loïc de Schaetzen,


I hope you are doing well.

Please find code in comment. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Portretas
Atmesti

- In the Python Code Below:-

logger = logging.getLogger(__name_)

class<<Add your Class>>:
def <<Your Method Name>>:

<<---Add Your Code--->>

_logger.info(<<Add Message Here>>)

You can also use logger.warning, logger.error, logger.debug, and logger.exception in the added _logger.info.

Autorius Best Answer

Thanks for your reply.

Yes I tried to run it in the debug channel as well and it still doesn't work. I changed the logfile to "" so it logs everything to the standard output. Where can I check the code that handles the output ? 

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
1
geg. 18
39275
2
kov. 15
13260
0
kov. 15
4851
0
liep. 24
1200
0
rugp. 18
6968