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¶
Response:
Performance Monitoring¶
Key Metrics¶
- Response Time - Average API response time
- Error Rate - Percentage of 5xx errors
- Database Queries - Slow query detection
- 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: