Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

RE: suggestion for monitoring error 500

by
Regious (Private) Limited, Bill Made
- 01/05/2023 08:49:26

Hi Dominique,

I normally use the try … except like below:

 


try:

 

except Exception as e:

    mail_smtp_server = self.env["ir.mail_server"].sudo().search([], limit=1)

    email_vals = {"state": "outgoing" ,

        "subject": str(self.env.cr.dbname) + " Error in demo 1 controller  " ,

        "body_html": """Error in demo 1 controller  :  """ + str(e.message) + " " + str(e.args) ,

        "auto_delete": True,

        "email_from": mail_smtp_server.smtp_user ,

        "email_to": madeb@regious.co.zw ,

        }

    self.env["mail.mail"].create(email_vals)

 

 

Regards,

 

Bill Made

+263 733 419 060

 

 

 

From: Dominique k <notifications@odoo-community.org>
Sent: Monday, May 1, 2023 7:29 AM
To: Contributors <contributors@odoo-community.org>
Subject: suggestion for monitoring error 500

 

Hi,

 

We have a case where odoo is used as an e-commerce + portal system (with quite a lot of customisation).

Times to times, the end user (e-commerce customer) will receive an error 500.

 

It is a bit of a catchall... Would anybody have any suggestion, to monitor such error, and possibly get an email, or a warning as a system administrator? Is there a way to catch at odoo level, if there is such error and send an email ?

Or could we "monitor" the log file ? <-- any suggestion on possible tool ?

 

Thanks,

Dominique

Reference