답변 5
0
log.info("username={},age={}",username,age );
답변감사드립니다
setting에서 idea 든 gradle 이든 jdk 11로 바꿔줫는데도 왜 15로 뜨는걸까요?
0
@Slf4j
@Controller
public class RequestParamController {
@RequestMapping("/request-param-v1")
public void requestParamV1(HttpServletRequest request, HttpServletResponse response) throws IOException {
String username = request.getParameter("username");
int age = Integer.parseInt(request.getParameter("age"));
response.getWriter().write("ok");
}
@ResponseBody
@RequestMapping("/request-param-v2")
public String requestParamV2(
@RequestParam("username") String memberName,
@RequestParam("age") int memberAge) {
log.info("username={}, age={}", memberName, memberAge);
return "ok";//@RestController 같은효과
}
}
#전체 로그 레벨 설정(기본 info)
logging.level.root=info
#hello.springmvc 패키지와 그 하위 로그 레벨 설정
logging.level.hello.springmvc=debug
2021-04-24 21:05:34.313 INFO 15380 --- [ main] hello.springmvc.SpringmvcApplication : Starting SpringmvcApplication using Java 15.0.2 on DESKTOP-C6Q38EP with PID 15380 (C:\study\springmvc\springmvc\out\production\classes started by 82109 in C:\study\springmvc\springmvc) 2021-04-24 21:05:34.317 DEBUG 15380 --- [ main] hello.springmvc.SpringmvcApplication : Running with Spring Boot v2.4.5, Spring v5.3.6 2021-04-24 21:05:34.318 INFO 15380 --- [ main] hello.springmvc.SpringmvcApplication : No active profile set, falling back to default profiles: default 2021-04-24 21:05:35.409 INFO 15380 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2021-04-24 21:05:35.421 INFO 15380 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2021-04-24 21:05:35.421 INFO 15380 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.45] 2021-04-24 21:05:35.515 INFO 15380 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2021-04-24 21:05:35.515 INFO 15380 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1132 ms 2021-04-24 21:05:35.915 INFO 15380 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2021-04-24 21:05:36.292 INFO 15380 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html] 2021-04-24 21:05:36.465 WARN 15380 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration) 2021-04-24 21:05:36.551 INFO 15380 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2021-04-24 21:05:36.563 INFO 15380 --- [ main] hello.springmvc.SpringmvcApplication : Started SpringmvcApplication in 2.734 seconds (JVM running for 3.135)
2021-04-24 21:06:19.710 INFO 15380 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2021-04-24 21:06:19.710 INFO 15380 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2021-04-24 21:06:19.712 INFO 15380 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
requestParamV1에 로그 출력 부분이 누락되어 있습니다.
다음 부분을 requestParamV1에도 포함해주세요.
log.info("username={}, age={}", memberName, memberAge);
0
0
0
다음 링크를 참고해주세요^^
https://www.inflearn.com/questions/116973