Sampath's Blog
Tuesday, January 24, 2006
  Log4j - Real performer
I tried to find out the different scenarios with/out log4j... Really great output

consider the following code snippet,

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.BasicConfigurator;

public class MyApp {

static Logger logger = Logger.getLogger(MyApp.class);

public static void main(String[] args) {
long start = System.currentTimeMillis();
// BasicConfigurator.configure();

//logger.setLevel(Level.DEBUG);
for (int i = 0; i <>
// logger.info("Entering application.");
// logger.info("Exiting application.");

System.out.println("Entering application.");
System.out.println("Exiting application.");
}

long end = System.currentTimeMillis();
System.out.println(end - start);

}
}


with this.. program ends in around 6500 milli secs
disable SOP and enable log and run in ERROR level - ends in around 40 milli secs
disable SOP and enable log and run in DEBUG level - ends in around 13000 milli secs

 

ARCHIVES
December 2005 / January 2006 / March 2006 / May 2008 / March 2009 / August 2019 /


Powered by Blogger