在春季启动应用中使用logback.xml记录slf4j

时间:2018-08-10 15:26:59

标签: spring-boot slf4j

我有一个简单的带有slf4j的spring boot项目,我想修改日志,所以我在资源文件中创建了logback.xml

SELECT user.email, 
COUNT(request.user_request_id) AS requests, 
COUNT(action.lender_id) AS replies, 
COUNT(request.user_request_id) + COUNT(action.lender_id) AS total 
FROM request LEFT JOIN user ON user.id=request.user_request_id LEFT JOIN 
action ON request.object_id=action.object_id 
WHERE DATE_FORMAT(STR_TO_DATE(request.created_at, '%m-%d-%Y'), '%Y-%m') 
= '2018-03' 
OR DATE_FORMAT(STR_TO_DATE(action.created_at, '%m-%d-%Y'), '%Y-%m') = 
'2018-03' 
GROUP BY user.email 
ORDER BY total desc;

但是它不起作用,仍然打印出较低级别的消息,而且没有“ TEST”就更重要。如果我添加到application.properties <configuration debug="false"> <appender name="STDOUT"> <encoder> <pattern>TEST%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> <root level="WARN"> <appender-ref ref="STDOUT" /> </root> ,那么一切都很好。我应该在某个地方添加logback.xml文件吗?

0 个答案:

没有答案