Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep log messages from last full run and last run with error or warnings #2118

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MartinRinas
Copy link
Contributor

@MartinRinas MartinRinas commented Jan 4, 2025

Adds in-memory log handler and attaches them to selected loggers. In-memory log handlers are flushed when 10s loop starts, all messages of that run are kept and written to *.latest.log. A *.latest-warning.log is generated in addition if any error or warning has been logged.

Scope of this PR:

  • main.log
  • soc.log
  • internal_chargepoint.log
  • smarthome.log

Other logs like mqtt, chargelog or data_migration don't seem to benefit from this change.

@MartinRinas MartinRinas changed the title add in-memory log handler to capture latest log cycle and keep last with warnings or errors Keep log messages from last full run and last run with error or warnings Jan 4, 2025
@MartinRinas
Copy link
Contributor Author

@LKuemmel ich hab' Zeit gefunden meinen eigenen Wunsch zum Loghandling umzusetzen, bin immer wieder erstaunt was sich mit GitHub Copilot umsetzen lässt wenn man eine grobe Idee hat, aber das Detailwissen zu den Möglichkeiten fehlt.

Es ist mir nicht gelungen die Handler für internal_chargepoint und smarthomehandler zu erkennen, bzw. herauszufinden ob & wo diese zyklisch gestartet werden. Sofern hier auch zyklisch gearbeitet wird kann ich dort noch die in-memory Logger initialisieren und speichern.

@MartinRinas MartinRinas marked this pull request as ready for review January 5, 2025 15:25
@MartinRinas
Copy link
Contributor Author

Mit dem PR sind grundsätzlich auch weitere Szenarien denkbar, z.b. Logs nach dem letzten Ladestart/Stopp oder anderen Events welche ggf. weiter in der Vergangenheit liegen und sich daher nur schwer im Nachhinein analysieren lassen sofern das Problem nicht unmittelbar reproduzierbar ist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant