sprnig mvc : logging

This commit is contained in:
haerong22
2021-04-05 15:59:16 +09:00
parent cb96cafd2a
commit 5ba57148a4
2 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package com.example.springmvc.basic;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
public class LogTestController {
// private final Logger log = LoggerFactory.getLogger(getClass()); // LogTestController.class
@RequestMapping("/log-test")
public String logTest() {
String name = "Spring";
System.out.println("name = " + name);
log.trace("trace log = {}", name);
log.debug("debug log = {}", name);
log.info("info log = {}", name);
log.warn("warn log = {}", name);
log.error("error log = {}", name);
return "ok";
}
}

View File

@@ -1 +1,2 @@
logging.level.com.example.springmvc=trace