Tuesday, October 21, 2003

Just4log

Just4log is a library to enhance dynamically the performance of various logging systems inside a java application. Dynamically because the sourcecode in java is not modified but rather the optimization occurs on the compiled ByteCode files.
It supports Log4J, Apache Commons Logging and JDK 1.4 Logging by post-processing something like this:
for(int i=0; i<500000; i++) {

logger.debug(" remember this is a problem with this: "
+ someLongTaskToExecute());
normalCodeToExecute();
}

into this:
for(int i=0; i<500000; i++) {

if (logger.isDebugEnabled()) {
logger.debug(" remember this is a problem with this: "
+ someLongTaskToExecute());
}
normalCodeToExecute();
}

This way it keeps the sourcecode clean from too much debugging-related statements, while don't have to pay the hidden cost of parameter construction.

Currently it provides an ant task to do the job.
In the future you can benefit from the following uses:
* A classloader implementation allows Just-In-Time optimization.
* A command line program allows optimization from normal scripts.
* Access via a GUI.

A really useful tool!

No comments: