SpringBoot 接口请求日志的打印(ApiBoot)

本文档介绍了如何通过ApiBoot与SpringBoot整合,实现接口请求日志的监控和打印。主要步骤包括:在pom.xml中引入ApiBoot 2.3.3.RELEASE及其logging依赖,在application.yaml中配置项目名称和日志展示选项,并在启动类上添加@EnableLoggingClient注解。这样可以实现接口请求日志的美化打印。
摘要由CSDN通过智能技术生成

链接:
ApiBoot官方使用文档

该博客描述很详细,推荐:
SpringBoot 整合ApiBoot Logging 实现监控打印接口的请求日志

流程:
1 配置pom.xml文件
注意ApiBoot依赖版本是2.3.3.RELEASE,其对应的SpringBoot版本是2.3.6.RELEASE

<!--ApiBoot 版本依赖-->
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.minbox.framework</groupId>
      <artifactId>api-boot-dependencies</artifactId>
      <version>2.3.3.RELEASE</version>
      <scope>import</scope>
      <type>pom</type>
    </dependency>
  </dependencies>
</dependencyManagement>
<!-- ApiBoot 依赖 -->
<dependency>
  <groupId>org.minbox.framework</groupId>
  <artifactId>api-boot-starter-logging</artifactId>
</dependency>

2、配置application.yaml文件

#配置端口
server:
	port: 8080
#配置项目名称
spring:
 application:
   name: Demo   #注意一定要配置项目名
#配置ApiBoot Logging 日志组件
api:
  boot:
    logging:
      show-console-log: true
      #实现美化打印请求日志
      format-console-log-json: true

3、启动类上加上注解 @EnableLoggingClient

配置完毕!可使用!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值