寻找如何在 Spring Boot 应用程序中配置 slf4j 的方式:
我在我的 application.properties 中添加了这个:
logging.level.org.springframework.web=DEBUG
logging.file=book.log
logging.level.*=DEBUG
我有这个控制器:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Controller
@RequestMapping("/book")
public class BookController {
private static final Logger logger = LoggerFactory.getLogger(BookController.class);
@RequestMapping(value={ "/list"}, method = { RequestMethod.GET})
public String bookList(Model model, HttpServletRequest request) throws DataAccessException, SQLException {
logger.debug("testing...");
}
}
但是我的消息没有记录在文件中,但是还有其他消息:
...
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'multipartConfigElement': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'multipartResolver': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'spring.http.multipart-org.springframework.boot.autoconfigure.web.MultipartProperties': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'serverProperties': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'duplicateServerPropertiesDetector': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration$RestTemplateConfiguration': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'restTemplateBuilder': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.boot.devtools.autoconfigure.LocalDevToolsAutoConfiguration$RestartConfiguration': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'classPathFileSystemWatcher': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'classPathRestartStrategy': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'hateoasObjenesisCacheDisabler': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'fileSystemWatcherFactory': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.boot.devtools.autoconfigure.LocalDevToolsAutoConfiguration$LiveReloadConfiguration': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'liveReloadServer': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'optionalLiveReloadServer': no URL paths identified
2017-03-26 08:13:49.768 DEBUG 2426 --- [restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.boot.devtools.autoconfigure.
...