Deferred debug logging

This is not RoR specific or log4j specific. This is just something that'd be really nice. And I'll implement it soon in RoR...

In production, you don't want tons of logging. If something goes wrong, you wish you had set the loglevel to debug, right? ;)

So the idea is this:
The loglevel is set to info.
Someone makes a request.
The logger logs everything as if it was on debug-level, but all in memory.
If the request outcome was without an error, only log the info/warn/error messages.
But if something DID go wrong, we can now output the whole debug log.

The downside of all this is that it eats a few kb per simultanious request, and all the stringconversions has to be done. IMO it's worth it..

Share this:

0 reacties: