Add LOG4J2 domain to the Log4j 2.x agent
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 10 Feb 2022 15:25:54 +0000 (15:25 +0000)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 14 Feb 2022 16:28:54 +0000 (11:28 -0500)
commit495b8381eb4348cdad015e3c324bc4edccfd53d3
treef62624cd47fd24107ba2f6e18f46835c1f1592fe
parent37d351b83b6a3cb7ee952364a0bdb5dadfa616bc
Add LOG4J2 domain to the Log4j 2.x agent

This commit adds a new LOG4J2 domain with native Log4j 2.x loglevels in
addition to the existing LOG4J domain. Both domains can be used
individually or at the same time by instantiating one or more appenders.

For example, a single appender in Log4j 2.x native mode:

    <?xml version="1.0" encoding="UTF-8"?>
    <Configuration status="WARN">
      <Appenders>
        <Lttng name="LTTNG" domain="LOG4J2"/>
      </Appenders>
      <Loggers>
        <Root level="all">
          <AppenderRef ref="LTTNG"/>
        </Root>
      </Loggers>
    </Configuration>

Two appenders to enable both domains:

    <?xml version="1.0" encoding="UTF-8"?>
    <Configuration status="WARN">
      <Appenders>
        <Lttng name="LTTNG1" domain="LOG4J"/>
        <Lttng name="LTTNG2" domain="LOG4J2"/>
      </Appenders>
      <Loggers>
        <Root level="all">
          <AppenderRef ref="LTTNG1"/>
          <AppenderRef ref="LTTNG2"/>
        </Root>
      </Loggers>
    </Configuration>

Change-Id: I9a41e107d19d5a0efffe055edf0ca5211a7f6d6b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 files changed:
doc/examples/java-log4j2-basic/log4j2.xml
doc/examples/java-log4j2-ctx/log4j2.ctx1.xml
doc/examples/java-log4j2-ctx/log4j2.ctx2.xml
doc/examples/java-log4j2-prog/HelloLog4j2Prog.java
src/lib/lttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/ILttngAgent.java
src/lib/lttng-ust-java-agent/java/lttng-ust-agent-log4j2/org/lttng/ust/agent/log4j2/LttngLog4j2Agent.java
src/lib/lttng-ust-java-agent/java/lttng-ust-agent-log4j2/org/lttng/ust/agent/log4j2/LttngLog4j2Api.java
src/lib/lttng-ust-java-agent/java/lttng-ust-agent-log4j2/org/lttng/ust/agent/log4j2/LttngLogAppender.java
src/lib/lttng-ust-java-agent/jni/log4j/Makefile.am
src/lib/lttng-ust-java-agent/jni/log4j/lttng_ust_log4j2.c
src/lib/lttng-ust-java-agent/jni/log4j/lttng_ust_log4j2_tp.c [new file with mode: 0644]
src/lib/lttng-ust-java-agent/jni/log4j/lttng_ust_log4j2_tp.h [new file with mode: 0644]
src/lib/lttng-ust-java-agent/jni/log4j/lttng_ust_log4j_tp.h
This page took 0.02792 seconds and 4 git commands to generate.