||Best Practices for Exception Handling|
|Subject:||Logging APIs use Exceptions to get info|
java.util.logging and Log4J both make use of Exception's stacktrace to find out the information used to write out a log message. Take a look at the source code and you'll see that log messages cause new Throwable() objects to be created. Then String comparisons to find the right place in the stack trace. This is so very very slow!
In java.util.logging you can specify the classname and methodname in the log statement to completely avoid the generation of an Exception for each log message.
Hear us Roar