On Tue, 2004-11-02 at 14:45, Paul Smith wrote:
> Actually, I was thinking along the lines of:
>
> logger.debug("My name is {1}. I am {0} years old", new Object[]{new
> Integer(30}, "Paul"});
I would support both "{}" and "{#}" formats.
In code that I write, I use this sort of construct:
class Example {
Logger logger = ....
LogText LT = LogText.get(getClass());
// LogText contains a resource bundle
void method() {
logger.debug(LT.get("msg1", arg0, arg1));
}
}
I allow up to 3, no more, no less. (c.f "Monty Python and the Holy
Grail") If you have more than 3, then the line is pretty big anyway.
This is really compact.
Couldn't you create a class called "MC" (shorted from MessageComposer)
that you could use like so?
import org.apache.log4j.helpers.MC;
import org.apache.log4j.Logger;
class Example {
Logger logger = ....
void method() {
logger.debug(MC.format("Holy {0} {1}!", arg0, arg1));
}
}
Then you wouldn't need to change Logger at all!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]