---- Sebastiaan van Erk <[EMAIL PROTECTED]> wrote:
> 2) It would be nice to have formatting of log messages as SLF4J has with
> the MessageFormat api. In combination with varargs (java5); this makes
> for a really flexible logging mechanism which makes the code much more
> concise and avoids testing for log level and formatting of messages
> yourself while still remaining efficient, e.g., something like this:
>
> log.debug("The disk \"{1}\" contains {0} file(s).", count, disk);
Is this really more efficient? I would have thought that behind the scenes the
compiler turns this into exactly the equivalent of:
Object[] params = new Object[2];
params[0] = count;
params[1] = disk;
log.debug("......", params);
This is not efficient at all; the Object array is created and initialised even
if debug-level is not enabled and therefore has to be wrapped in
if (log.isDebugEnabled())
anyway.
I'd be happy to be proved wrong.....
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]