Stackdriver Error reporting reporting not working with go appengine app

626 Views Asked by At

I'm trying to write my error log to stackdriver error reporting from a golang appengine app

Inside a goroutine i do the following

fmt.Fprintf(os.Stderr, "%s %s %s", name, kind, err.Error())

I'm seeing the error in stackdriver logging

but i don't have any alert in stackdriver error reporting, from the google documentation

Error logs written to stderr are processed automatically by Error Reporting, without needing to use the Error Reporting package for Go directly.

Do you know why my error are not being shown in error reporting ?

2

There are 2 best solutions below

0
On

Logs should be properly formatted. You need to use the GCP logging library: "cloud.google.com/go/logging".

Additional details here: https://cloud.google.com/logging/docs/setup/go.

0
On

Regarding receiving notifications for the entries of errors in Error Reporting, can you confirm that the notifications are indeed enabled by going to [Google Cloud Console] > [Error Reporting] > There should be a box saying: [Get notified when a new error occurs in this project.] if your notifications are off.

On what concerns the documentation quote:

Error logs written to stderr are processed automatically by Error Reporting, without needing to use the Error Reporting package for Go directly.

The expected behavior is that Error Reporting will pick up anything written to stderr as an error but will not ‘capture’ everything to store and analyze.

However, as explained in this documentation,

Error Reporting will provide entries only when errors occur in the code error’s stack trace.

Hence, the error should for example originate from your application code itself and not from from Google App Engine and this error would be displayed in Error Reporting.

I recommend you to use the Error Reporting Client Library for Go (possibly the only way without building a reporting system on your own), as described in the documentation, having notification enabled on the errors reported. The setup page provides all the steps to start working with the Client Library and also provides a code sample about reporting to the Dashboard. These entries will be displayed in the Error Reporting Dashboard page.

Moreover on this, during my investigation, I came across a Public Issue, which even though concerns Python, it might be related.

Additionally, note that Error Reporting is a beta issue per documentation so you should be aware that this feature is not covered by any SLA or deprecation policy and may be subject to backward-incompatible changes.

I hope you find this information useful.