INTSAMPLES-150: Switch to Log4j2

JIRA: https://jira.spring.io/browse/INTSAMPLES-150
This commit is contained in:
Gary Russell
2017-08-28 16:24:00 -04:00
committed by Artem Bilan
parent 68377fedd1
commit e37904128e
240 changed files with 5202 additions and 2533 deletions

View File

@@ -56,18 +56,36 @@
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jdbc</artifactId>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>jackson-module-kotlin</artifactId>
<groupId>com.fasterxml.jackson.module</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.175</version>
<version>1.4.194</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>jackson-module-kotlin</artifactId>
<groupId>com.fasterxml.jackson.module</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.7</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>jackson-module-kotlin</artifactId>
<groupId>com.fasterxml.jackson.module</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -75,6 +93,10 @@
<version>4.12</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>jackson-module-kotlin</artifactId>
<groupId>com.fasterxml.jackson.module</groupId>
</exclusion>
<exclusion>
<artifactId>*</artifactId>
<groupId>org.hamcrest</groupId>
@@ -86,6 +108,12 @@
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>jackson-module-kotlin</artifactId>
<groupId>com.fasterxml.jackson.module</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
@@ -93,6 +121,10 @@
<version>1.10.19</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>jackson-module-kotlin</artifactId>
<groupId>com.fasterxml.jackson.module</groupId>
</exclusion>
<exclusion>
<artifactId>*</artifactId>
<groupId>org.hamcrest</groupId>
@@ -103,6 +135,12 @@
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>jackson-module-kotlin</artifactId>
<groupId>com.fasterxml.jackson.module</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<repositories>
@@ -122,14 +160,14 @@
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-bom</artifactId>
<version>5.0.0.BUILD-SNAPSHOT</version>
<version>5.0.0.M6</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.0.0.BUILD-SNAPSHOT</version>
<version>5.0.0.RC3</version>
<scope>import</scope>
<type>pom</type>
</dependency>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,9 @@ import java.util.Date;
import java.util.List;
import java.util.Scanner;
import org.apache.log4j.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.samples.jdbc.domain.Gender;
@@ -34,12 +36,13 @@ import org.springframework.integration.samples.jdbc.service.PersonService;
*
* @author Gunnar Hillert
* @author Amol Nayak
* @author Gary Russell
* @version 1.0
*
*/
public final class Main {
private static final Logger LOGGER = Logger.getLogger(Main.class);
private static final Log LOGGER = LogFactory.getLog(Main.class);
private Main() { }
@@ -101,7 +104,7 @@ public final class Main {
LOGGER.info("Exiting application...bye.");
System.exit(0);
context.close();
}
@@ -139,8 +142,9 @@ public final class Main {
System.out.println("Created person record with id: " + person.getPersonId());
System.out.print("Do you want to create another person? (y/n)");
String choice = scanner.nextLine();
if(!"y".equalsIgnoreCase(choice))
if(!"y".equalsIgnoreCase(choice)) {
break;
}
}
}
/**
@@ -165,8 +169,9 @@ public final class Main {
}
System.out.print("Do you want to find another person? (y/n)");
String choice = scanner.nextLine();
if(!"y".equalsIgnoreCase(choice))
if(!"y".equalsIgnoreCase(choice)) {
break;
}
}
}

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss.SSS} %-5p [%t][%c] %m%n" />
</layout>
</appender>
<!-- Loggers -->
<logger name="org.springframework.integration">
<level value="warn" />
</logger>
<logger name="org.springframework.integration.samples">
<level value="info" />
</logger>
<!-- Root Logger -->
<root>
<priority value="warn" />
<appender-ref ref="console" />
</root>
</log4j:configuration>

View File

@@ -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} %-5p [%t][%c] %m%n" />
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console" />
</Root>
<Logger name="org.springframework" level="warn" />
<Logger name="org.springframework.integration" level="warn" />
<Logger name="org.springframework.integration.samples" level="debug" />
</Loggers>
</Configuration>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,10 +17,11 @@ package org.springframework.integration.samples.jdbc;
import java.util.Calendar;
import org.apache.log4j.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.samples.jdbc.domain.Gender;
import org.springframework.integration.samples.jdbc.domain.Person;
@@ -29,16 +30,17 @@ import org.springframework.integration.samples.jdbc.service.PersonService;
/**
* The test class for jdbc outbound gateway
* @author Amol Nayak
* @author Gary Russell
*
*/
public class OutboundGatewayTest {
private Logger logger = Logger.getLogger(OutboundGatewayTest.class);
private final Log logger = LogFactory.getLog(OutboundGatewayTest.class);
@Test
public void insertPersonRecord() {
ApplicationContext context
= new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml");
public void insertPersonRecord() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"/META-INF/spring/integration/spring-integration-context.xml");
PersonService service = context.getBean(PersonService.class);
logger.info("Creating person Instance");
Person person = new Person();
@@ -50,6 +52,7 @@ public class OutboundGatewayTest {
person = service.createPerson(person);
Assert.assertNotNull("Expected a non null instance of Person, got null", person);
logger.info("\n\tGenerated person with id: " + person.getPersonId() + ", with name: " + person.getName());
context.close();
}
}