Code Monkey home page Code Monkey logo

autologging's Issues

序列化复杂对象很容易出错

return fullMsg ? serializer.serialize(objects) : summary(objects, serializeConfig.getArgsMaxLength());

这一行经常在controller调用service的时候报错,一些传递进去的复杂对象序列化不了,不像普通的javabean。

我的项目里面每次进去都是使用的fastjson进行序列化的

我暂时也不知道如何处理这种复杂且多样的情况

结合springControllerAdvice traceId如何统一

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);
    }
    }

/**

  • 这是需要打日志的mapper,继承了一个通用的增删改查
    */
    @Marklog
    public interface CarMapper extends CommonMapper {
    }

import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.ids.SelectByIdsMapper;

/**

  • 这是通用的增删改查类
    */
    public interface CommonMapper extends SelectByIdsMapper,Mapper {
    }

MarkLogAspect中的切点定义,为何用的是EnableMarkLog注解,而不是MarkLog注解?

你好,最近在学习你写的日志框架,感觉颇有收获。这里有个小疑问想请教下。

MarkLogAspect中定义的切点,为何是基于EnableMarkLog注解(@Within(EnableMarkLog) || @annotation(EnableMarkLog)),而不是基于MarkLog注解的呢(@Within(MarkLog) || @annotation(MarkLog))?

按我理解,EnableMarkLog注解应该只是用来import诸如AutoLogConfig、MarkLogAspect等相关bean。实际在标注需要打日志的类或者方法时,应该使用MarkLog注解吧。

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.