Posts

Showing posts with the label Google Cloud Logging

Spring Boot Google Cloud Logging example

Image
In this section,  we will deploy a Spring Boot application in Google Cloud App Engine, and  we will introduce how to write logs to Google Cloud Logging and how to check the logs in the Logs Explorer. 1. Creating a simple spring boot web application First, open the Spring initializr  https://start.spring.io/   Then, Provide the Group and Artifact name. We have provided Group name  com.knf.dev.demo  and Artifact  spring-boot-gcp-logging-example . Here I selected the  Maven  project - language  Java 11  -  Spring Boot  2.7.9  and  add  Spring web dependency,  and GCP Support . Then, click on the Generate button. When we click on the Generate button, it starts packing the project in a .zip( spring-boot-gcp-logging-example ) file and downloads the project. Then, Extract the Zip file.  Then, import the project on your favourite IDE. Final Project directory: In the pom.xml, add Stackdriver Logging Starter: <!-- Starter for Stackriver Logging --> < dependency > < groupId >