INTSAMPLES-150: Switch to Log4j2
JIRA: https://jira.spring.io/browse/INTSAMPLES-150
This commit is contained in:
committed by
Artem Bilan
parent
68377fedd1
commit
e37904128e
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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,15 +17,18 @@ package org.springframework.integration.samples.multipart;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.integration.http.multipart.UploadedMultipartFile;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
public class MultipartReceiver {
|
||||
private static Logger logger = Logger.getLogger(MultipartReceiver.class);
|
||||
private static Log logger = LogFactory.getLog(MultipartReceiver.class);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void receive(LinkedMultiValueMap<String, Object> multipartRequest){
|
||||
|
||||
@@ -1,26 +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>
|
||||
<logger name="org.springframework.integration">
|
||||
<level value="warn" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration.samples.multipart">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="warn" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
||||
16
intermediate/multipart-http/src/main/resources/log4j2.xml
Normal file
16
intermediate/multipart-http/src/main/resources/log4j2.xml
Normal 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>
|
||||
@@ -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.
|
||||
@@ -18,27 +18,26 @@ package org.springframework.integration.samples.multipart;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.HttpStatus;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
public class MultipartClientForHttpOutboundClient {
|
||||
|
||||
private static Logger logger = Logger.getLogger(MultipartClientForHttpOutboundClient.class);
|
||||
private static Log logger = LogFactory.getLog(MultipartClientForHttpOutboundClient.class);
|
||||
private static String resourcePath = "org/springframework/integration/samples/multipart/spring09_logo.png";
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) throws Exception{
|
||||
ApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/http-outbound-config.xml");
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"/META-INF/spring/integration/http-outbound-config.xml");
|
||||
Resource s2logo = new ClassPathResource(resourcePath);
|
||||
Map<String, Object> multipartMap = new HashMap<String, Object>();
|
||||
multipartMap.put("company", new String[]{"SpringSource", "VMWare"});
|
||||
@@ -47,5 +46,7 @@ public class MultipartClientForHttpOutboundClient {
|
||||
MultipartRequestGateway requestGateway = context.getBean("requestGateway", MultipartRequestGateway.class);
|
||||
HttpStatus reply = requestGateway.postMultipartRequest(multipartMap);
|
||||
System.out.println("Replied with HttpStatus code: " + reply);
|
||||
context.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
package org.springframework.integration.samples.multipart;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.HttpEntity;
|
||||
@@ -29,17 +31,17 @@ import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
public class MultipartRestClient {
|
||||
|
||||
private static Logger logger = Logger.getLogger(MultipartRestClient.class);
|
||||
private static Log logger = LogFactory.getLog(MultipartRestClient.class);
|
||||
|
||||
private static String uri = "http://localhost:8080/multipart-http/inboundAdapter.htm";
|
||||
|
||||
private static String resourcePath = "org/springframework/integration/samples/multipart/spring09_logo.png";
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) throws Exception{
|
||||
RestTemplate template = new RestTemplate();
|
||||
Resource s2logo = new ClassPathResource(resourcePath);
|
||||
|
||||
Reference in New Issue
Block a user