At 11:26 AM 2/11/2003, you wrote:

All,

I am looking at the log4j documentation and it states the following

"To avoid the parameter construction cost write:

if(logger.isDebugEnabled() {
logger.debug("Entry number: " + i + " is " + String.valueOf(entry[i]));
}"

I do want to avoid the parameter construction cost, but I don't want to check for IsXXXEnabled everytime I use a log statement because it makes my code clumsy. Is there a better way of doing this ? Is there a config flag somewhere ? or should I extend the logger classes and check for IsXXXenabled before calling the Log4j classes. And then my code can call my log4jextended classes. Again, I don't want to check for IsXXXEnabled every time I use a log statement.

Any help is appreciated.

Thks,

- Ashish.
In practice, there are very few places where the parameter construction cost slows down your application enough to notice.

We don't log inside loops that are executed millions of times.

Also, they're talking about things where it is very time consuming to build the string you're trying to log, not just adding a few strings together. An example would be some giant object that is getting turned into a string, or logging something that makes a database call.

Scott


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



Reply via email to