Replace stack walking getLogger with explicit calls#84480
Replace stack walking getLogger with explicit calls#84480ChrisHegarty merged 4 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
|
👍 but we should also adjust the contribution docs which say to use the no-arg constructor: https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md#logging Also consider adding the no-arg constructor to build-tools-internal/src/main/resources/forbidden/es-server-signatures.txt so that this doesn't get unconsciously and progressively reverted over time. |
|
Great suggestions @DaveCTurner
Done.
Done. |
Replace the no-args LogManager::getLogger calls with the single-arg
variant that accepts a j.l.Class reference, which avoids the stack walk
of the no-args variant. The no-args variant determines the caller's
class by looking at the stack frame two positions from itself. The use
of the 1-args variant is more explicit and avoids the need for the stack
walk, while retaining the very same behaviour. Standardizing on the
1-args variant will reduce the need to have different ways to retrieve
logger references.