Fix: lttng-snapshot: use after free of max size argument
[lttng-tools.git] / tests / regression / ust / java-jul / JTestLTTng.java
1 /*
2 * Copyright (C) 2015 Michael Jeanson <mjeanson@efficios.com>
3 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 */
8
9 import java.io.IOException;
10 import java.lang.Integer;
11 import java.util.logging.Handler;
12 import java.util.logging.Logger;
13 import java.util.logging.Level;
14
15 import org.lttng.ust.agent.jul.LttngLogHandler;
16
17 public class JTestLTTng {
18
19 /**
20 * Application start
21 *
22 * @param args
23 * Command-line arguments
24 * @throws IOException
25 * @throws InterruptedException
26 */
27 public static void main(String args[]) throws IOException, InterruptedException {
28
29 Logger lttng = Logger.getLogger("JTestLTTng");
30 Logger lttng2 = Logger.getLogger("JTestLTTng2");
31
32 int nrIter = Integer.parseInt(args[0]);
33 int waitTime = Integer.parseInt(args[1]);
34 int fire_finest_tp = 0;
35 int fire_second_tp = 0;
36
37 if (args.length > 2) {
38 fire_finest_tp = Integer.parseInt(args[2]);
39 }
40 if (args.length > 3) {
41 fire_second_tp = Integer.parseInt(args[3]);
42 }
43
44 /* Instantiate a LTTngLogHandler object, and attach it to our loggers */
45 Handler lttngHandler = new LttngLogHandler();
46 lttng.addHandler(lttngHandler);
47 lttng2.addHandler(lttngHandler);
48
49 lttng.setLevel(Level.FINEST);
50
51 for (int iter = 0; iter < nrIter; iter++) {
52 lttng.info("JUL tp fired!");
53 if (fire_finest_tp == 1) {
54 /* Third arg, trigger finest TP. */
55 lttng.finest("JUL FINEST tp fired");
56 }
57 Thread.sleep(waitTime);
58 }
59
60 if (fire_second_tp == 1) {
61 lttng2.info("JUL second logger fired");
62 }
63
64 /*
65 * Do not forget to close() all handlers so that the agent can shutdown
66 * and the session daemon socket gets cleaned up explicitly.
67 */
68 lttngHandler.close();
69 }
70 }
This page took 0.044636 seconds and 5 git commands to generate.