1

I'm trying this log4j2 sample for flowtracing. https://logging.apache.org/log4j/2.x/manual/flowtracing.html

My eclipse is complaining that JsonMessage cannot be resolved to a type.

In my pom.xml I have the dependencies

<dependencies>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.11.0</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.11.0</version>
      </dependency>
    </dependencies>

When I browse the log4j-api-2.11.0.jar in Eclipse/Maven Dependencies section of the project I cannot find JsonMessage.class in the org.apache.logging.log4j.message package.

I went online to see if JsonMessage is in the github source control https://github.com/apache/logging-log4j2/blob/master/log4j-api/src/test/java/org/apache/logging/log4j/message/JsonMessage.java and it is there.

What can I do to bring JsonMessage into my project and get the sample to build and run?

D.B.
  • 4,523
  • 2
  • 19
  • 39
xpagesbeast
  • 776
  • 1
  • 10
  • 21
  • I don't see `JsonMessage` in the [list of message classes provided by log4j2](https://logging.apache.org/log4j/2.x/manual/messages.html) and the link to the source in your question points to the test source not main - src/**test**/java... – D.B. Jun 20 '18 at 14:10
  • The fastest thing to do is probably just download the source for the JsonMessage class and add it to your project's main src – D.B. Jun 20 '18 at 14:18
  • That is what I did and compiled the project. Is JsonMessage used just for testing or should it be included in the master branch? – xpagesbeast Jun 20 '18 at 18:41
  • Well, since it seems to only be used in src/test/java I'd say it's just used for testing. – D.B. Jun 20 '18 at 19:10

0 Answers0