From 77864b58f00dc9753c0752435aaccd8b8c77a210 Mon Sep 17 00:00:00 2001 From: Nipuna Ranasinghe Date: Thu, 4 May 2023 12:04:40 +0530 Subject: [PATCH 1/2] Replace log4j with slf4j and, avoid log dependency getting packed into the native jar --- asb-native/build.gradle | 3 +-- .../java/org/ballerinax/asb/receiver/MessageReceiver.java | 7 +++---- .../main/java/org/ballerinax/asb/sender/MessageSender.java | 7 +++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/asb-native/build.gradle b/asb-native/build.gradle index dfc2c5fb..2df40642 100644 --- a/asb-native/build.gradle +++ b/asb-native/build.gradle @@ -27,8 +27,7 @@ repositories { dependencies { implementation 'com.azure:azure-messaging-servicebus:7.13.1' dist group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.13.4' - implementation group: 'log4j', name: 'log4j', version: '1.2.17' - dist group: 'log4j', name: 'log4j', version: '1.2.17' + implementation group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.30' compile group: 'org.ballerinalang', name: 'ballerina-lang', version: project.ballerinaLangVersion compile(group: 'org.ballerinalang', name: 'ballerina-runtime', version: project.ballerinaLangVersion) { transitive = false diff --git a/asb-native/src/main/java/org/ballerinax/asb/receiver/MessageReceiver.java b/asb-native/src/main/java/org/ballerinax/asb/receiver/MessageReceiver.java index 3e5afb60..01f78f24 100644 --- a/asb-native/src/main/java/org/ballerinax/asb/receiver/MessageReceiver.java +++ b/asb-native/src/main/java/org/ballerinax/asb/receiver/MessageReceiver.java @@ -51,12 +51,12 @@ import java.util.Objects; import java.util.UUID; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; import org.apache.qpid.proton.amqp.Binary; import org.ballerinax.asb.util.ASBConstants; import org.ballerinax.asb.util.ASBUtils; import org.ballerinax.asb.util.ModuleUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.ballerinax.asb.util.ASBConstants.RECEIVE_AND_DELETE; import static org.ballerinax.asb.util.ASBUtils.getRetryOptions; @@ -66,7 +66,7 @@ * Ballerina. */ public class MessageReceiver { - private static final Logger log = Logger.getLogger(MessageReceiver.class); + private static final Logger log = LoggerFactory.getLogger(MessageReceiver.class); private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); private ServiceBusReceiverClient receiver; @@ -88,7 +88,6 @@ public class MessageReceiver { public MessageReceiver(String connectionString, String queueName, String topicName, String subscriptionName, String receiveMode, long maxAutoLockRenewDuration, String logLevel, BMap retryConfigs) throws ServiceBusException, InterruptedException { - log.setLevel(Level.toLevel(logLevel, Level.OFF)); AmqpRetryOptions retryOptions = getRetryOptions(retryConfigs); ServiceBusReceiverClientBuilder receiverClientBuilder = new ServiceBusClientBuilder() .connectionString(connectionString) diff --git a/asb-native/src/main/java/org/ballerinax/asb/sender/MessageSender.java b/asb-native/src/main/java/org/ballerinax/asb/sender/MessageSender.java index 25b60bce..02bba196 100644 --- a/asb-native/src/main/java/org/ballerinax/asb/sender/MessageSender.java +++ b/asb-native/src/main/java/org/ballerinax/asb/sender/MessageSender.java @@ -41,10 +41,10 @@ import java.util.Collection; import java.util.Map; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; import org.ballerinax.asb.util.ASBConstants; import org.ballerinax.asb.util.ASBUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.ballerinax.asb.util.ASBUtils.getRetryOptions; @@ -52,7 +52,7 @@ * This facilitates the client operations of MessageSender client in Ballerina. */ public class MessageSender { - private static final Logger log = Logger.getLogger(MessageSender.class); + private static final Logger log = LoggerFactory.getLogger(MessageSender.class); private ServiceBusSenderClient sender; /** @@ -69,7 +69,6 @@ public class MessageSender { public MessageSender(String connectionString, String entityType, String topicOrQueueName, String logLevel, BMap retryConfigs) throws ServiceBusException, InterruptedException { - log.setLevel(Level.toLevel(logLevel, Level.OFF)); AmqpRetryOptions retryOptions = getRetryOptions(retryConfigs); ServiceBusClientBuilder clientBuilder = new ServiceBusClientBuilder() .retryOptions(retryOptions) From d825e5f62dd0bc8256865a4d4c6edffd6e8bfaee Mon Sep 17 00:00:00 2001 From: Nipuna Ranasinghe Date: Thu, 4 May 2023 12:04:56 +0530 Subject: [PATCH 2/2] Update to next patch version --- asb-ballerina/Ballerina.toml | 6 +++--- asb-ballerina/Dependencies.toml | 5 ++--- gradle.properties | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/asb-ballerina/Ballerina.toml b/asb-ballerina/Ballerina.toml index 20fd6523..e5590abc 100644 --- a/asb-ballerina/Ballerina.toml +++ b/asb-ballerina/Ballerina.toml @@ -2,7 +2,7 @@ distribution = "2201.3.1" org = "ballerinax" name = "asb" -version = "3.2.2" +version = "3.2.3" license= ["Apache-2.0"] authors = ["Ballerina"] keywords = ["IT Operations/Message Brokers", "Cost/Paid", "Vendor/Microsoft"] @@ -13,9 +13,9 @@ repository = "https://github.com/ballerina-platform/module-ballerinax-azure-serv observabilityIncluded = true [[platform.java11.dependency]] -path = "../asb-native/build/libs/asb-native-3.2.2.jar" +path = "../asb-native/build/libs/asb-native-3.2.3.jar" groupId = "org.ballerinax" artifactId = "asb-native" module = "asb-native" -version = "3.2.2" +version = "3.2.3" diff --git a/asb-ballerina/Dependencies.toml b/asb-ballerina/Dependencies.toml index 46b6aa0e..5a935d78 100644 --- a/asb-ballerina/Dependencies.toml +++ b/asb-ballerina/Dependencies.toml @@ -48,7 +48,7 @@ modules = [ [[package]] org = "ballerina" name = "observe" -version = "1.0.6" +version = "1.0.7" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -104,7 +104,7 @@ modules = [ [[package]] org = "ballerinax" name = "asb" -version = "3.2.2" +version = "3.2.3" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "log"}, @@ -117,4 +117,3 @@ modules = [ {org = "ballerinax", packageName = "asb", moduleName = "asb"} ] - diff --git a/gradle.properties b/gradle.properties index 1031a4be..9a120195 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.caching=true group=org.ballerinax.azure.servicebus -version=3.2.2 +version=3.2.3 ballerinaLangVersion=2201.3.1