2 * Copyright (C) 2014 - David Goulet <dgoulet@efficios.com>
3 * Christian Babeux <christian.babeux@efficios.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License, version 2 only, as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 import java
.io
.IOException
;
20 import java
.lang
.Integer
;
22 import org
.apache
.log4j
.Logger
;
23 import org
.apache
.log4j
.BasicConfigurator
;
25 import org
.lttng
.ust
.agent
.LTTngAgent
;
27 public class JTestLTTng
29 private static LTTngAgent lttngAgent
;
31 public static void main(String args
[]) throws Exception
33 Logger lttng
= Logger
.getLogger("log4j-event");
34 Logger lttng2
= Logger
.getLogger("log4j-event-2");
35 int nrIter
= Integer
.parseInt(args
[0]);
36 int waitTime
= Integer
.parseInt(args
[1]);
37 int fire_debug_tp
= 0;
38 int fire_second_tp
= 0;
40 if (args
.length
> 2) {
41 fire_debug_tp
= Integer
.parseInt(args
[2]);
43 if (args
.length
> 3) {
44 fire_second_tp
= Integer
.parseInt(args
[3]);
47 BasicConfigurator
.configure();
48 lttngAgent
= LTTngAgent
.getLTTngAgent();
50 for (int iter
= 0; iter
< nrIter
; iter
++) {
51 lttng
.info("LOG4J tp fired!");
52 if (fire_debug_tp
== 1) {
53 /* Third arg, trigger debug TP. */
54 lttng
.debug("LOG4J DEBUG tp fired");
56 Thread
.sleep(waitTime
);
59 if (fire_second_tp
== 1) {
60 lttng2
.info("LOG4J second logger fired");
This page took 0.030563 seconds and 4 git commands to generate.