Added detailed debug logging throughout the application to diagnose production issues on Windows Server with MySQL 5.6. Debug Features: - Enable with environment variable: DEBUG=true - Logs database connection attempts with host, port, user, database - Shows MySQL version on successful connection - Tracks query execution step-by-step - Reports row counts fetched from database - Shows data conversion progress - Categorization results (current vs upcoming events) - All errors include error codes, SQL state, and full stack traces Debug output includes: - Connection parameters (host:port/database) - MySQL server version - Query execution status - Number of rows returned - Data conversion steps - Event categorization counts Startup now shows: - DEBUG MODE: ENABLED/DISABLED - Database connection info - Instructions to enable debug mode Error responses now include: - Full error message - Error code (errno) - SQL state (if available) - Complete stack trace Usage on Windows production: set DEBUG=true python app.py Or with PM2: pm2 delete shopfloor-dashboard pm2 start app.py --name shopfloor-dashboard --interpreter python3 --env DEBUG=true pm2 logs shopfloor-dashboard This will help identify the exact cause of 500 errors without switching to a different MySQL connector. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
6.9 KiB
6.9 KiB