dadiyang / autologging Goto Github PK
View Code? Open in Web Editor NEW一个非常强大的监控日志输出框架,支持 SpringAOP 和动态字节码注入两种方式输出方法执行的监控日志,而且包含链路追踪功能,只要一个注解即可开启所有功能
License: Apache License 2.0
一个非常强大的监控日志输出框架,支持 SpringAOP 和动态字节码注入两种方式输出方法执行的监控日志,而且包含链路追踪功能,只要一个注解即可开启所有功能
License: Apache License 2.0
return fullMsg ? serializer.serialize(objects) : summary(objects, serializeConfig.getArgsMaxLength());
这一行经常在controller调用service的时候报错,一些传递进去的复杂对象序列化不了,不像普通的javabean。
我的项目里面每次进去都是使用的fastjson进行序列化的
我暂时也不知道如何处理这种复杂且多样的情况
hello,请教一下如何可以同时覆盖@controller 和 @RestControllerAdvice,因为两个方法都在另一个类中,无法覆盖到,导致每次发生错误的时候会在RestControllerAdvice中的方法重新生成traceId
org.springframework.web.servlet.DispatcherServlet#doDispatch
try{
handle();
}catch(exception e){
...
}
processDispatchResult();
1、controller里面调用service -->mapper 想把mapper 里面日志打出来
2. carService 调用carBiz carBiz继承一个通用增删改查
@RestController
@RequestMapping("car/")
public class CarController extends BaseController<CarBiz, Car, Integer> {
@Autowired
CarService carService;
@RequestMapping(value = "/aadd1", method = RequestMethod.GET)
@ResponseBody
@ApiOperation("新增单个对象")
public ObjectRestResponse<Car> add1() {
carService.insertByRandom();
return null;
}
@RequestMapping(value = "/addDefault", method = RequestMethod.GET)
@ResponseBody
@ApiOperation("新增单个对象")
public ObjectRestResponse<Car> addDefault() {
carService.insertByRandomDefault();
return null;
}
}
@service
public class CarService {
@Autowired
CarBiz carBiz;
@TargetDataSource(dataSourceKey = DataSourceKey.DB_SLAVE1)
public void insertByRandom() {
Car car = new Car();
car.setName("ifaofa");
car.setId(11111111);
carBiz.insertSelective(car);
}
public void insertByRandomDefault() {
Car car = new Car();
car.setName("ifaofa"+ new Random().nextInt(1000));
carBiz.insertSelective(car);
}
}
@service
public class CarBiz extends BusinessBiz<CarMapper, Car> {
}
/**
基础业务类
@author woozoom
@Version 2018/1/13.
*/
public abstract class BusinessBiz<M extends CommonMapper, T> extends BaseBiz<M, T> {
@OverRide
public void insertSelective(T entity) {
EntityUtils.setCreatAndUpdatInfo(entity);
super.insertSelective(entity);
}
@OverRide
public void updateById(T entity) {
EntityUtils.setUpdatedInfo(entity);
super.updateById(entity);
}
@OverRide
public void updateSelectiveById(T entity) {
EntityUtils.setUpdatedInfo(entity);
super.updateSelectiveById(entity);
}
}
/**
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.ids.SelectByIdsMapper;
/**
你好,最近在学习你写的日志框架,感觉颇有收获。这里有个小疑问想请教下。
在MarkLogAspect中定义的切点,为何是基于EnableMarkLog注解(@Within(EnableMarkLog) || @annotation(EnableMarkLog)),而不是基于MarkLog注解的呢(@Within(MarkLog) || @annotation(MarkLog))?
按我理解,EnableMarkLog注解应该只是用来import诸如AutoLogConfig、MarkLogAspect等相关bean。实际在标注需要打日志的类或者方法时,应该使用MarkLog注解吧。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.