简体   繁体   English

更改spring框架的日志记录级别

[英]Change logging level of spring framework

I am implementing a client of rest api by using Resttemplate of spring framework. 我正在通过使用spring框架的Resttemplate实现rest api的客户端。 The program is simple which just sends a Get request to the server. 该程序很简单,它只是将Get请求发送到服务器。 When I run the program, a lot of messages shows, something like: 当我运行该程序时,会显示很多消息,例如:

12:58:40.149 [main] DEBUG oahcprotocol.RequestAddCookies - CookieSpec selected: best-match 12:58:40.157 [main] DEBUG oahcprotocol.RequestAuthCache - Auth cache not set in the context 12:58:40.149 [main]调试oahcprotocol.RequestAddCookies-CookieSpec已选择:最佳匹配12:58:40.157 [main]调试oahcprotocol.RequestAuthCache-未在上下文中设置身份验证缓存

Does anyone know how to remove these messages when I run the program? 有谁知道我在运行程序时如何删除这些消息? BTW, I am using gradle to build my project. 顺便说一句,我正在使用gradle构建我的项目。

Thanks 谢谢

you have to add to your log4j.properties file ( probably in src/main/resources ) line like: 您必须添加到log4j.properties文件中(可能在src / main / resources中),如下所示:

log4j.logger.org.springframework.security=INFO

so it will only print those messages on 'INFO' level 因此它只会在“ INFO”级别显示这些消息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM