You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by "mcmellawatt (GitHub)" <gi...@apache.org> on 2018/11/26 22:59:45 UTC

[GitHub] [geode] mcmellawatt commented on pull request #2891: GEODE-6052: Use constructor DI to avoid PowerMock in JMX tests

I spent quite a bit of time understanding why the logger should be static, and it appears to be a combination of convention and also protecting against potentially expensive instantiations if there are many instances of the object which references the logger.

https://logging.apache.org/log4j/2.x/manual/usage.html#StaticVsNonStatic

The downside of using a static logger is of course that you cannot inject the logger via DI.  Without DI, we can still test using facades, adapters, and other such tools but its not as straight forward as simple DI.

I went ahead and made it static and inlined the assignment, then added a package-protected wrapper method for the logger that I verify in my test.

[ Full content available at: https://github.com/apache/geode/pull/2891 ]
This message was relayed via gitbox.apache.org for notifications@geode.apache.org