Github user jburwell commented on the pull request:

    https://github.com/apache/cloudstack/pull/1331#issuecomment-210066343
  
    @rafaelweingartner all statics should ``final`` unless there is explicit 
handling for their value changing due to thread safety issues. For loggers, 
they should always be ``private`` and ``static``.  Log4j provides the means to 
retrieve the same logger across threads and contexts by name.  Therefore, if 
you want 5 classes to share the same logger, retrieve the logger for that class 
by name in each class to avoid the potential pitfalls of static shadowing (i.e. 
instead of declaring ``private static final Logger LOGGER = 
Logger.getLogger(MyClass.class)``, declare it as ``private static final Logger 
LOGGER = Logger.getLogger(CONSTANT_WITH_THE_NAME_OF_ COMMON_LOGGER)``).
    
    As I mentioned in a previous comment, these type of compiler gymnastics are 
not necessary to test log output.  Log4j provides the means to attach a custom 
appender to the logger so that you can monitor and test output.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to