2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 2022 EfficiOS Inc.
7 import org
.apache
.logging
.log4j
.LogManager
;
8 import org
.apache
.logging
.log4j
.Logger
;
11 * Example application using the LTTng-UST Java log4j agent.
14 * To obtain LTTng trace events, you should run the following sequence of
19 * <li>$ lttng create</li>
20 * <li>$ lttng enable-event -l -a</li>
21 * <li>$ lttng start</li>
22 * <li>(run this program)</li>
23 * <li>$ lttng stop</li>
24 * <li>$ lttng view</li>
25 * <li>$ lttng destroy</li>
29 public class HelloLog4j2
{
31 private static final Logger logger
= LogManager
.getLogger(HelloLog4j2
.class);
36 * @param args Command-line arguments
38 public static void main(String args
[]) {
40 /* Trigger some tracing events using the Log4j Logger created before. */
41 logger
.info("Basic config: Hello World, the answer is " + 42);
42 logger
.info("Basic config: Another info event");
43 logger
.error("Basic config: An error event");
This page took 0.02914 seconds and 4 git commands to generate.