下载skywalking
部署skywalking
-
解压apache-skywalking-apm-8.3.0.tar.gz
-
启动apache-skywalking-apm-bin\bin\startup.bat
生产环境,需要把数据保存ES
http://localhost:8080/
整合项目启动
idea 启动命令添加
-javaagent:D:\shitou\envir\apache-skywalking-apm-bin\agent\skywalking-agent.jar -Dskywalking.agent.service_name=xxx -Dskywalking.collector.backend_service=127.0.0.1:11800
请求接口
服务的调用关系,链路图,响应时间,内存使用情况都能看到,下面有官方详情文档
整合logback在控制台打印链路ID
添加依赖
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId>
<version>8.3.0</version>
</dependency>
添加logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="CONSOLE_LOG_PATTERN"
value="%date{yyyy-MM-dd HH:mm:ss} | %highlight(%-5level [%tid]) | %boldYellow(%thread) | %boldGreen(%logger) | %msg%n"/>
<!-- ch.qos.logback.core.ConsoleAppender 控制台输出 -->
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</layout>
</encoder>
</appender>
<root level="info">
<appender-ref ref="stdout" />
</root>
</configuration>
用了链路tid方便日志查询