springboot添加fluent日志记录
istio默认会进行日志的记录,但是仅仅记录到服务、以及服务之间调用的信息,不记录业务日志。
如:

所以需要添加业务日志记录。
1.引入依赖
<dependency> <groupId>org.fluentd</groupId> <artifactId>fluent-logger</artifactId> <version>0.3.3</version></dependency> |
2.代码中引入相关类,并连接fluent服务
import org.fluentd.logger.FluentLogger;
1) 本地调用远程fluent服务
private static FluentLogger log = FluentLogger.getLogger("service-a.ServiceController","192.168.181.99",30224);
2)istio线上调用fluent服务
private static FluentLogger log = FluentLogger.getLogger("service-a.ServiceController","fluentd-es.logging",24224);
详解:
service-a.ServiceController为记录日志tag
192.168.181.99 为远程fluent服务
30224 为远程fluent服务的端口
建议:
tag为 当前服务名+类名
远程fluent服务不指定,默认为本地fluent服务
3.记录日志

详解:
log.log方法参数:tag建议为方法名称,key为(info,error,warn)中的一个,value为记录的信息。
4.fluent ui 展现情况

详解:
因为方法info 调用了notify方法,而且notify方法报错,所以fluent收到两条记录。
5.事例项目(jeager-fluent分支)
https://github.com/jiuchongxiao/istio-python-hello-jaeger.git
springboot添加fluent日志记录的更多相关文章
- python添加fluent日志记录-aop
python添加fluent日志,aop实现 1.配置fluent相关信息 fluent_config.ini fluent_config.ini [fluent.aop] #is support f ...
- python添加fluent日志记录
istio默认会进行日志的记录,但是仅仅记录到服务.以及服务之间调用的信息,不记录业务日志. 如: 所以需要添加业务日志记录. 1.python引入package fluentmsgpack 2.代码 ...
- spring/spirng boot添加fluent日志-aop
此项目以aop的形式添加fluent 日志 sample介绍 spring-mvc-aop-helloworld 为spring mvc aop condition toolcommontest 为s ...
- .NET Worker Service 添加 Serilog 日志记录
前面我们了解了 .NET Worker Service 的入门知识[1] 和 如何优雅退出 Worker Service [2],今天我们接着介绍一下如何为 Worker Service 添加 Ser ...
- SpringBoot使用logback日志记录
在resources里的配置文件: logback-spring.xml <?xml version="1.0" encoding="UTF-8" ?&g ...
- Yii2如何添加sql日志记录的配置信息
在使用Yii2框架的时候,常常会出现没有sql日志记录的问题.在代码里一句一句的打印sql语句也不现实.所以就要用文件记录起来. 在 config/web.php 里面的 log配置中增加如下配置 [ ...
- 记一次基于springboot+aop实现日志记录实战
1. 为什么要记录日志 好处: a. 可以对一些重要功能进行记录,方便以后跟踪是谁操作此功能的. b. 在操作某些功能时可能会发生异常,但每次出现异常我们想定位日志都要去服务器查看我们的日志.有了日志 ...
- .net 项目如何添加log4net日志记录
1.在项目根目录新建文件log4net.config,此文件中的节点解释还请自动百度. 文件实例: <?xml version="1.0"?><configura ...
- springboot添加log4j日志配置log4j.xml生成日志文件
第一步:添加pom文件依赖 <!-- log4j --> <dependency> <groupId>org.springframework.boot</gr ...
随机推荐
- Webservice之axis
根据wsdl的url,使用axis1.4生成客户端,并且对webservice进行调用 1.到www.apache.org上去下载axis-bin-1_4.zip,如要关联源代码就把axis-sr ...
- curl命令解析
curl命令可以实现http post或者get的请求,是linux下的命令行工具 1.1.直接请求url,打印标准输出 1.2.使用-o参数,可以标准输出到指定的位置 [root@VM-3-10-1 ...
- asp.net控件中的reportview不显示
如果reportview在asp.net中,图标出不来,打X 1.安装reportview控件(在装有vs2010中的电脑中搜,不要去下载,下载可能会出错) 2.如果是iis7以上版本,web.con ...
- C++学习一explicit
explicit关键字 C++中的关键字explicit主要是用来修饰类的构造函数,被修饰的构造函数的类,不能发生相应的隐式类型转换,只能以显示的方式进行类型转换.类构造函数默认情况下声明为隐式的即i ...
- 做好Unity4.x开发项目规划
1. 是否要用lua 2. (对于需操作的游戏)客户端游戏如何做战斗验证 下面列举小坑吧.不建议都绕开,毕竟没有那么多时间做前期调研的. 对应版本Unity4.x 1. 客户端程序层面 总的来说C#超 ...
- tf.identity 个人理解
tf.identity is useful when you want to explicitly transport tensor between devices (like, from GPU t ...
- php分割最后一个逗号后面的字符
$str = 'a/b/c/d/e/f'; echo preg_replace('/.*\//','',$str); echo preg_replace('/.*,/','',$str);最后 ...
- python list [:1]
python 切片slice 1.补充: A = np.ones([, , ]) B = np.ones([, ]) C = A*B[:, None, :] C.shape = 2,1,4 https ...
- I/O复用之epoll
epoll 简介 epoll是为处理大批量句柄而作了改进的poll,它是在2.5.44内核中被引进的. 相关函数调用 int epoll_create(int size); 创建一个epoll的句柄. ...
- C library:<cctype>(ctype.h)
1, isalnum(): check whether c is either a decimal digit or an uppercase or lowercase letter. 2, isal ...