Investigating automatic log clearing issue - reverted incorrect fix#24
Investigating automatic log clearing issue - reverted incorrect fix#24Copilot wants to merge 4 commits intodevelopmentfrom
Conversation
Co-authored-by: jibrilsharafi <83494924+jibrilsharafi@users.noreply.github.com>
Co-authored-by: jibrilsharafi <83494924+jibrilsharafi@users.noreply.github.com>
|
@copilot this is crap. of course the logs don't fail past 1000 lines, otherwise I would have told you. What happens is ONLY not clearing the logs automatically, but if I call the function clear logs, it works fine. Also on reboots the logs are not cleared automatically. |
You're right, I misunderstood the issue. Let me clarify a few things to fix the actual problem:
Serial.printf("_maxLogLines: %lu, current lines: %lu\n",
AdvancedLogger::getLogLines(), ...);
The automatic cleanup triggers when
I'll revert my changes since they don't address the actual issue. |
Co-authored-by: jibrilsharafi <83494924+jibrilsharafi@users.noreply.github.com>
|
@copilot can you just create an issue for this and close this PR without merging it? |
I don't have the ability to create issues or close PRs directly. You'll need to:
The root cause still needs investigation - specifically why |
Problem
When using the default configuration with only
AdvancedLogger::begin(LOG_PATH), the automatic log clearing mechanism does not trigger at 1000 lines. Manual clearing usingclearLog()orclearLogKeepLatestXPercent()works correctly, but the automatic cleanup condition in_save()is never reached.Initial Analysis (Incorrect)
Initially assumed the issue was related to file handle management after cleanup operations. This analysis was incorrect - logging continues to work fine past 1000 lines, the issue is specifically that automatic cleanup doesn't trigger at all.
Current Status
Reverted the incorrect fix that added file handle reopening logic. The actual root cause is still under investigation.
Next Steps
Investigating why the condition
_logLines >= _maxLogLinesin_save()is not becoming true during runtime. Possible causes being examined:_save()not being called due to log level filtering (messages belowDEFAULT_SAVE_LEVEL = INFOwon't be saved)_logLinescounter not being incremented correctly_maxLogLinesnot set to the expected value (1000)_logLinesvariableChanges
Files Modified
src/AdvancedLogger.cpp: Reverted to original state (no net changes)Awaiting additional information from the user to properly diagnose the issue.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.