camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lburgazz...@apache.org
Subject [01/24] camel git commit: CAMEL-10224: Upgrade log4j to lg4j2
Date Wed, 10 Aug 2016 15:30:15 GMT
Repository: camel
Updated Branches:
  refs/heads/master e2718db7b -> 629d63a2e


CAMEL-10224: Upgrade log4j to lg4j2


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/629d63a2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/629d63a2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/629d63a2

Branch: refs/heads/master
Commit: 629d63a2ea91f190120ebcdf308798d346270449
Parents: 4a8a135
Author: lburgazzoli <lburgazzoli@gmail.com>
Authored: Wed Aug 10 15:10:27 2016 +0200
Committer: lburgazzoli <lburgazzoli@gmail.com>
Committed: Wed Aug 10 17:26:34 2016 +0200

----------------------------------------------------------------------
 tests/camel-itest-spring-boot/pom.xml           | 13 ++++++-
 .../itest/springboot/ITestApplication.java      | 34 ++----------------
 .../springboot/util/ArquillianPackager.java     |  3 +-
 .../src/test/resources/log4j2-spring.xml        | 16 +++++++++
 .../src/test/resources/spring-logback.xml       | 37 --------------------
 5 files changed, 32 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/629d63a2/tests/camel-itest-spring-boot/pom.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/pom.xml b/tests/camel-itest-spring-boot/pom.xml
index 5cdbf11..09b65ff 100644
--- a/tests/camel-itest-spring-boot/pom.xml
+++ b/tests/camel-itest-spring-boot/pom.xml
@@ -34,6 +34,12 @@
     <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-spring-boot-starter</artifactId>
+      <exclusions>
+        <exclusion>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-logging</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <!-- Dependency needed to incorporate classes in main jar -->
@@ -43,6 +49,12 @@
       <version>${spring-boot-version}</version>
     </dependency>
 
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-log4j2</artifactId>
+      <version>${spring-boot-version}</version>
+    </dependency>
+
     <!-- Test dependencies needed also at compile/unitTestEnabled time -->
     <dependency>
       <groupId>org.jboss.shrinkwrap</groupId>
@@ -152,7 +164,6 @@
             <include>**/*Test.java</include>
           </includes>
           <systemProperties>
-
             <!-- Test configuration -->
             <!--
             It is better disabling unit testing in surefire, as some of them fail for various
reasons

http://git-wip-us.apache.org/repos/asf/camel/blob/629d63a2/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java
b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java
index 4b319bd..584f59b 100644
--- a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java
+++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java
@@ -18,11 +18,7 @@ package org.apache.camel.itest.springboot;
 
 import java.net.URL;
 
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.joran.JoranConfigurator;
-import ch.qos.logback.core.joran.spi.JoranException;
-import ch.qos.logback.core.util.StatusPrinter;
-
+import org.apache.logging.log4j.core.config.Configurator;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -30,7 +26,8 @@ import org.springframework.context.annotation.Import;
 import org.springframework.scheduling.annotation.EnableAsync;
 
 /**
- * Contains the main class of the sample spring-boot application created for the module under
test.
+ * Contains the main class of the sample spring-boot application created for the 
+ * module under test.
  *
  */
 @SpringBootApplication
@@ -39,8 +36,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
 public class ITestApplication {
 
     public static void main(String[] args) throws Exception {
-        overrideLoggingConfig();
-
         SpringApplication.run(ITestApplication.class, args);
     }
 
@@ -49,27 +44,4 @@ public class ITestApplication {
         // to tell source-check this is not a utility-class
         return "spring-boot-main";
     }
-
-    private static void overrideLoggingConfig() {
-
-        URL logbackFile = ITestApplication.class.getResource("/spring-logback.xml");
-        if (logbackFile != null) {
-
-            LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
-
-            try {
-                JoranConfigurator configurator = new JoranConfigurator();
-                configurator.setContext(context);
-                // Call context.reset() to clear any previous configuration, e.g. default
-                // configuration. For multi-step configuration, omit calling context.reset().
-                context.reset();
-                configurator.doConfigure(logbackFile);
-            } catch (JoranException je) {
-                // StatusPrinter will handle this
-            }
-            StatusPrinter.printInCaseOfErrorsOrWarnings(context);
-        }
-
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/629d63a2/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/ArquillianPackager.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/ArquillianPackager.java
b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/ArquillianPackager.java
index 85be90e..9313c28 100644
--- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/ArquillianPackager.java
+++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/ArquillianPackager.java
@@ -102,7 +102,7 @@ public final class ArquillianPackager {
         }
 
         if (config.getUseCustomLog()) {
-            ark = ark.addAsResource("spring-logback.xml", CLASSES_FOLDER + "/spring-logback.xml");
+            ark = ark.addAsResource("log4j2-spring.xml", CLASSES_FOLDER + "/log4j2.xml");
         }
 
         for (Map.Entry<String, String> res : config.getResources().entrySet()) {
@@ -134,7 +134,6 @@ public final class ArquillianPackager {
         commonExclusions.add(MavenDependencies.createExclusion("log4j", "log4j"));
         commonExclusions.add(MavenDependencies.createExclusion("log4j", "apache-log4j-extras"));
         commonExclusions.add(MavenDependencies.createExclusion("org.slf4j", "slf4j-simple"));
-        commonExclusions.add(MavenDependencies.createExclusion("org.slf4j", "slf4j-simple"));
         commonExclusions.add(MavenDependencies.createExclusion("org.slf4j", "slf4j-jdk14"));
         commonExclusions.add(MavenDependencies.createExclusion("ch.qos.logback", "logback-classic"));
         commonExclusions.add(MavenDependencies.createExclusion("ch.qos.logback", "logback-core"));

http://git-wip-us.apache.org/repos/asf/camel/blob/629d63a2/tests/camel-itest-spring-boot/src/test/resources/log4j2-spring.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/resources/log4j2-spring.xml b/tests/camel-itest-spring-boot/src/test/resources/log4j2-spring.xml
new file mode 100644
index 0000000..fa9da00
--- /dev/null
+++ b/tests/camel-itest-spring-boot/src/test/resources/log4j2-spring.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration status="WARN">
+  <Appenders>
+    <Console name="Console" target="SYSTEM_OUT">
+      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+    </Console>
+    <File name="File" append="false" fileName="target/camel-itest-spring-boot.log">
+      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
+    </File>
+  </Appenders>
+  <Loggers>
+    <Root level="info">
+      <AppenderRef ref="Console"/>
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/629d63a2/tests/camel-itest-spring-boot/src/test/resources/spring-logback.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/resources/spring-logback.xml b/tests/camel-itest-spring-boot/src/test/resources/spring-logback.xml
deleted file mode 100644
index 5422719..0000000
--- a/tests/camel-itest-spring-boot/src/test/resources/spring-logback.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
--->
-<configuration>
-
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-        <layout class="ch.qos.logback.classic.PatternLayout">
-            <Pattern>
-                %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
-            </Pattern>
-        </layout>
-    </appender>
-
-    <logger name="org.apache.camel.component" level="debug"
-            additivity="false">
-        <appender-ref ref="STDOUT"/>
-    </logger>
-
-    <root level="info">
-        <appender-ref ref="STDOUT"/>
-    </root>
-
-</configuration>


Mime
View raw message