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-2015 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,7 +18,8 @@ package org.springframework.integration.samples.rest.service;
|
||||
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.integration.samples.rest.domain.Employee;
|
||||
import org.springframework.integration.samples.rest.domain.EmployeeList;
|
||||
@@ -36,7 +37,7 @@ import org.springframework.stereotype.Service;
|
||||
@Service("employeeSearchService")
|
||||
public class EmployeeSearchService {
|
||||
|
||||
private static Logger logger = Logger.getLogger(EmployeeSearchService.class);
|
||||
private static Log logger = LogFactory.getLog(EmployeeSearchService.class);
|
||||
/**
|
||||
* The API <code>getEmployee()</code> looks up the mapped in coming message header's id param
|
||||
* and fills the return object with the appropriate employee details. The return
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml!
|
||||
# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J.
|
||||
log4j.rootLogger=INFO, stdout, logfile
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss.SSS} %-5p [%t][%c] %m%n
|
||||
|
||||
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.logfile.File=${rest-http.root}/WEB-INF/logs/rest-http.log
|
||||
log4j.appender.logfile.MaxFileSize=25MB
|
||||
# Keep three backup files.
|
||||
log4j.appender.logfile.MaxBackupIndex=10
|
||||
# Pattern to output: date priority [category] - message
|
||||
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
|
||||
|
||||
log4j.logger.org.springframework.ws.client.MessageTracing.sent=TRACE
|
||||
log4j.logger.org.springframework.ws.client.MessageTracing.received=DEBUG
|
||||
log4j.logger.org.springframework.ws.server.MessageTracing=DEBUG
|
||||
|
||||
# the httpclient.wire category provides a trace of all of
|
||||
# httpclient's network communication
|
||||
log4j.category.httpclient.wire=INFO
|
||||
16
intermediate/rest-http/src/main/resources/log4j2.xml
Normal file
16
intermediate/rest-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.
|
||||
@@ -25,7 +25,8 @@ import java.util.Map;
|
||||
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -52,6 +53,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
* RestHttpClientTest.java: Functional Test to test the REST HTTP Path usage. This test requires
|
||||
* rest-http application running in HTTP environment.
|
||||
* @author Vigil Bose
|
||||
* @author Gary Russell
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations={"classpath*:META-INF/spring/integration/http-outbound-config.xml"})
|
||||
@@ -60,7 +62,7 @@ public class RestHttpClientTest {
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
private HttpMessageConverterExtractor<EmployeeList> responseExtractor;
|
||||
private static Logger logger = Logger.getLogger(RestHttpClientTest.class);
|
||||
private static Log logger = LogFactory.getLog(RestHttpClientTest.class);
|
||||
@Autowired
|
||||
private Jaxb2Marshaller marshaller;
|
||||
@Autowired
|
||||
|
||||
@@ -1,36 +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>
|
||||
<logger name="org.springframework.ws.client.MessageTracing.sent">
|
||||
<level value="trace" />
|
||||
</logger>
|
||||
<logger name="org.springframework.ws.client.MessageTracing.received">
|
||||
<level value="trace" />
|
||||
</logger>
|
||||
<logger name="org.springframework.ws.server.MessageTracing">
|
||||
<level value="debug" />
|
||||
</logger>
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="warn" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
||||
Reference in New Issue
Block a user