Loxberry
Loxberry copied to clipboard
Circular buffer for LoxBerry::Log messages
Often seen:
- User sends a logfile that contains some lines, mostly the header of the log, followed by an ERROR or CRITICAL and nothing else.
- Loglevel is set to default = 3 "ERROR". Therefore no debug message appear in the log.
Solution:
- As every message passes LoxBerry::Log, create a circular buffer of messages, e.g. with 100 lines.
- Optionally, the circular buffer size is configurable by an option.
- In case of an ERROR or LOGCRIT, write the circular buffer to the logfile.
- Mark start and end of the log dump that the developer can identify the log dump.
- Save timestamps in the circular buffer and add it to the log dump.
As logfiles usually go to ram disk, logfile size is not as dramatic as it was before. Performance impact of that buffer is nuts (in-memory operation).