将 Spring 条 Cloud Sleuth 日志消息发送到 Zipkin
Send Spring Cloud Sleuth log messages to Zipkin
我正在将 Spring Cloud Sleuth with Zipkin 添加到现有代码中以收集跟踪信息并最终记录任意消息。常规请求跨度已正确发送到 Zipkin:
2018-05-25 15:25:19.254 INFO [myapp,4c01686771321248,9c4b58c457df1acc,true] 1 --- [nio-7200-exec-6] c.f.l.service.SiteService : SiteService: getData
但是,我还想将日志消息发送到 Zipkin(作为新跨度或对现有跨度的注释)。如果我使用 org.slf4j.Logger
来简单地 LOG.info("something")
,我会在控制台输出中看到 INFO
消息,其中 exportable
标志设置为 true:
2018-05-25 15:25:19.274 INFO [myapp,4c01686771321248,9c4b58c457df1acc,true] 1 --- [nio-7200-exec-6] c.f.l.service.SiteService : something
检查 Zipkin 中的跟踪,正确找到了 span,但是找不到 LOG.info()
行中使用的消息——这表明我在这里做错了,或者也许它只是不应该以这种方式工作。我的采样百分比设置为 100%。
使用 slf4j 接口会很方便,因为现有代码已经以这种方式进行了检测。可能吗?如果是这样,什么是实施它的好方法?
However, I'd also like to send log messages to Zipkin (either as new spans or annotations to existing spans). If I use org.slf4j.Logger to simply LOG.info("something"), I see the INFO message in console output, with the exportable flag set to true:
您无法将日志发送到 Zipkin。您可以将日志语句发送到 ELK。您可以查看示例 https://github.com/marcingrzejszczak/vagrant-elk-box,它有一个带 ELK 的流浪盒,使用 Sleuth 进行日志关联并使用 ELK 可视化日志
我正在将 Spring Cloud Sleuth with Zipkin 添加到现有代码中以收集跟踪信息并最终记录任意消息。常规请求跨度已正确发送到 Zipkin:
2018-05-25 15:25:19.254 INFO [myapp,4c01686771321248,9c4b58c457df1acc,true] 1 --- [nio-7200-exec-6] c.f.l.service.SiteService : SiteService: getData
但是,我还想将日志消息发送到 Zipkin(作为新跨度或对现有跨度的注释)。如果我使用 org.slf4j.Logger
来简单地 LOG.info("something")
,我会在控制台输出中看到 INFO
消息,其中 exportable
标志设置为 true:
2018-05-25 15:25:19.274 INFO [myapp,4c01686771321248,9c4b58c457df1acc,true] 1 --- [nio-7200-exec-6] c.f.l.service.SiteService : something
检查 Zipkin 中的跟踪,正确找到了 span,但是找不到 LOG.info()
行中使用的消息——这表明我在这里做错了,或者也许它只是不应该以这种方式工作。我的采样百分比设置为 100%。
使用 slf4j 接口会很方便,因为现有代码已经以这种方式进行了检测。可能吗?如果是这样,什么是实施它的好方法?
However, I'd also like to send log messages to Zipkin (either as new spans or annotations to existing spans). If I use org.slf4j.Logger to simply LOG.info("something"), I see the INFO message in console output, with the exportable flag set to true:
您无法将日志发送到 Zipkin。您可以将日志语句发送到 ELK。您可以查看示例 https://github.com/marcingrzejszczak/vagrant-elk-box,它有一个带 ELK 的流浪盒,使用 Sleuth 进行日志关联并使用 ELK 可视化日志