DVA-C02 exam dumps

DVA-C02 practice question 372 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 372

Single answer

You are developing a serverless application using AWS Lambda and need to ensure that your logs are structured to allow for efficient querying and debugging. Which approach should you take to implement structured logging in your application?

  1. A

    Use a logging library to output logs in JSON format and send them to Amazon CloudWatch Logs.

  2. B

    Write raw text logs directly to Amazon S3 for later analysis with Amazon Athena.

  3. C

    Log data in plain text format and add custom metadata by manually parsing logs when needed.

  4. D

    Use AWS X-Ray to automatically structure all your logs without requiring any additional configuration.

Show answer and explanation

Correct answer: A

Explanation

Structured logging involves formatting logs in a machine-readable structure like JSON, which makes it easier to query, analyze, and debug logs. Using a logging library to emit JSON-formatted logs and integrating with Amazon CloudWatch Logs is a best practice for serverless applications on AWS.

  • A. Correct.

    Correct. Using a logging library to output logs in JSON format ensures logs are structured and machine-readable, enabling efficient querying and debugging in CloudWatch Logs.

  • B. Incorrect.

    Incorrect. While Amazon S3 and Athena can be used for log analysis, this approach is inefficient for real-time debugging and querying compared to structured logging in CloudWatch.

  • C. Incorrect.

    Incorrect. Logging in plain text and manually parsing metadata is error-prone and inefficient, especially in large-scale applications.

  • D. Incorrect.

    Incorrect. AWS X-Ray is used for distributed tracing but does not automatically structure application logs for querying and debugging.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam