Collect error data by using Error Reporting

This document lists the environments supported by Error Reporting andit links to language-specific guides for application developers.We recommend that you use thelanguage-specific client librariesor rely on automatically-collected log entries; however, you canwrite error data with the Cloud Logging API or the Error Reporting API.For example, if you useCloud Run,then exceptions written tostderr are automatically sent to Cloud Logging.

Error Reporting is a global service built onCloud Logging and can analyze log entries when all of the following are true:

  • Assured workloads are disabled. For more information, seeOverview of Assured Workloads.
  • Customer-managed encryption keys (CMEK) are disabled on all log buckets that store the log entry. Error Reporting can't store log entries in log buckets that have CMEK enabled. For information about how to determine the CMEK configuration for a log bucket, seeVerify key enablement.
  • The log bucket satisfies one of the following:
    • The log bucket is stored in the same project where the log entries originated.
    • The log entries were routed to a project, and then that project stored those log entries in a log bucket that it owns.

Virtual Private Cloud support

Error Reporting is a Virtual Private Cloud (VPC) supportedservice.

To reduce the risk of data exfiltration, use VPC Service Controls to create aservice perimeter around your Google-managed services.For information about VPC Service Controls and how to create a serviceparameter, see theVPC Service Controls documentation.

Configure environments to automatically report error data

For information about environment-specific configuration requirements, seethe following guides:

Instrument apps by using client libraries

For information about how to configure your application to send error reports,see the language-specific configuration guides:

Write error data by using an API

You can report error events to your Google Cloud project byexecuting the Error Reporting API methodreportor the Cloud Logging API methodwrite.

  • If you require API key-based authentication, then you must use theError Reporting API. To report an error event by using theError Reporting API, execute the methodreportand format the request body of the method as aReportedErrorEvent object.

    When you use the Error Reporting API, log entries with properlyformatted error messages are automatically generated and written toCloud Logging. These log entries are written to a logwhoselogName is formatted as follows:

    projects/PROJECT_ID/clouderrorreporting.googleapis.com%2Freported_errors

    Because log entries are generated by calls toreport, you might incurCloud Logging ingestion costs. To control which log entries are ingested,seeExclusion filters.

    If you report error events by using the Error Reporting API,the remainder of this document doesn't apply.

  • If you want to use the Cloud Logging API, then you must format theLogEntry object so that includes a stack trace,or aReportedErrorEvent object. For more informationabout the formatting requirements, seeFormat errors in logs.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.