Skip to content

[DevOps] Centralized Structured JSON Logging Implementation #176

Description

@AlAfiz

Description: Refactor the API's global logging architecture to output strictly formatted JSON strings rather than raw console text, preparing the application for ingestion by centralized monitoring tools like AWS CloudWatch or the ELK stack.
Context / Motivation: Standard console.log is useless at scale. When troubleshooting production issues across load-balanced containers, we need structured metadata (timestamps, request IDs, log levels) to filter and query logs effectively.
Acceptance Criteria: - [ ] Replace all standard console calls with a high-performance logging library like Pino or Winston.

  • Ensure all logs output in a flat JSON format (e.g., {"level":"info","time":167890,"msg":"...","reqId":"xyz"}).
  • Implement an Express middleware that automatically logs all incoming HTTP requests, recording the method, path, status code, and response duration.
    Technical Pointers: Add a correlation ID (X-Request-ID) to the initial request payload and pass it down through the controllers so you can trace a single user's action across all corresponding database logs.

Metadata

Metadata

Assignees

Labels

DevopsGrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaignhelp wantedExtra attention is needed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions