2 * Copyright (C) 2015 Michael Jeanson <mjeanson@efficios.com>
3 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
5 * SPDX-License-Identifier: GPL-2.0-only
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
;
15 import org
.lttng
.ust
.agent
.jul
.LttngLogHandler
;
17 public class JTestLTTng
{
23 * Command-line arguments
25 * @throws InterruptedException
27 public static void main(String args
[]) throws IOException
, InterruptedException
{
29 Logger lttng
= Logger
.getLogger("JTestLTTng");
30 Logger lttng2
= Logger
.getLogger("JTestLTTng2");
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;
37 if (args
.length
> 2) {
38 fire_finest_tp
= Integer
.parseInt(args
[2]);
40 if (args
.length
> 3) {
41 fire_second_tp
= Integer
.parseInt(args
[3]);
44 /* Instantiate a LTTngLogHandler object, and attach it to our loggers */
45 Handler lttngHandler
= new LttngLogHandler();
46 lttng
.addHandler(lttngHandler
);
47 lttng2
.addHandler(lttngHandler
);
49 lttng
.setLevel(Level
.FINEST
);
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");
57 Thread
.sleep(waitTime
);
60 if (fire_second_tp
== 1) {
61 lttng2
.info("JUL second logger fired");
65 * Do not forget to close() all handlers so that the agent can shutdown
66 * and the session daemon socket gets cleaned up explicitly.
This page took 0.030146 seconds and 4 git commands to generate.