6e9eb32df2cedc70c6de891167e92fc16ea77cbe
2 * Copyright (C) 2015 Michael Jeanson <mjeanson@efficios.com>
3 * Copyright (C) 2014 David Goulet <dgoulet@efficios.com>
4 * Copyright (C) 2014 Christian Babeux <christian.babeux@efficios.com>
6 * SPDX-License-Identifier: GPL-2.0-only
10 import java
.io
.IOException
;
11 import java
.lang
.Integer
;
13 import org
.apache
.logging
.log4j
.Logger
;
14 import org
.apache
.logging
.log4j
.LogManager
;
16 public class JTestLTTngLog4j2
{
22 * Command-line arguments
24 * @throws InterruptedException
26 public static void main(String args
[]) throws IOException
, InterruptedException
{
28 Logger console
= LogManager
.getLogger("console-event-1");
29 Logger lttng
= LogManager
.getLogger("log4j2-event-1");
30 Logger lttng2
= LogManager
.getLogger("log4j2-event-2");
32 int nrIter
= Integer
.parseInt(args
[0]);
33 int waitTime
= Integer
.parseInt(args
[1]); /* milliseconds */
34 int fire_debug_tp
= 0;
35 int fire_second_tp
= 0;
37 if (args
.length
> 2) {
38 fire_debug_tp
= Integer
.parseInt(args
[2]);
40 if (args
.length
> 3) {
41 fire_second_tp
= Integer
.parseInt(args
[3]);
44 console
.info("CONSOLE only event.");
46 for (int iter
= 0; iter
< nrIter
; iter
++) {
47 lttng
.info("LOG4J2 INFO tp fired!");
48 if (fire_debug_tp
== 1) {
49 /* Third arg, trigger debug TP. */
50 lttng
.debug("LOG4J2 DEBUG tp fired");
52 Thread
.sleep(waitTime
);
55 if (fire_second_tp
== 1) {
56 lttng2
.info("LOG4J2 INFO second logger fired");
This page took 0.029213 seconds and 3 git commands to generate.