阿里的开源Java诊断工具Arthas可以在线调整log等级
- 查找当前类的classloader hashcode
sc -d com.example.demo.arthas.user.UserController | grep classLoaderHash
- 用OGNL获取logger
ognl -c 1be6f5c3 '@com.example.demo.arthas.user.UserController@logger'
- 单独设置UserController的logger level
ognl -c 1be6f5c3 '@com.example.demo.arthas.user.UserController@logger.setLevel(@ch.qos.logback.classic.Level@DEBUG)'
- 全局设置logger level
ognl -c 1be6f5c3 '@org.slf4j.LoggerFactory@getLogger("root").setLevel(@ch.qos.logback.classic.Level@DEBUG)'
网友评论