logging-log4j2: log4j-layout-template-json:2.21.0 Introduced Backward Incompatible Change

Description

My organization has developed a Log4J plugin that implements an EventResolver. The plugin compiles with version 2.20.0 but not 2.21.0 due to it’s newly added module-info.java. 2.21.0’s module-info.java is a welcome addition; however, it exports EventResolver but not JsonWriter which is referenced by the TemplateResolver<V> super-interface. This results in a compilation error.

Configuration

Version: 2.21.0

Operating system: Ubuntu 22.04

JDK: OpenJDK Runtime Environment Temurin-17.0.8.1+1 (build 17.0.8.1+1)

Logs

[ERROR] /home/dave/src/log4j-datamessage-plugin/src/main/java/com/imanage/logging/log4j/layout/template/json/resolver/DataMessageResolver.java:[7,53] package org.apache.logging.log4j.layout.template.json.util is not visible
[ERROR]   (package org.apache.logging.log4j.layout.template.json.util is declared in module org.apache.logging.log4j.layout.template.json, which does not export it)

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@iManageDave,

We use BND to generate JPMS and OSGi descriptors. Unfortunately BND considers API leakage a warning:

[WARNING] /home/piotr/workspace/log4j2/2.x/log4j-layout-template-json/.flattened-pom.xml [0:0]: Export org.apache.logging.log4j.layout.template.json,  has 1,  private references [org.apache.logging.log4j.layout.template.json.util]
[WARNING] /home/piotr/workspace/log4j2/2.x/log4j-layout-template-json/.flattened-pom.xml [0:0]: Export org.apache.logging.log4j.layout.template.json.resolver,  has 1,  private references [org.apache.logging.log4j.layout.template.json.util]

so we didn’t see it.

Fortunately we can configure BND to mark these warning as errors.

@iManageDave, great! Thanks for helping with the troubleshooting. Closing the issue – @rickardoberg, feel free to re-open it if the fix doesn’t work for you.