Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
-
None
Description
The majority of Logger usage in Solr is via static variables, but there are a few places where this pattern does not hold true - i think we should fix that and be completley consistent. if there is any specific cases where a non-static variable really makes a lot of sense, then it should be heavily commented as to why.
The SLF4J FAQ has a list of pros and cons for why Logger variables should/shouldn't be static...
http://slf4j.org/faq.html#declared_static
...the majority of the "pros" for non-static usage don't really apply to Solr, while the pros for static usage due.
Another lucene/solr specific pro in favor of static variables for loggers is the way our test framework looks for memory leaks in tests. Having a simple test that does not null out a static reference to what seems like a small object is typically fine – but if that small object has an explicit (non-static) reference to a Logger, all of the state in that Logger is counted as part of the size of that small object leading to confusion.
Attachments
Attachments
Issue Links
- duplicates
-
SOLR-8330 Restrict logger visibility throughout the codebase to private so that only the file that declares it can use it
- Closed
- is related to
-
SOLR-15005 RequestHandlerBase's logger name should point to the implementation class
- Resolved
- relates to
-
SOLR-4825 Port SolrLogFormatter to log4j
- Closed