why don't we add a method in the Logger class or at least a Util with a method like the following one in order to avoid the cost of the message build.
      In this way we'll not have to build the message unless the priority is enabled for the logger.
      I'll wait for your thoughts.

import org.apache.log4j.Logger;

import org.apache.log4j.Priority;


public class LoggerUtil {


    static public void log(Logger logger, Priority priority, Object... objs){


        if (logger.isEnabledFor(priority) ){

            StringBuffer sb = new StringBuffer();

            for(Object obj : objs){

                sb.append( obj.toString() );


            logger.log(priority, sb.toString() );





Cusano Pineda, Gerardo H.

Information System Engineer

Accenture System Integration & Technology

Buenos Aires, Argentina

* g.x.cusano.pineda@accenture.com

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.