Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
De nombreux langages de programmation disposent d'interfaces d'écriture de journaux standards que vous pouvez reconfigurer afin d'utiliser Logging.
Écrire des journaux
Pour écrire des journaux dans Cloud Logging, vous pouvez effectuer l'une des opérations suivantes:
Écrivez vos journaux dans des fichiers journaux existants tels que syslog sur votre instance de VM Compute Engine et utilisez l'Agent Ops pour envoyer les journaux à Cloud Logging. Pour en savoir plus, consultez la page Agents Google Cloud Observability.
Configurez un package de journalisation standard pour envoyer les journaux que vous écrivez à Logging. Pour en savoir plus, consultez les pages d'informations suivantes :
Utilisez la CLI gcloud. Pour en savoir plus, consultez l'interface de ligne de commande gcloud logging.
Associer des données de trace à des entrées de journal
Les entrées de journal peuvent contenir des informations sur les traces. En incluant des données de trace dans les entrées de journal, vous pouvez mettre en corrélation les journaux et les traces pour améliorer le dépannage distribué. Pour en savoir plus sur la capture manuelle et automatique des informations de trace dans les entrées de journal, consultez la section Intégration à Cloud Logging.
Lire les journaux
Pour lire les entrées de journal dans Logging, effectuez l'une des opérations suivantes :
Dans la console Google Cloud , accédez à la page Explorateur de journaux.
Utilisez la CLI gcloud. Pour en savoir plus, consultez l'interface de ligne de commande gcloud logging.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/05 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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."]]