X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lttng_ivc%2Fapps%2Fjul-2.0%2FApp.java;fp=lttng_ivc%2Fapps%2Fjul-2.0%2FApp.java;h=251ff2b87bea02760f851c43b6458ddba293ec24;hb=74eb709665e53e922313f01de3b6d3d3fdc1df70;hp=0000000000000000000000000000000000000000;hpb=f4711e680579a9aa6b120494a9244bc30ff795a1;p=deliverable%2Flttng-ivc.git diff --git a/lttng_ivc/apps/jul-2.0/App.java b/lttng_ivc/apps/jul-2.0/App.java new file mode 100644 index 0000000..251ff2b --- /dev/null +++ b/lttng_ivc/apps/jul-2.0/App.java @@ -0,0 +1,53 @@ +import java.io.IOException; +import java.io.File; +import java.util.logging.Logger; +import java.util.logging.Handler; +import java.util.logging.Level; +import org.lttng.ust.agent.jul.LttngLogHandler; + +public class App +{ + private static final int answer = 42; + + public static void main(String[] argv) throws Exception + { + int nrIter = Integer.parseInt(argv[0]); + String sync_first_tp_hit_path = null; + String sync_wait_before_last = null; + + if (argv.length > 1) { + sync_first_tp_hit_path = argv[1]; + } + if (argv.length > 2) { + sync_wait_before_last = argv[2]; + } + + // Create a logger + Logger logger = Logger.getLogger("jello"); + logger.setLevel(Level.INFO); + + Handler lttngHandler = new LttngLogHandler(); + + logger.addHandler(lttngHandler); + + for (int i=0; i < 0 || i < nrIter; i++) { + if ( i >= 0 && i == nrIter -1 && sync_wait_before_last != null) { + File f = new File(sync_wait_before_last); + while (!f.exists()) { + Thread.sleep(1); + } + } + logger.info("logging the world"); + logger.warning("some warning"); + logger.severe("error!"); + if (i == 0 && sync_first_tp_hit_path != null) { + File f = new File(sync_first_tp_hit_path); + f.createNewFile(); + } + } + + // Not mandatory, but cleaner + logger.removeHandler(lttngHandler); + lttngHandler.close(); + } +}