logback 动态设置日志级别
程序员文章站
2022-07-03 16:23:36
...
@Autowired(required = false)
private LogbackLoggingSystem logbackLoggingSystem;
@RequestMapping(value = "/log", method = RequestMethod.POST)
@ResponseBody
public Object log(HttpServletRequest request) {
logbackLoggingSystem.setLogLevel("org.mybatis", LogLevel.DEBUG);
logbackLoggingSystem.setLogLevel("com.hanshow.wise.base.data.mapper", LogLevel.DEBUG);
logbackLoggingSystem.setLogLevel("com.hanshow.wise", LogLevel.DEBUG);
return "";
}
<logger name="org.mybatis" level="INFO"></logger>
<logger name="com.hanshow.wise" additivity="false">
<level value="INFO" />
<appender-ref ref="StdOut"/>
<appender-ref ref="ALL"/>
<appender-ref ref="ERROR"/>
<appender-ref ref="INFO" />
<appender-ref ref="WARN" />
</logger>
上一篇: logback 设置不同包下的日志级别
下一篇: apollo配置logback日志级别