Skip to content

Monitoring Guide

Logging

Application Logs

The backend uses structured logging with levels:

Level Usage
DEBUG Detailed debugging info
INFO General operational events
WARNING Unexpected but handled situations
ERROR Errors that need attention
CRITICAL System failures

Log Locations

# Backend logs (in container)
docker-compose logs -f backend

# Access logs (nginx)
docker-compose logs -f nginx

Log Format

{
  "timestamp": "2026-05-17T10:30:00Z",
  "level": "ERROR",
  "message": "Shipment not found",
  "context": {
    "shipment_id": "uuid",
    "tenant_id": "uuid"
  }
}

Health Checks

Backend Health

curl http://localhost:8000/api/v1/health

Response:

{
  "status": "healthy",
  "timestamp": "2026-05-17T10:30:00Z"
}

Performance Monitoring

Key Metrics

  1. Response Time - Average API response time
  2. Error Rate - Percentage of 5xx errors
  3. Database Queries - Slow query detection
  4. Memory Usage - Container memory consumption

Alerting

Condition Severity Action
Error rate > 5% High Notify team
Response time > 2s Medium Review slow endpoints
Memory > 80% Medium Scale or investigate

Debug Mode

Enable debug mode for verbose logging:

# In .env
DEBUG=true
LOG_LEVEL=DEBUG