# 📊 Logging Configuration Guide ## Quick Log Level Changes ### Using the Script (Recommended) ```bash # Check current level ./scripts/set-log-level.sh # Set to minimal logging (production-like) ./scripts/set-log-level.sh warn # Set to normal development logging ./scripts/set-log-level.sh info # Set to detailed debugging ./scripts/set-log-level.sh debug ``` ### Manual Configuration Edit `.env` file: ```bash LOG_LEVEL="info" # Change this value ``` ## Log Levels Explained | Level | Numeric | What You'll See | Best For | |-------|---------|-----------------|----------| | `error` | 0 | Only critical errors | Production monitoring | | `warn` | 1 | Warnings + errors | Quiet development | | `info` | 2 | General operations | **Normal development** ⭐ | | `debug` | 3 | Detailed debugging | Troubleshooting issues | | `trace` | 4 | Very verbose tracing | Deep debugging | ## What's Been Optimized ### ✅ Reduced Noise - **HTTP requests/responses**: Filtered out health checks, static assets - **Request bodies**: Hidden by default (security + noise reduction) - **Response bodies**: Hidden by default (reduces overwhelming output) - **Session checks**: Frequent `/api/auth/session` calls ignored ### ✅ Cleaner Output - **Pretty formatting**: Colored, timestamped logs in development - **Message focus**: Emphasizes actual log messages over metadata - **Structured data**: Still available but not overwhelming ### ✅ Security Enhanced - **Sensitive data**: Automatically redacted (tokens, passwords, etc.) - **Production ready**: No debug info exposed to customers ## Common Scenarios ### 🔇 Too Much Noise? ```bash ./scripts/set-log-level.sh warn ``` ### 🐛 Debugging Issues? ```bash ./scripts/set-log-level.sh debug ``` ### 🚀 Normal Development? ```bash ./scripts/set-log-level.sh info ``` ### 📊 Production Monitoring? ```bash ./scripts/set-log-level.sh error ``` ## Environment Variables ```bash # Core logging LOG_LEVEL="info" # Main log level DISABLE_HTTP_LOGGING="false" # Set to "true" to disable HTTP logs entirely # Application context APP_NAME="customer-portal-bff" # Service name in logs NODE_ENV="development" # Affects log formatting ``` ## Restart Required After changing log levels, restart your development server: ```bash # Stop current server (Ctrl+C) # Then restart pnpm dev ``` The new log level will take effect immediately.