In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about how to use the hanboAudit audit log plug-in, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
HanboAudit is a log burying point plug-in, based on the ORM framework interceptor implementation, currently compatible with mybatis and hibernate.
Plug-in function
Record the values of operators, menus, modules, functions, and database row-level operations, which are mostly used for audit log display. Please move the source code here.
Plug-in use
Add maven dependency
Com.lmx common-util 1.0-SNAPSHOT
Hibernate configuration
Hibernate.ejb.interceptor=com.lmx.commom.oplog.OpHibernateInterceptor
Mybatis configuration
Logback sets appender and outputs to the specified log file (path needs to be set up by itself)
Demo code
Comment statement
@ Servicepublic class DemoServiceDelegate {@ Autowired DemoService demoService; @ OpLog (opId = "1", operationName = "test", opName = "zhangsan") public void hibernate () {demoService.hibernate ();} @ OpLog (opId = "2", operationName = "test", opName = "lisi") public void mybatis () {demoService.mybatis ();}}
Servlet interceptor declaration
Specify url pattern in the filter configuration to activate the burial site.
OplogFilter / xxx/* log output effect
Structured output, which can be imported into es via filebeats, which can be combined with kibana or customized display.
{"appId": 0, "operationType": "Modify", "originalValue": "Zhang San-mybatis-74009d85-6703-4f60-b715-da9e1e98530e", "modifyValue": "Zhang San-mybatis-f05cc7e1-6a84-4154-accd-18c0fae34fc3"} {"appId": 0, "operationType": "Modify", "originalValue": "503", "modifyValue": "603.0" {"appId": 0, "operationType": "Modify", "originalValue": "Li Si-mybatis-cf95c752-d375-4865-a322-4fda4857da44" "modifyValue": "Li Si-mybatis-58b819a0-be0e-4d99-b0d4-8a3455354d19"} {"appId": 0, "operationType": "Modify", "originalValue": "522.0", "modifyValue": "622.0"} {"appId": 0, "operationType": "Modify", "originalValue": "Zhang San-mybatis-f05cc7e1-6a84-4154-accd-18c0fae34fc3", "modifyValue": "Zhang San-mybatis-6a541445-a609-4b53-b1f8-24d695210509"} {"appId": 0, "operationType": "Modify" "originalValue": "603", "modifyValue": "703.0"} {"appId": 0, "operationType": "Modify", "originalValue": "Li Si-mybatis-58b819a0-be0e-4d99-b0d4-8a3455354d19", "modifyValue": "Li Si-mybatis-2d903541-24e2-49ff-98f3-e50fde784a4a"} {"appId": 0, "operationType": "Modify", "originalValue": "622.0", "modifyValue": "722.0" {"appId": 0, "operationType": "Modify" "originalValue": "Zhang San-mybatis-6a541445-a609-4b53-b1f8-24d695210509", "modifyValue": "Zhang San-mybatis-629e5ded-3e1d-423c-8bd3-0eed16bd44f5"} {"appId": 0, "operationType": "Modify", "originalValue": "703", "modifyValue": "803.0"} {"appId": 0, "operationType": "Modify", "originalValue": "Li Si-mybatis-2d903541-24e2-49ff-98f3-e50fde784a4a" "modifyValue": "Li Si-mybatis-3bead3f8-5099-4b9d-bbfa-f2313a573490"} {"appId": 0, "operationType": "Modify", "originalValue": "722.0", "modifyValue": "822.0"} extension
If it is a distributed system, you need to introduce traceId to track full-link logs. It is generally implemented by passing a globally unique id based on the http request header. If you rely on APM tools, such as skywalking, cat, etc., you can get the traceId provided by sdk directly.
The above is how to use the hanboAudit audit log plug-in, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.