This project adds the fluent log as an AOP sample introduction Spring-mvc-aop-helloworld for spring MVC AOP conditiontoolcommontest for spring boot AOP Condition0. Package uploads to Maven 1.spring boot and spring add dependencies <dependency> <groupid>com.taiyue.tool.common</g Roupid> <artifactId>tool-common</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency>2. Add application.properties1) Location Spring boot Add to resources under Spring MVC Add to Web-info under Classes folder 2) Details # If fluent log is supported False no true is (default) #即aop注解总开关fluent. aopstatus=true# Current service Name project.name=toolcommontest#fluent connection Information #非istio Project Fluent.url=192.168.181.99fluent.port=30224#istio Project #fluent.url=fluentd-es.logging#fluent.port=242243. Context introduced in AOP Class 1) Spring Boot Launcher class introduces @import ({controllerprocessaop.class, Daoprocessaop.class, Serviceprocessaop.class}) 2) Spring.xml<context:component-scan base-package= "Com.taiyue.tool.common.process"/><AOP: Aspectj-autoproxy proxy-target-class= "true"/>4. Use 1) AOP to add fluent logs spring boot/spring Controller class Add annotations @dinfourltag service class add annotations @dinfoservicetag DAO class add annotations @dinfodaotag Note: You can pass in Application.properties Over configuration Fluent.aopstatus Unified Control AOP effective or not 2) business code add fluent log if configured application.properties can be directly through the Fluentproperties.getlog () Gets the fluent service object. such as: Fluentproperties.getlog (). log ("Hello", "TestMethod", "HelloWorld"); Log Method: Log (string tag, string key, Object value) log (string tag, string key, object value, long timestamp) log (string tag, map<string, object> data) log (String tag, map<string, object> data, long timestamp)
5. Case code
Https://github.com/jiuchongxiao/fluent-aop.git
SPRING/SPIRNG boot Add fluent log-aop