Stay organized with collections Save and categorize content based on your preferences.
Many programming languages have standard log-writing interfaces that you can reconfigure to use Logging.
Write logs
To write logs to Cloud Logging, you can do any of the following:
Write your logs to existing log files such as syslog on your Compute EngineVM instance and use the Ops Agent to send the logs to Cloud Logging. For more information, see Google Cloud Observability agents.
Configure a standard logging package to send the logs you write to Logging. For more information, see the following detail pages:
Log entries can contain information about traces. By including trace data in log entries, you can correlate logs and traces to enable better distributed troubleshooting. For information about manual and automatic capture of trace information in log entries, see Integrate with Cloud Logging.
Read logs
To read log entries in Logging, you can do any of the following:
In the Google Cloud console, go to the Logs Explorer page:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["# Logging libraries overview\n\nMany programming languages have standard log-writing interfaces that you can reconfigure to use Logging.\n\n\u003cbr /\u003e\n\n| **Note:** You can instrument your application so that it collects application-specific information. Several open-source instrumentation frameworks let you collect metrics, logs, and traces from your application and send that data to any vendor, including Google Cloud. To instrument your application, we recommend that you use a vendor-neutral instrumentation framework that is open source, such as [OpenTelemetry](https://opentelemetry.io/), instead of vendor- and product-specific APIs or client libraries.\n|\n| \u003cbr /\u003e\n|\n| For information about instrumenting your applications by using\n| vendor-neutral instrumentation frameworks, see\n| [Instrumentation and observability](/stackdriver/docs/instrumentation/overview).\n\nWrite logs\n----------\n\nTo write logs to Cloud Logging, you can do any of\nthe following:\n\n- Write your logs to existing log files such as `syslog` on your Compute EngineVM instance and use the Ops Agent to send the logs to Cloud Logging. For more information, see [Google Cloud Observability agents](/logging/docs/agent).\n- Configure a standard logging package to send the logs you write to Logging. For more information, see the following detail pages:\n - Any language: [fluentd](https://www.fluentd.org/)\n - [C#: Using ASP.NET or calling\n the API](/logging/docs/integrate/dotnet)\n - [Java: Using Logback and\n java.util.logging](/logging/docs/setup/java)\n - [Go: Using standard logging](/logging/docs/setup/go)\n - [Node.js: Using Winston and Bunyan](/logging/docs/setup/nodejs)\n - [PHP: Using PSR-3 logger](/logging/docs/setup/php)\n - [Python: Using the standard logging\n facility](/logging/docs/setup/python)\n - [Ruby: Using the Google Cloud Observability\n gem](/logging/docs/setup/ruby)\n- Call the Logging API using Logging's [Client Libraries](/logging/docs/reference/libraries) for your programming language.\n- Call the Logging API REST endpoint directly. See the [Logging API reference documentation](/logging/docs/reference/v2/rest).\n- Use the [gcloud CLI](/sdk/docs). For more information, see the [`gcloud logging`](/logging/docs/reference/tools/gcloud-logging) command-line interface.\n\n\u003cbr /\u003e\n\n| **Note:** Incoming log entries with timestamps that are more than the [logs retention period](/logging/quotas#logs_retention_periods) in the past or that are more than 24 hours in the future are discarded.\n\nAssociate trace data with log entries\n-------------------------------------\n\nLog entries can contain information about traces. By including trace data\nin log entries, you can correlate logs and traces to enable better\ndistributed troubleshooting. For information about manual and\nautomatic capture of trace information in log entries, see\n[Integrate with Cloud Logging](/trace/docs/trace-log-integration).\n\nRead logs\n---------\n\nTo read log entries in Logging, you can do any of\nthe following:\n\n- In the Google Cloud console, go to the **Logs Explorer** page:\n\n [Go to **Logs Explorer**](https://console.cloud.google.com/logs/query)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Logging**.\n\n For more information, see\n [Logs Explorer overview](/logging/docs/view/logs-explorer-interface).\n- Call the Logging API through\n the [client libraries](/logging/docs/reference/libraries) for your\n programming language.\n\n- Call the Logging API REST endpoints directly.\n See the [Logging API reference documentation](/logging/docs/reference/v2/rest).\n\n- Use the [gcloud CLI](/sdk/docs). For more information, see the\n [`gcloud logging`](/logging/docs/reference/tools/gcloud-logging) command-line interface."]]