fabric8io / kubernetes-client

Java client for Kubernetes & OpenShift

Home Page:http://fabric8.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kubernetes-log4j doesn't generate Log4j2Plugins.dat

erathorus opened this issue · comments

Describe the bug

When switching from org.apache.logging.log4j:log4j-kubernetes to the new io.fabric8:kubernetes-log4j package following the discussion in #5682, I notice that the new io.fabric8:kubernetes-log4j package doesn't include the Log4j2Plugins.dat file.

As I understand this file is needed to make the plugin discoverable by Log4j2 and it is generated by the PluginProcessor annotation processor as in the documentation.

However, kubernetes-log4j-6.11.0.pom doesn't specify the annotation processor, while this is specified in log4j-kubernetes-2.23.1.pom.

Fabric8 Kubernetes Client version

6.11.0

Steps to reproduce

  1. Download org.apache.logging.log4j:log4j-kubernetes jar file: log4j-kubernetes-2.23.1.jar.
  2. Download io.fabric8:kubernetes-log4j jar file: kubernetes-log4j-6.11.0.jar.
  3. When extracting META-INF from log4j-kubernetes-2.23.1.jar, it includes the Log4j2Plugins.dat file:
    jar xf log4j-kubernetes-2.23.1.jar META-INF
    test -f META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat # Success
  4. When extracting META-INF from log4j-kubernetes-2.23.1.jar, it doesn't include the Log4j2Plugins.dat file:
    jar xf kubernetes-log4j-6.11.0.jar META-INF
    test -f META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat # Fail

Expected behavior

The META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat file should be included in the kubernetes-log4j jar file.

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3@latest

Environment

Linux, macOS

Fabric8 Kubernetes Client Logs

No response

Additional context

Related issue: #5682

Ooops, that is embarassing. The annotation processor configuration seems correct, so I am not sure why the file does not end up in the final JAR file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
...
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.13.0</version>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <showDeprecation>true</showDeprecation>
              <showWarnings>true</showWarnings>
              <compilerArgument>-Xlint:unchecked</compilerArgument>
            </configuration>
          </execution>
          <execution>
            <id>default-testCompile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <showDeprecation>true</showDeprecation>
              <showWarnings>true</showWarnings>
              <compilerArgument>-Xlint:unchecked</compilerArgument>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <showDeprecation>true</showDeprecation>
          <showWarnings>true</showWarnings>
          <compilerArgument>-Xlint:unchecked</compilerArgument>
        </configuration>
      </plugin>
...
</project>

I'll look into it.