sprnig mvc : logging
This commit is contained in:
@@ -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";
|
||||
}
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
|
||||
logging.level.com.example.springmvc=trace
|
||||
Reference in New Issue
Block a user