Google Cloud Professional Cloud Developer — Question 24
You are deploying your application to a Compute Engine virtual machine instance. Your application is configured to write its log files to disk. You want to view the logs in Stackdriver Logging without changing the application code.
What should you do?
Answer options
- A. Install the Stackdriver Logging Agent and configure it to send the application logs.
- B. Use a Stackdriver Logging Library to log directly from the application to Stackdriver Logging.
- C. Provide the log file folder path in the metadata of the instance to configure it to send the application logs.
- D. Change the application to log to /var/log so that its logs are automatically sent to Stackdriver Logging.
Correct answer: A
Explanation
The correct answer is A because installing the Stackdriver Logging Agent allows for log collection without changing the application code. Option B is incorrect as it involves modifying the application. Option C does not provide a standalone solution since it requires additional setup without the agent. Option D also necessitates altering the application, which is not desired in this scenario.