logger 사용으로 변경

This commit is contained in:
yunjy
2021-07-23 09:54:56 +09:00
parent 10b5f9fa78
commit f671f89729
2 changed files with 22 additions and 15 deletions
@@ -8,6 +8,8 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
@@ -23,6 +25,8 @@ import com.jayway.jsonpath.JsonPath;
@Controller @Controller
public class ApiController { public class ApiController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired @Autowired
private ApiServiceKeyService apiKeyService; private ApiServiceKeyService apiKeyService;
@@ -33,25 +37,25 @@ public class ApiController {
@RequestMapping(value = "/mock-api/**") @RequestMapping(value = "/mock-api/**")
public ResponseEntity<String> mockApi(HttpEntity<String> httpEntity, HttpServletRequest request, public ResponseEntity<String> mockApi(HttpEntity<String> httpEntity, HttpServletRequest request,
HttpServletResponse response) { HttpServletResponse response) {
System.out.println("=================================================="); logger.debug("==================================================");
System.out.println("=================================================="); logger.debug("==================================================");
System.out.println(request.getServletPath()); logger.debug(request.getServletPath());
System.out.println("--------------------------------------------------"); logger.debug("--------------------------------------------------");
System.out.println("httpEntity.getHeaders().toString()=" + httpEntity.getHeaders().toString()); logger.debug("httpEntity.getHeaders().toString()=" + httpEntity.getHeaders().toString());
System.out.println("--------------------------------------------------"); logger.debug("--------------------------------------------------");
System.out.println("httpEntity.getBody()=" + httpEntity.getBody()); logger.debug("httpEntity.getBody()=" + httpEntity.getBody());
System.out.println("--------------------------------------------------"); logger.debug("--------------------------------------------------");
Map<String, String[]> paramMap = request.getParameterMap(); Map<String, String[]> paramMap = request.getParameterMap();
for (String key : paramMap.keySet()) { for (String key : paramMap.keySet()) {
String[] values = paramMap.get(key); String[] values = paramMap.get(key);
for (String value : values) { for (String value : values) {
System.out.println(String.format("%s=%s", key, value)); logger.debug(String.format("%s=%s", key, value));
} }
} }
System.out.println("=================================================="); logger.debug("==================================================");
System.out.println("=================================================="); logger.debug("==================================================");
String url = request.getServletPath(); String url = request.getServletPath();
String serviceValue = assignServiceValue(httpEntity, request, url); String serviceValue = assignServiceValue(httpEntity, request, url);
@@ -122,10 +126,10 @@ public class ApiController {
int startIdx = NumberUtils.toInt(args[0]); int startIdx = NumberUtils.toInt(args[0]);
int length = NumberUtils.toInt(args[1]); int length = NumberUtils.toInt(args[1]);
String serviceValue = msg.substring(startIdx, startIdx + length); String serviceValue = msg.substring(startIdx, startIdx + length);
System.out.println("--------------------------------------------------"); logger.debug("--------------------------------------------------");
System.out.println("serviceCode=" + serviceValue); logger.debug("serviceCode=" + serviceValue);
System.out.println("=================================================="); logger.debug("==================================================");
System.out.println("=================================================="); logger.debug("==================================================");
if (StringUtils.isBlank(serviceValue)) { if (StringUtils.isBlank(serviceValue)) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, throw new ResponseStatusException(HttpStatus.NOT_FOUND,
String.format("sbi-std-servlet not found(URL=%s, ServiceKey=%s)", url, serviceKey)); String.format("sbi-std-servlet not found(URL=%s, ServiceKey=%s)", url, serviceKey));
+3
View File
@@ -1,3 +1,6 @@
logging:
level:
root: info
server: server:
port.http: 38080 port.http: 38080
port: 38443 port: 38443