Why does the logger force you to use Strings?

logger.info("some string here" + someValue);

In most cases, you're going to be creating some dynamic value that must be constructed, which means that you are always better off using a char array or a StringBuffer to build it. These buffers can be reused. A String, on the other hand, always creates unnecessary garbage.

Am I crazy, or was this just a poor design decision?

It seems pretty clear that there ought to be a method like this:

// initialized once
StringBuffer buf = ...

// to log a new message
buf.clear();
buf.append("some string here");
buf.append(someValue);
logger.info(buf);


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to