This is an automated email from the ASF dual-hosted git repository. ramu12 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new ae967d8 "CAMEL-14019:Upgrade to log4j v2 in remainder components" new 34c8665 Merge branch 'master' of github.com:apache/camel ae967d8 is described below commit ae967d8b0b962ea1c62446e7159c149218e0bd96 Author: Kodanda Ramu Kakarla <kkaka...@kkakarla.pnq.csb> AuthorDate: Mon Dec 9 22:20:10 2019 +0530 "CAMEL-14019:Upgrade to log4j v2 in remainder components" --- components/camel-azure/pom.xml | 14 ++++++++-- components/camel-chatscript/pom.xml | 15 ++++++----- components/camel-google-bigquery/pom.xml | 13 +++++++--- .../bigquery/GoogleBigQueryConnectionFactory.java | 6 ++--- .../src/test/resources/log4j2.properties | 30 ++++++++++++++++++++++ components/camel-google-pubsub/pom.xml | 13 +++++++--- .../pubsub/GooglePubsubConnectionFactory.java | 7 ++--- .../google/pubsub/GooglePubsubConsumer.java | 7 ++--- .../google/pubsub/GooglePubsubEndpoint.java | 9 ++++--- .../google/pubsub/GooglePubsubProducer.java | 7 ++--- .../pubsub/consumer/PubsubAcknowledgement.java | 7 ++--- .../src/test/resources/log4j2.properties | 30 ++++++++++++++++++++++ 12 files changed, 124 insertions(+), 34 deletions(-) diff --git a/components/camel-azure/pom.xml b/components/camel-azure/pom.xml index 57b5bf8..162b41e 100644 --- a/components/camel-azure/pom.xml +++ b/components/camel-azure/pom.xml @@ -57,9 +57,19 @@ <artifactId>camel-test-spring</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <scope>test</scope> + </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> <scope>test</scope> </dependency> </dependencies> diff --git a/components/camel-chatscript/pom.xml b/components/camel-chatscript/pom.xml index 5966dbd..f3f9d2c 100644 --- a/components/camel-chatscript/pom.xml +++ b/components/camel-chatscript/pom.xml @@ -47,18 +47,19 @@ <scope>test</scope> </dependency> <!-- logging --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <scope>test</scope> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> <scope>test</scope> </dependency> <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/components/camel-google-bigquery/pom.xml b/components/camel-google-bigquery/pom.xml index 672a09b..202ae32 100644 --- a/components/camel-google-bigquery/pom.xml +++ b/components/camel-google-bigquery/pom.xml @@ -60,9 +60,16 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <scope>test</scope> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> </dependency> <dependency> <groupId>org.mockito</groupId> diff --git a/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryConnectionFactory.java b/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryConnectionFactory.java index 3c7db1d..a533310 100644 --- a/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryConnectionFactory.java +++ b/components/camel-google-bigquery/src/main/java/org/apache/camel/component/google/bigquery/GoogleBigQueryConnectionFactory.java @@ -36,14 +36,14 @@ import com.google.api.services.bigquery.BigqueryScopes; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; public class GoogleBigQueryConnectionFactory { private static final JsonFactory JSON_FACTORY = new JacksonFactory(); - private final Logger logger = LoggerFactory.getLogger(GoogleBigQueryConnectionFactory.class); + private final Logger logger = LogManager.getLogger(GoogleBigQueryConnectionFactory.class); private String serviceAccount; private String serviceAccountKey; diff --git a/components/camel-google-bigquery/src/test/resources/log4j2.properties b/components/camel-google-bigquery/src/test/resources/log4j2.properties new file mode 100644 index 0000000..3f9aba8 --- /dev/null +++ b/components/camel-google-bigquery/src/test/resources/log4j2.properties @@ -0,0 +1,30 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + + +appender.file.type = File +appender.file.name = file +appender.file.fileName = target/camel-google-bigquery-test.log +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +appender.out.type = Console +appender.out.name = out +appender.out.layout.type = PatternLayout +appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +rootLogger.level = INFO +rootLogger.appenderRef.file.ref = file + diff --git a/components/camel-google-pubsub/pom.xml b/components/camel-google-pubsub/pom.xml index 9ef84fd..745d4b4 100644 --- a/components/camel-google-pubsub/pom.xml +++ b/components/camel-google-pubsub/pom.xml @@ -58,9 +58,16 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <scope>test</scope> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> </dependency> </dependencies> diff --git a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConnectionFactory.java b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConnectionFactory.java index b46c5a9..d53530d 100644 --- a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConnectionFactory.java +++ b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConnectionFactory.java @@ -36,14 +36,15 @@ import com.google.api.services.pubsub.PubsubScopes; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + public class GooglePubsubConnectionFactory { private static JsonFactory jsonFactory = new JacksonFactory(); - private final Logger logger = LoggerFactory.getLogger(GooglePubsubConnectionFactory.class); + private final Logger logger = LogManager.getLogger(GooglePubsubConnectionFactory.class); private String serviceAccount; private String serviceAccountKey; diff --git a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConsumer.java b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConsumer.java index 9d14c3c..79b9f9b 100644 --- a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConsumer.java +++ b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubConsumer.java @@ -31,8 +31,9 @@ import org.apache.camel.Processor; import org.apache.camel.component.google.pubsub.consumer.ExchangeAckTransaction; import org.apache.camel.spi.Synchronization; import org.apache.camel.support.DefaultConsumer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + class GooglePubsubConsumer extends DefaultConsumer { @@ -59,7 +60,7 @@ class GooglePubsubConsumer extends DefaultConsumer { loggerId = this.getClass().getName(); } - localLog = LoggerFactory.getLogger(loggerId); + localLog = LogManager.getLogger(loggerId); } @Override diff --git a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubEndpoint.java b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubEndpoint.java index 87822ae..6645efb 100644 --- a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubEndpoint.java +++ b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubEndpoint.java @@ -30,8 +30,9 @@ import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; import org.apache.camel.support.DefaultEndpoint; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + /** * Messaging client for Google Cloud Platform PubSub Service @@ -85,9 +86,9 @@ public class GooglePubsubEndpoint extends DefaultEndpoint { public void afterPropertiesSet() throws Exception { if (Strings.isNullOrEmpty(loggerId)) { - log = LoggerFactory.getLogger(this.getClass().getName()); + log = LogManager.getLogger(this.getClass().getName()); } else { - log = LoggerFactory.getLogger(loggerId); + log = LogManager.getLogger(loggerId); } // Default pubsub connection. diff --git a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubProducer.java b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubProducer.java index 9eb1300..37fe3e4 100644 --- a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubProducer.java +++ b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubProducer.java @@ -29,8 +29,9 @@ import com.google.api.services.pubsub.model.PublishResponse; import com.google.api.services.pubsub.model.PubsubMessage; import org.apache.camel.Exchange; import org.apache.camel.support.DefaultProducer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + /** * Generic PubSub Producer @@ -48,7 +49,7 @@ public class GooglePubsubProducer extends DefaultProducer { loggerId = this.getClass().getName(); } - logger = LoggerFactory.getLogger(loggerId); + logger = LogManager.getLogger(loggerId); } /** diff --git a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/consumer/PubsubAcknowledgement.java b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/consumer/PubsubAcknowledgement.java index cf9ff45..85a1f56 100644 --- a/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/consumer/PubsubAcknowledgement.java +++ b/components/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/consumer/PubsubAcknowledgement.java @@ -22,8 +22,9 @@ import com.google.api.client.repackaged.com.google.common.base.Strings; import com.google.api.services.pubsub.model.AcknowledgeRequest; import com.google.api.services.pubsub.model.ModifyAckDeadlineRequest; import org.apache.camel.component.google.pubsub.GooglePubsubEndpoint; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + public abstract class PubsubAcknowledgement { @@ -42,7 +43,7 @@ public abstract class PubsubAcknowledgement { loggerId = this.getClass().getName(); } - logger = LoggerFactory.getLogger(loggerId); + logger = LogManager.getRootLogger(); } void acknowledge(List<String> ackIdList) { diff --git a/components/camel-google-pubsub/src/test/resources/log4j2.properties b/components/camel-google-pubsub/src/test/resources/log4j2.properties new file mode 100644 index 0000000..d550bf0 --- /dev/null +++ b/components/camel-google-pubsub/src/test/resources/log4j2.properties @@ -0,0 +1,30 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + + +appender.file.type = File +appender.file.name = file +appender.file.fileName = target/camel-google-pubsub-test.log +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +appender.out.type = Console +appender.out.name = out +appender.out.layout.type = PatternLayout +appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +rootLogger.level = INFO +rootLogger.appenderRef.file.ref = file +