Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
3 Besvarelser
3338 Visninger

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 !

Avatar
Kassér
Bedste svar

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

Avatar
Kassér
Bedste svar

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

Avatar
Kassér

- 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.

Forfatter Bedste svar

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 ? 

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
1
maj 18
39302
2
mar. 15
13279
0
mar. 15
4866
0
jul. 24
1215
0
aug. 18
6987