From: <Web...@St...> - 2006-04-05 09:44:20
|
On Tue, 4 Apr 2006, Keats Kirsch wrote: | I have also been reading up on SLF4J, and I think I'm convinced that it is a | better approach. For me it's mainly because of the log interface, which seems | more elegant and efficient.. They use formatted log messages which avoid | having to guard your logging statements with level tests or build up strings | that are never used. I also like that the Log4J founder is behind it. I don't think it's any more efficient as such. And for several log-systems, they will still have to wrap the actual loggers (unless the logging-system natively implement the interfaces, as log4j probably will do at some point). The new "formatting methods" aren't all that fantastic in my opinion - as I understand it, you can't shove primitives (numbers, booleans) in there - and then you're back at unnecessary object-creation, or string-convertions, or the "wrapping if". The if (log.isDebugEnabled()) log.debug("lala"); semantics have never bothered me at all - i have macros/templates for all these anyway - and then I'm _sure_ that I won't create unnecessary objects or do conversions or concatenations. At any rate, I believe that these new methods will be incorporated in log4j too, soon, as they are a novel solution to the "wrapping ifs" - but not in all circumstance: log.trace("there are "+i+" items in the list"); But yes, definately something to consider! At any rate, one should do a overhaul of the entire logging strategy, cleaning up every log statement, re-evaluate the level at which the log-statement outputs (there are way to much at info level now - "trace" should be employed for most output), and use the decided-upon native loggers instead of implementing some inefficient wrapping or "containing" idea. Regards, Endre. |