Hi Ken.


> rare events.  I surround my info and debug logging requests with "if"
> blocks to prevent them from being executed.

This isn't really necessary - just use the set the log level on the appender
to ERROR or higher.
However, you can still take a hit during creation of method parameters to
the log method.  I think this is explained in the log4j FAQ.

I put my info and debug requests in "if " blocks to prevent the cost of parameter construction. I create boolean class variables and set them using isDebugEnabled() and isInfoEnabled(). Then I enclose debug() and info() calls as on page 41 in the book. This is under the "Performance" heading starting on page 40.



> Do you know of a way to get log4j's message (just the %m, %M,
> and %C parts)
> into my wrapper exception.  I thought about putting this code into my
> custom appender, but it is cumbersome and appenders are for logging
> requests, not exception creation.

It might help you to know that the way log4j gets the method and line
numbers is to create a Throwable instance and then parse the stack trace (at
least in 1.2.x - did you already look at the code?).

I found it and read it.


Thanks,

Bob


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



Reply via email to