İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
3326 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
En İyi Yanıt

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
Vazgeç

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

Üretici En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
May 18
39279
2
Mar 15
13273
0
Mar 15
4854
0
Tem 24
1207
0
Ağu 18
6972