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

[improve][dependency] Remove jul-to-slf4j #16320

Merged
merged 15 commits into from Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion distribution/server/src/assemble/LICENSE.bin.txt
Expand Up @@ -558,7 +558,6 @@ BSD 2-Clause License
MIT License
* Java SemVer -- com.github.zafarkhaja-java-semver-0.9.0.jar -- licenses/LICENSE-SemVer.txt
* SLF4J -- licenses/LICENSE-SLF4J.txt
- org.slf4j-jul-to-slf4j-1.7.32.jar
- org.slf4j-slf4j-api-1.7.32.jar
- org.slf4j-jcl-over-slf4j-1.7.32.jar
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to redirect jcl-over-slf4j due to #1740 that it's an internal dependency to commons-logging and we should handle within Pulsar itself.

* The Checker Framework
Expand Down
6 changes: 0 additions & 6 deletions pom.xml
Expand Up @@ -691,12 +691,6 @@ flexible messaging model and an intuitive client API.</description>
<version>${slf4j.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions pulsar-broker/pom.xml
Expand Up @@ -267,11 +267,6 @@
<artifactId>jackson-module-jsonSchema</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
Expand Down
Expand Up @@ -62,13 +62,10 @@
import org.apache.pulsar.functions.worker.service.WorkerServiceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;

public class PulsarBrokerStarter {

private static ServiceConfiguration loadConfig(String configFile) throws Exception {
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
try (InputStream inputStream = new FileInputStream(configFile)) {
ServiceConfiguration config = create(inputStream, ServiceConfiguration.class);
// it validates provided configuration is completed
Expand Down
5 changes: 0 additions & 5 deletions pulsar-client-admin/pom.xml
Expand Up @@ -92,11 +92,6 @@
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down
Expand Up @@ -65,7 +65,6 @@
import org.glassfish.jersey.media.multipart.MultiPartFeature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;

/**
* Pulsar client admin API client.
Expand Down Expand Up @@ -114,24 +113,6 @@ public class PulsarAdminImpl implements PulsarAdmin {
private final int requestTimeout;
private final TimeUnit requestTimeoutUnit;

static {
/**
* The presence of slf4j-jdk14.jar, that is the jul binding for SLF4J, will force SLF4J calls to be delegated to
* jul. On the other hand, the presence of jul-to-slf4j.jar, plus the installation of SLF4JBridgeHandler, by
* invoking "SLF4JBridgeHandler.install()" will route jul records to SLF4J. Thus, if both jar are present
* simultaneously (and SLF4JBridgeHandler is installed), slf4j calls will be delegated to jul and jul records
* will be routed to SLF4J, resulting in an endless loop. We avoid this loop by detecting if slf4j-jdk14 is used
* in the client class path. If slf4j-jdk14 is found, we don't use the slf4j bridge.
*/
try {
Class.forName("org.slf4j.impl.JDK14LoggerFactory");
} catch (Exception ex) {
// Setup the bridge for java.util.logging to SLF4J
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
}
}

public PulsarAdminImpl(String serviceUrl, ClientConfigurationData clientConfigData) throws PulsarClientException {
this(serviceUrl, clientConfigData, DEFAULT_CONNECT_TIMEOUT_SECONDS, TimeUnit.SECONDS,
DEFAULT_READ_TIMEOUT_SECONDS, TimeUnit.SECONDS, DEFAULT_REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS,
Expand Down
5 changes: 0 additions & 5 deletions pulsar-proxy/pom.xml
Expand Up @@ -125,11 +125,6 @@
<artifactId>javax.activation</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>

<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
Expand Down
Expand Up @@ -23,8 +23,6 @@
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.apache.pulsar.common.stats.JvmMetrics.getJvmDirectMemoryUsed;
import static org.slf4j.bridge.SLF4JBridgeHandler.install;
import static org.slf4j.bridge.SLF4JBridgeHandler.removeHandlersForRootLogger;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import com.google.common.annotations.VisibleForTesting;
Expand Down Expand Up @@ -107,11 +105,6 @@ public class ProxyServiceStarter {

public ProxyServiceStarter(String[] args) throws Exception {
try {

// setup handlers
removeHandlersForRootLogger();
install();

DateFormat dateFormat = new SimpleDateFormat(
FixedDateFormat.FixedFormat.ISO8601_OFFSET_DATE_TIME_HHMM.getPattern());
Thread.setDefaultUncaughtExceptionHandler((thread, exception) -> {
Expand Down
2 changes: 0 additions & 2 deletions pulsar-sql/presto-distribution/LICENSE
Expand Up @@ -508,8 +508,6 @@ MIT License
- slf4j-jdk14-1.7.32.jar
* JCL 1.2 Implemented Over SLF4J
- jcl-over-slf4j-1.7.32.jar
* JUL to SLF4J Bridge
- jul-to-slf4j-1.7.32.jar
* Checker Qual
- checker-qual-3.12.0.jar
* Annotations
Expand Down
5 changes: 0 additions & 5 deletions pulsar-websocket/pom.xml
Expand Up @@ -87,11 +87,6 @@
<artifactId>jackson-jaxrs-json-provider</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>

<!-- To write basic websockets against -->
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
Expand Down