Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubernetes-log4j doesn't generate Log4j2Plugins.dat #5847

Closed
erathorus opened this issue Mar 31, 2024 · 1 comment · Fixed by #5848
Closed

kubernetes-log4j doesn't generate Log4j2Plugins.dat #5847

erathorus opened this issue Mar 31, 2024 · 1 comment · Fixed by #5848
Assignees
Milestone

Comments

@erathorus
Copy link

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

@ppkarwasz
Copy link
Contributor

ppkarwasz commented Mar 31, 2024

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.

ppkarwasz added a commit to ppkarwasz/kubernetes-client that referenced this issue Mar 31, 2024
Due to a misconfiguration of the Maven Bundle Plugin, the Log4j Core
plugin descriptor:

```
META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
```

file is missing in the generated JAR.

This PR fixes the Maven configuration and adds a simple integration test
to prevent ensure that `PluginManager` is able to detect the Kubernetes
Lookup.
@manusa manusa added this to the 6.12.0 milestone Apr 10, 2024 — with automated-tasks
manusa pushed a commit to ppkarwasz/kubernetes-client that referenced this issue Apr 10, 2024
Due to a misconfiguration of the Maven Bundle Plugin, the Log4j Core
plugin descriptor:

```
META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
```

file is missing in the generated JAR.

This PR fixes the Maven configuration and adds a simple integration test
to prevent ensure that `PluginManager` is able to detect the Kubernetes
Lookup.
manusa pushed a commit that referenced this issue Apr 10, 2024
Fix #5847: missing Log4j Core plugin descriptor

Due to a misconfiguration of the Maven Bundle Plugin, the Log4j Core
plugin descriptor:

```
META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat
```

file is missing in the generated JAR.

This PR fixes the Maven configuration and adds a simple integration test
to prevent ensure that `PluginManager` is able to detect the Kubernetes
Lookup.
---
Add changelog for #5848
---
Remove `public` modifier from JUnit 5 test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants