Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Viele Programmiersprachen haben Standardoberflächen zum Schreiben von Logs, die Sie für die Verwendung von Logging konfigurieren können.
Logs schreiben
Sie haben folgende Möglichkeiten, um Logs in Cloud Logging zu schreiben:
Schreiben Sie Ihre Logs in vorhandene Logdateien wie syslog auf Ihrer Compute Engine-VM-Instanz und verwenden Sie den Ops-Agent, um die Logs an Cloud Logging zu senden. Weitere Informationen finden Sie unter Google Cloud Observability-Agents.
Konfigurieren Sie ein Standard-Logging-Paket, um die von Ihnen geschriebenen Logs an Logging zu senden. Weitere Informationen finden Sie auf den folgenden Seiten:
Verwenden Sie die gcloud CLI. Weitere Informationen finden Sie in der gcloud logging-Befehlszeile.
Trace-Daten mit Logeinträgen verknüpfen
Logeinträge können Informationen zu Traces enthalten. Wenn Sie Trace-Daten in Logeinträge aufnehmen, können Sie Logs und Traces korrelieren, um eine bessere verteilte Fehlerbehebung zu ermöglichen. Informationen zum manuellen und automatischen Erfassen von Trace-Informationen in Logeinträgen finden Sie unter In Cloud Logging einbinden.
Protokolle lesen
Sie haben folgende Möglichkeiten, um Logeinträge in Logging zu lesen:
Rufen Sie in der Google Cloud Console die Seite Log-Explorer auf:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-05 (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."]]