apache / arrow

Apache Arrow is a multi-language toolbox for accelerated data interchange and in-memory processing
https://arrow.apache.org/
Apache License 2.0
13.87k stars 3.38k forks source link

[JAVA] flight-sql-jdbc-driver V16.0.0 shading relocates slf4j dependency #41543

Open Icetea1991 opened 1 month ago

Icetea1991 commented 1 month ago

Describe the bug, including details regarding any error messages, version, and platform.

When I upgrade to version 16.0.0, suddenly my @Slf4j annotation did no longer work. When I checked for manually creating a LoggerFactory, I noticed that the only imports Intellj could find were unter the path of: import org.apache.arrow.driver.jdbc.shaded.*;

I then checked the pom.xml of the flight-sql-jdbc-driver and noticed the shading relocations you configured:

https://github.com/apache/arrow/blob/7cd9c6fbd313c9afa0673d85415a84fd199951c9/java/flight/flight-sql-jdbc-driver/pom.xml#L98

<relocation>
                  <pattern>com.</pattern>
                  <shadedPattern>org.apache.arrow.driver.jdbc.shaded.com.</shadedPattern>
                  <excludes>
                    <exclude>com.sun.**</exclude>
                  </excludes>
</relocation>
<relocation>
                  <pattern>org.</pattern>
                  <shadedPattern>org.apache.arrow.driver.jdbc.shaded.org.</shadedPattern>
                  <excludes>
                    <exclude>org.apache.arrow.driver.jdbc.**</exclude>
                    <exclude>org.apache.arrow.flight.name</exclude>
                    <exclude>org.apache.arrow.flight.version</exclude>
                    <exclude>org.apache.arrow.flight.jdbc-driver.name</exclude>
                    <exclude>org.apache.arrow.flight.jdbc-driver.version</exclude>
                  </excludes>
</relocation>

I am not an expert on the shading plugin of maven, but it seems to me it moves around all dependencies below the com. and org. pattern. Even if I exclude those dependencies from the flight-sql-jdbc-driver, it does not help.

If I go down to version 15.x.x it works again.

Component(s)

Java

laurentgo commented 1 month ago

The change was actually on purpose and rationale is explained in #40908. You can still use slf4j with your application but your application needs to declare slf4j itself. If you want to control the driver logging, use java.util.logging.* framework to configure the driver logger (or you can use jul-to-slf4j to bridge back the driver log messages to your slf4j backend)