Strukturiertes Log-Einträge in Cloud Functions schreiben
bookmark_borderbookmark
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Dieses Beispiel zeigt, wie Sie mit dem Google Cloud Logging-Client strukturierte Logs in Cloud Functions schreiben. Strukturierte Logs bieten eine detailliertere und organisierte Möglichkeit, Informationen zu Ihrer Anwendung aufzuzeichnen, was die Fehlerbehebung und Analyse von Problemen erleichtert.
Codebeispiel
Nächste Schritte
Informationen zum Suchen und Filtern von Codebeispielen für andere Google Cloud -Produkte finden Sie im Google Cloud Beispielbrowser.
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
[[["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"]],[],[[["This sample demonstrates how to write structured logs in Cloud Functions using the Google Cloud logging client in both Node.js and Python."],["Structured logs offer a detailed and organized method for recording application information, aiding in issue troubleshooting and analysis."],["The code examples showcase initializing the logging client, creating log entries with metadata like severity and components, and writing them to the log."],["In both samples, setting up Application Default Credentials is required for authenticating to Cloud Run functions."],["The HTTP request data is attached automatically for request-log correlation."]]],[]]