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.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -23,6 +25,8 @@ import com.jayway.jsonpath.JsonPath;
@Controller
public class ApiController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private ApiServiceKeyService apiKeyService;
@@ -33,25 +37,25 @@ public class ApiController {
@RequestMapping(value = "/mock-api/**")
public ResponseEntity<String> mockApi(HttpEntity<String> httpEntity, HttpServletRequest request,
HttpServletResponse response) {
System.out.println("==================================================");
System.out.println("==================================================");
System.out.println(request.getServletPath());
System.out.println("--------------------------------------------------");
System.out.println("httpEntity.getHeaders().toString()=" + httpEntity.getHeaders().toString());
System.out.println("--------------------------------------------------");
System.out.println("httpEntity.getBody()=" + httpEntity.getBody());
System.out.println("--------------------------------------------------");
logger.debug("==================================================");
logger.debug("==================================================");
logger.debug(request.getServletPath());
logger.debug("--------------------------------------------------");
logger.debug("httpEntity.getHeaders().toString()=" + httpEntity.getHeaders().toString());
logger.debug("--------------------------------------------------");
logger.debug("httpEntity.getBody()=" + httpEntity.getBody());
logger.debug("--------------------------------------------------");
Map<String, String[]> paramMap = request.getParameterMap();
for (String key : paramMap.keySet()) {
String[] values = paramMap.get(key);
for (String value : values) {
System.out.println(String.format("%s=%s", key, value));
logger.debug(String.format("%s=%s", key, value));
}
}
System.out.println("==================================================");
System.out.println("==================================================");
logger.debug("==================================================");
logger.debug("==================================================");
String url = request.getServletPath();
String serviceValue = assignServiceValue(httpEntity, request, url);
@@ -122,10 +126,10 @@ public class ApiController {
int startIdx = NumberUtils.toInt(args[0]);
int length = NumberUtils.toInt(args[1]);
String serviceValue = msg.substring(startIdx, startIdx + length);
System.out.println("--------------------------------------------------");
System.out.println("serviceCode=" + serviceValue);
System.out.println("==================================================");
System.out.println("==================================================");
logger.debug("--------------------------------------------------");
logger.debug("serviceCode=" + serviceValue);
logger.debug("==================================================");
logger.debug("==================================================");
if (StringUtils.isBlank(serviceValue)) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND,
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:
port.http: 38080
port: 38443