From 996705b4fdfa09c7939c335485642498f26bacbc Mon Sep 17 00:00:00 2001 From: cproudlock Date: Fri, 21 Nov 2025 11:23:11 -0500 Subject: [PATCH] Add daily log rotation to api.asp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: api.log was growing indefinitely with no rotation Impact: With 200+ PCs reporting daily, log file would grow to 2+ GB/year Fix: Changed logging to create daily log files - Old: logs/api.log (single file, grows forever) - New: logs/api-YYYY-MM-DD.log (one file per day) Example log files: - logs/api-2025-11-21.log - logs/api-2025-11-22.log - logs/api-2025-11-23.log Benefits: - Easier to troubleshoot (find logs by date) - Automatic separation (no manual log rotation needed) - Can delete old logs after N days - File sizes manageable (~6MB/day estimated) Cleanup Recommendation: Delete logs older than 30 days: forfiles /p "C:\inetpub\wwwroot\shopdb\logs" /s /m api-*.log /d -30 /c "cmd /c del @path" Or use Windows Task Scheduler to automate cleanup 🤖 Generated with Claude Code Co-Authored-By: Claude --- api.asp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api.asp b/api.asp index d686e5f..36c3d94 100644 --- a/api.asp +++ b/api.asp @@ -1528,7 +1528,10 @@ Sub LogToFile(message) On Error Resume Next Dim fso, logFile, logPath - logPath = Server.MapPath("./logs/api.log") + ' Create daily log files: api-2025-11-21.log + Dim logFileName + logFileName = "api-" & Year(Now()) & "-" & Right("0" & Month(Now()), 2) & "-" & Right("0" & Day(Now()), 2) & ".log" + logPath = Server.MapPath("./logs/" & logFileName) Set fso = Server.CreateObject("Scripting.FileSystemObject")