From ef032360f6e74b9aa1bbbd8ab3452af6236a6d5f Mon Sep 17 00:00:00 2001 From: gavingaozhangmin Date: Thu, 2 Sep 2021 17:09:32 +0800 Subject: [PATCH] add isinfoEnabled --- .../connectors/pulsar/FlinkPulsarSinkBase.java | 15 ++++++++------- .../connectors/pulsar/FlinkPulsarSource.java | 14 ++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/pulsar-flink-connector/src/main/java/org/apache/flink/streaming/connectors/pulsar/FlinkPulsarSinkBase.java b/pulsar-flink-connector/src/main/java/org/apache/flink/streaming/connectors/pulsar/FlinkPulsarSinkBase.java index 21d98ec3..704ea02f 100644 --- a/pulsar-flink-connector/src/main/java/org/apache/flink/streaming/connectors/pulsar/FlinkPulsarSinkBase.java +++ b/pulsar-flink-connector/src/main/java/org/apache/flink/streaming/connectors/pulsar/FlinkPulsarSinkBase.java @@ -273,13 +273,14 @@ public void open(Configuration parameters) throws Exception { topic2Producer = new HashMap<>(); } //super.open(parameters); - - try { - ObjectMapper m = new ObjectMapper(); - ObjectWriter w = m.writerWithDefaultPrettyPrinter(); - log.info("Pulsar sink config: {}", w.writeValueAsString(properties)); - } catch (IOException e) { - log.error("Failed to dump sink config info", e); + if (log.isInfoEnabled()) { + try { + ObjectMapper m = new ObjectMapper(); + ObjectWriter w = m.writerWithDefaultPrettyPrinter(); + log.info("Pulsar sink config: {}", w.writeValueAsString(properties)); + } catch (IOException e) { + log.error("Failed to dump sink config info", e); + } } } diff --git a/pulsar-flink-connector/src/main/java/org/apache/flink/streaming/connectors/pulsar/FlinkPulsarSource.java b/pulsar-flink-connector/src/main/java/org/apache/flink/streaming/connectors/pulsar/FlinkPulsarSource.java index 26dfd7fa..766a91ba 100644 --- a/pulsar-flink-connector/src/main/java/org/apache/flink/streaming/connectors/pulsar/FlinkPulsarSource.java +++ b/pulsar-flink-connector/src/main/java/org/apache/flink/streaming/connectors/pulsar/FlinkPulsarSource.java @@ -505,12 +505,14 @@ public void open(Configuration parameters) throws Exception { } } - try { - ObjectMapper m = new ObjectMapper(); - ObjectWriter w = m.writerWithDefaultPrettyPrinter(); - log.info("Pulsar source config: {}", w.writeValueAsString(properties)); - } catch (IOException e) { - log.error("Failed to dump source config info", e); + if (log.isInfoEnabled()) { + try { + ObjectMapper m = new ObjectMapper(); + ObjectWriter w = m.writerWithDefaultPrettyPrinter(); + log.info("Pulsar source config: {}", w.writeValueAsString(properties)); + } catch (IOException e) { + log.error("Failed to dump source config info", e); + } } }