If your application errors are not showing up in Error Reporting, follow the steps below to troubleshoot.
When using logs
Generate a sample log entry
To confirm your project settings, you can programmatically generate a log entry
that will be picked up by Error Reporting with the following gcloud
command:
gcloud logging write --payload-type=json test-errors-log \
'{"serviceContext":
{"service": "manual-testing"},
"message": "Test Error\n at /test.js:42:42",
"context": {"httpRequest":
{"url": "/test","method": "GET","responseStatusCode": 500}}}'
Then open Error Reporting and confirm that you see the newly created error.
Confirm the log entry format
Navigate to the Cloud Logging page and locate a log entry that contains exception data sent from your application.
Confirm that the log entry uses the expected format.
When using the Error Reporting API
Enable the API
Confirm that you have the Error Reporting API enabled in the Cloud Console.
Send a test error
Try sending an error to the service manually.
You can report a test error to Error Reporting using the following
gcloud
command:
gcloud beta error-reporting events report --service Manual --service-version test1 \
--message "java.lang.TestError: msg
at com.example.TestClass.test(TestClass.java:51)
at com.example.AnotherClass(AnotherClass.java:25)"
You can use a cURL command to test your REST API calls. Replace
PROJECT_ID
and API_KEY
with your valid values before sending the following
command:
curl -X POST -H "Content-Type: application/json" \
-d '{"message":"java.lang.TestError: msg\n\tat com.example.TestClass.test(TestClass.java:51)\n\tat com.example.AnotherClass(AnotherClass.java:25)","serviceContext":{"service":"manual-testing"}}' \
https://clouderrorreporting.googleapis.com/v1beta1/projects/PROJECT_ID/events:report?key=API_KEY
Confirm the sent payload
Make sure that your application is sending exception data to the API in the correct format and that it contains the required attributes.