Skip to content

Commit 99498b2

Browse files
committed
fix: Change scheduler watchdog and loop logs from DEBUG to INFO level
- Change watchdog periodic status log from DEBUG to INFO - Change scheduler loop status logs from DEBUG to INFO - Add next_run_time to watchdog and scheduler loop logs for better visibility This ensures scheduler activity is visible in production logs, making it easier to diagnose if scheduler stops running. Previously, these logs were at DEBUG level and not visible in production, making it hard to track scheduler state between cycles. Fixes: Missing logs between cycles making it unclear if scheduler is running
1 parent 25caca4 commit 99498b2

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

backend/api/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ async def scheduler_watchdog():
978978
# Scheduler is running - log status periodically (every 30 minutes = 6 checks)
979979
import time
980980
if int(time.time()) % 1800 < 300: # Log roughly every 30 minutes
981-
logger.debug(f"✅ Learning scheduler watchdog: Scheduler is running (is_running={is_running}, task_done={task_done}, cycle_count={learning_scheduler.cycle_count})")
981+
logger.info(f"✅ Learning scheduler watchdog: Scheduler is running (is_running={is_running}, task_done={task_done}, cycle_count={learning_scheduler.cycle_count}, next_run={learning_scheduler.next_run_time.isoformat() if learning_scheduler.next_run_time else 'N/A'})")
982982

983983
except asyncio.CancelledError:
984984
logger.info("Scheduler watchdog cancelled")

backend/services/learning_scheduler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ async def _scheduler_loop(self):
262262
# Wait for next interval
263263
wait_seconds = self.interval_hours * 3600
264264
logger.info(f"⏳ Waiting {self.interval_hours} hours until next learning cycle...")
265-
logger.debug(f"🔍 Scheduler loop: is_running={self.is_running}, wait_seconds={wait_seconds}")
265+
logger.info(f"🔍 Scheduler loop: is_running={self.is_running}, wait_seconds={wait_seconds}, next_run_time={self.next_run_time.isoformat() if self.next_run_time else 'N/A'}")
266266

267267
# Use stop event to allow immediate cancellation
268268
try:
@@ -285,7 +285,7 @@ async def _scheduler_loop(self):
285285

286286
logger.info("🔄 Scheduler loop: About to run next learning cycle...")
287287
await self.run_learning_cycle()
288-
logger.debug("✅ Scheduler loop: Learning cycle completed, continuing loop...")
288+
logger.info("✅ Scheduler loop: Learning cycle completed, continuing loop...")
289289

290290
except asyncio.CancelledError:
291291
logger.info("🛑 Learning scheduler task cancelled")

0 commit comments

Comments
 (0)