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

iceberg-aws-bundle jar includes org.slf4j.LoggerFactory #10534

Closed
devinrsmith opened this issue Jun 18, 2024 · 4 comments · Fixed by #10665
Closed

iceberg-aws-bundle jar includes org.slf4j.LoggerFactory #10534

devinrsmith opened this issue Jun 18, 2024 · 4 comments · Fixed by #10665
Labels
AWS bug Something isn't working

Comments

@devinrsmith
Copy link
Contributor

devinrsmith commented Jun 18, 2024

Apache Iceberg version

1.5.2 (latest release)

Query engine

None

Please describe the bug 🐞

I noticed some strange logging issues after depending on iceberg-aws-bundle. After a bit of debugging, I found that iceberg-aws-bundle includes an unshadowed org.slf4j.LoggerFactory (and other org.slf4j classes) in the jar:

$ jar tf iceberg-aws-bundle-1.5.2.jar | grep "org/slf4j/LoggerFactory"
org/slf4j/LoggerFactory.class

I understand the "shading" part of the story, but it does seem a bit odd to also bring in slf4j. Typically, I'd expect iceberg-aws-bundle to declare a dependency on slf4j-api.

Our application depends on, and is bootstrapped assuming slf4j 2.x (for example, we depend on the ServiceLoader mechanism for configuration, https://www.slf4j.org/faq.html#changesInVersion200).

Normally, if a library we depend on declares a dependency on slf4j-api 1.x this isn't an issue since the public APIs are compatible https://www.slf4j.org/faq.html#compatibility. But, when both 1.x and 2.x are on the same classpath and 1.x "wins", our logging isn't able to initialize properly.

Was including org.slf4j internal to the bundled jar done on purpose?

@nastra
Copy link
Contributor

nastra commented Jul 9, 2024

@devinrsmith thanks for reporting this. Would you be interested in contributing a fix for this?

devinrsmith added a commit to devinrsmith/iceberg that referenced this issue Jul 9, 2024
This excludes `slf4j-api` from being shadowed into `iceberg-aws-bundle`, `iceberg-azure-bundle`, `iceberg-gcp-bundle`, and `iceberg-hive3-orc-bundle`. This uses the same exclude pattern established by `iceberg-bundled-guava`.

Fixes apache#10534
@devinrsmith
Copy link
Contributor Author

@nastra Just submitted a PR, thanks.

@nastra
Copy link
Contributor

nastra commented Jul 11, 2024

Typically, I'd expect iceberg-aws-bundle to declare a dependency on slf4j-api

The general idea of iceberg-aws-bundle is to be a fat jar that bundles everything related to AWS dependencies, meaning that such a jar wouldn't declare any other dependencies. Have you tried excluding slf4j when you consume iceberg-aws-bundle as a dependency via exclude group: 'org.slf4j'?

@devinrsmith
Copy link
Contributor Author

Exclusions only work for transitively declared dependencies; in the case of the current iceberg-aws-bundle, org.slf4j is baked into the fat jar so an exclude won't work from the consumers point of view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AWS bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants