Code Monkey home page Code Monkey logo

log-report-sdk's Introduction

log-report-sdk

日志处理/上报,默认对接kafka上报日志,可根据spi自定义对接上报逻辑

构建/发布sdk包到本地/内网 **库

clean install / clean deploy

上报方式

1.HTTP日志上报(Controller日志)

描述:
 基于切面的方式,监控业务代码“请求/返回”JSON日志
 根据返回JSON对象的返回字段、返回码 决定是否上报Controller日志
 默认返回字段“status”(支持配置)
 默认返回码“all” 全部上报(支持配置)

接入方式:
(1)基于配置
 引入配置文件 classpath:application-log.xml
(2)基于注解
 添加包扫描 cn.com.tvmore.logreport.monitor

切入逻辑:
 切入所有被@RequestMapping 注解的方法(可自定义注解用于切入)

2.主动日志上报

描述:
 业务系统可根据情况,调用上报接口
 主动上报业务日志
 cn.com.tvmore.logreport.report.spi.Report

接口类别:
(1)上报普通信息日志 Report.info
 Report.info(String code, String msg)
 Report.info(String appName, String code, String msg)
 appName:业务系统名;code: 业务码;msg:日志信息
(2)上报警告日志 Report.warn
 Report.warn(String code, String msg)
 Report.warn(String appName, String code, String msg)
 appName:业务系统名;code: 业务码;msg:日志信息
(3)上报错误日志 Report.error
 Report.error(String code, String msg)
 Report.error(String appName, String code, String msg)
 appName:业务系统名;code: 业务码;msg:日志信息
(4)上报异常信息 Report.excepiton
 Report.exception(Throwable t)
 Report.exception(String appName, Throwable t)
 appName:业务系统名;t:异常对象

配置文件

业务系统需要新增配置文件 log-report.properties

内容:
 log.report.app-name= #上报日志的业务系统名
 log.report.app-domain= #业务系统域名

 log.report.monitor.field=status
 log.report.monitor.codes=all
 log.report.monitor.exclude.codes=200,401,102

 kafka.bootstrap.servers=XX.XX.XXX.XXX:XXXX,XX.XX.XXX.XXX:XXXX,XX.XX.XXX.XXX:XXXX

log-report-sdk's People

Contributors

zhangjicun avatar

Stargazers

DreamChaser avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.