Spring/Spring Boot

logging

hoonssss 2023. 9. 21. 01:25
반응형
SMALL
package com.in28minutes.springboot.myfirstwebapp.login;

import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import ch.qos.logback.core.model.Model;

@Controller
public class LoginController {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@RequestMapping("login")
	public String gotoLoginPage(@RequestParam String name, ModelMap model) {
		model.put("name", name);
        
		logger.debug("Request param is {} " + name);
		logger.info("I want this printed at info level");
		logger.warn("I want this printed at warn level");
        
		return "login";
	}
}
logging.level.org.springframework=info
logging.level.com.in28minutes.springboot.myfirstwebapp=info

 

반응형
LIST

'Spring > Spring Boot' 카테고리의 다른 글

REST API 버전 관리 (params, headers, produces)  (0) 2023.10.05
name, password 구현  (0) 2023.09.21
@RequestParam  (0) 2023.09.21
JSP Login view  (0) 2023.09.20
Spring boot @Controller, @ResposeBody  (0) 2023.09.20