[bind10-dev] Losing startup logs
Michal 'vorner' Vaner
michal.vaner at nic.cz
Tue Mar 27 10:09:55 UTC 2012
Hello
As mentioned yesterday on the call, when bind10 starts, every component logs to
stderr first, before it reads its own configuration and can switch to whatever
logging the admin has configured. This has a problem ‒ imagine the logging is
set to a file. Then the first few messages of each program is sent to stderr and
are missing in the file.
So, I have a solution which could be used (I was thinking about this earlier
for a different reason).
My idea was to have a buffer where the log messages go, with full debug output.
That buffer could be dumped later on, with to any other logging destination,
with filtering only the relevant log severities.
So we could start with logging both to the console and to this buffer at start.
When we load the configuration and it says to log somewhere else than the
console, we would first dump the buffered messages there, then optionally
dropped the buffer and stopped putting the messages there.
Another use I saw, which is unrelated, would be to have the buffer in case
something bad happens (like a crash), so we would output few last messages
leading to the problem in the most verbose level, which would help debugging.
For these things to work, I think we'd need one feature I asked about earlier.
Being able to have multiple logger outputs with different severities (currently
a logger can output to different locations, but with the same severities ‒ but
we would need to output to the console with something sane, like >=INFO, and
with full debugging to the buffer).
As for the format of the buffer, I thought of a ring buffer with size of few
kilobytes (so it could be enabled long-term and not eat all the memory, for the
dumping of the few last messages in case of problem). Each message would look
something like this (any part that could be binary would be, for smaller
footprint and better performance, it would be dumped first anyway before anybody
reading it):
<Length of the message> <Logger name> <Severity> <Timestamp> <Text>
There would be two pointers to the buffer. One to the first message, one to the
place where a new one should be placed (and it would be the end when dumping
also). We would just move the start pointer forward a message whenever the end
one would get past it.
Do you think it would work? Do you think the two features (not losing startup
messages and the emergency-case output if the buffer is enabled) is worth the
work?
Thank you
--
The difficult we do today; the impossible takes a little longer.
Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20120327/9798accc/attachment.bin>
More information about the bind10-dev
mailing list