Code Monkey home page Code Monkey logo

Comments (4)

hpresnall avatar hpresnall commented on June 18, 2024

The current logger is a class instance:
private final Log logger = LogFactory.getLog(getClass());

This was probably copy pasta from elsewhere that actually needed to use getClass(). I don't see any reason why the Log can't be static with SpringManagedTransaction.class passed to getLog() .

from spring.

emacarron avatar emacarron commented on June 18, 2024

Some time ago (in the times of RCs) Simo advised us to change that due to this:
http://wiki.apache.org/commons/Logging/StaticLog

Not sure if using statics is a real problem given that this is how the whole spring framework is coded...

from spring.

paulkrause88 avatar paulkrause88 commented on June 18, 2024

If this is a deliberate use of the transient logger pattern, then it needs to be applied across the board to do much good. At present, only SpringManagedTransaction and SqlSessionFactoryBean have non-static loggers (and it's inconceivable to me that only mybatis-spring and not mybatis core would be deployed in a shared directory). Also, the implementation of LogFactory in mybatis-3.2.2 is incompatible with repeated calls to getLog(): it's simply too slow to be used this way.

Hunter's point about the misuse of getClass() is also well taken. There may be times when this is an appropriate thing to do, but they are rare, and this is not one of them.

from spring.

emacarron avatar emacarron commented on June 18, 2024

Yep, that code does not make sense I will change it to the classic method.

from spring.

Related Issues (20)

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.