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 展现情况

http://192.168.181.99:30601

详解:

因为方法info 调用了notify方法,而且notify方法报错,所以fluent收到两条记录。

5.事例项目(jeager-fluent分支)

https://github.com/jiuchongxiao/istio-python-hello-jaeger.git

springboot添加fluent日志记录的更多相关文章

  1. python添加fluent日志记录-aop

    python添加fluent日志,aop实现 1.配置fluent相关信息 fluent_config.ini fluent_config.ini [fluent.aop] #is support f ...

  2. python添加fluent日志记录

    istio默认会进行日志的记录,但是仅仅记录到服务.以及服务之间调用的信息,不记录业务日志. 如: 所以需要添加业务日志记录. 1.python引入package fluentmsgpack 2.代码 ...

  3. spring/spirng boot添加fluent日志-aop

    此项目以aop的形式添加fluent 日志 sample介绍 spring-mvc-aop-helloworld 为spring mvc aop condition toolcommontest 为s ...

  4. .NET Worker Service 添加 Serilog 日志记录

    前面我们了解了 .NET Worker Service 的入门知识[1] 和 如何优雅退出 Worker Service [2],今天我们接着介绍一下如何为 Worker Service 添加 Ser ...

  5. SpringBoot使用logback日志记录

    在resources里的配置文件: logback-spring.xml <?xml version="1.0" encoding="UTF-8" ?&g ...

  6. Yii2如何添加sql日志记录的配置信息

    在使用Yii2框架的时候,常常会出现没有sql日志记录的问题.在代码里一句一句的打印sql语句也不现实.所以就要用文件记录起来. 在 config/web.php 里面的 log配置中增加如下配置 [ ...

  7. 记一次基于springboot+aop实现日志记录实战

    1. 为什么要记录日志 好处: a. 可以对一些重要功能进行记录,方便以后跟踪是谁操作此功能的. b. 在操作某些功能时可能会发生异常,但每次出现异常我们想定位日志都要去服务器查看我们的日志.有了日志 ...

  8. .net 项目如何添加log4net日志记录

    1.在项目根目录新建文件log4net.config,此文件中的节点解释还请自动百度. 文件实例: <?xml version="1.0"?><configura ...

  9. springboot添加log4j日志配置log4j.xml生成日志文件

    第一步:添加pom文件依赖 <!-- log4j --> <dependency> <groupId>org.springframework.boot</gr ...

随机推荐

  1. 【原】wow64 x86/x64 代码切换过程分析

    下面以ntdll32!ZwQueryInformationProcess API为例分析 x86代码与x64代码之间的切换过程, 32bit的test程序: step1: ntdll32!ZwQuer ...

  2. 第五次Scrum冲刺

    第五次Scrum冲刺 1.成员今日完成情况 队员 今日完成任务 刘佳 前端初步构建 李佳 后端设计初级阶段 周世元 数据设计 杨小妮 博客编写 许燕婷 管理团队当日及次日任务 陈水莲 测试矩阵用例设计 ...

  3. python抽象方法

    1.抽象方法的概念 之前我们定义一个基类的时候,如果要求子类必须重写父类中的某一个方法,可以这样做: 定义一个名为Pizza的基类,让其get_radius方法必须被子类继承 class Pizza( ...

  4. vb的VSFlexGrid控件

    多行选中 VSFlexGrid的SelectionMode = flexSelectionListBox,现在可以配合Ctrl进行多行选择 循环取值 用vsflexgrid.SelectedRows  ...

  5. datagridview表头全选

    参与程序http://www.codeproject.com/KB/grid/CheckBoxHeaderCell.aspx 这里老外写的一个控件,他少了委托重载的一个方法.先写一个控件 public ...

  6. mysql执行流程

      https://www.jianshu.com/p/71a98f1347b9 image   image SQL示例: SELECT DISTINCT < select_list > ...

  7. C++ STL--queue 的使用方法

    2.queuequeue 模板类的定义在<queue>头文件中.与stack 模板类很相似,queue 模板类也需要两个模板参数,一个是元素类型,一个容器类型,元素类型是必要的,容器类型是 ...

  8. Error:No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android

    https://www.jianshu.com/p/fd3d49c7f1f8 通过Android Studio 的Sdk Manager安装NDK,安装完之后编译失败,报错信息如下: Error:No ...

  9. vue使用全局element-ui组件

    安装loader模块: cnpm install style-loader -D cnpm install css-loader -D cnpm install file-loader -D   安装 ...

  10. 第十一章 串 (a)ADT