solon.logging.impl [删除]
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon.logging.impl</artifactId>
</dependency>
1、介绍
日志扩展插件,提供了 slf4j 接口的适配能力。一般做为分布式日志服务的slf4j适配器,比如 water-solon-plugin,就是借助此插件对接自己的分布式日志服务。(v1.11.4 后标为弃用;由 solon.logging.simple 接替)
2、配置示例
日志等级的优先顺序:appender > logger > root。具体配置示例:
solon.app:
name: demoapp
# 以下为默认值,可以都不加(支持"云端配置服务"进行配置,支持写到"云端日志服务")
solon.logging.appender:
console:
level: TRACE
cloud:
level: INFO
# 记录器级别的配置示例
solon.logging.logger:
"root": #默认记录器配置
level: TRACE
"com.zaxxer.hikari":
level: WARN
3、使用示例
@Slf4j
@Controller
public class DemoController{
@Mapping("/hello")
public void hello(){
log.info("hello world!");
}
}
4、转发内核的日志到 Slf4j(如果有需要)
比如,应用启动时的日志、一些插件注册的日志
public class App {
public static void main(String[] args) throws Exception {
Solon.start(App.class, args, x -> {
//转发日志到 Slf4j 接口
//
LogUtil.globalSet(new LogUtilToSlf4j()); //v1.10.11 后支持
});
}
}