
On Thu, 01 Nov 2007 11:52:40 +0200, John Torjo wrote:
But the most important thing here is that it is flexible (you can create your own appenders, formatters, etc and register them with the system and they will act as if they were built in) and FAST. Plus it is configurable
It certainly is extensible - quite a lot ;)
I see that :)
Anyway, my code might be worth a look - but coming back to my initial question have you done speed benchmarks? Or thought about not using streams?
I haven't done speed benchmarks yet, but as a side-note, I want to create a class that will benchmark how long the app spends doing logging. Also, if you turn "compile fast" mode off, you'll avoid one virtual call.
About using streams - this is really your call. It's all about gathering your data: http://torjo.com/log2/doc/html/workflow.html http://torjo.com/log2/doc/html/workflow.html#workflow_2a
So gathering can happen using streams, or you can choose your own Log Syntax, avoiding streams. OK, but the default file appender is not using iostreams?
Note that logging can also become way faster if you do it on a dedicated thread (on_dedicated_thread.hpp class). I haven't yet tested this, but it's gonna be way faster than doing logging on the thread the message is logged. Basically, the only thing that happens in the current thread is gathering the message. Writing it (formatting it and then writing it to the destination(s)) will happen on the other thread. Thus, any destination you might have - can automatically become asynchronous as well ;) ) Yah, log4cxx and my logger also support async logging. But this is not possible where I work (large financial). If use async logging, you have a queue between your app thread and the logging thread. If your app crashes, anything in that queue is lost. This is hell on wheels for debugging. Plus some important information is lost ("Oops! We don't know which of the $30 million in trades were sent to the market and which weren't!"). So while I know Async logging is faster, it is not practical in any important application.
(note : your appenders = my destinations)
I'd be curious to see how my lib benchmarks against what solution your company took ;) I will see if I can grab your logger and benchmark it against mine - first using generic formatters, then using custom formatters (which increase efficiency dramatically).
PreZ :)