Find loggers declared as instance fields (one per object)

Proprietary

An instance-field val log = LoggerFactory.getLogger(...) allocates one logger per object. Logger factories cache by name, so the runtime cost is one extra map lookup per allocation — but the conventional shape is a private val log in the companion object (or a top-level private val log for top-level functions), so a per-instance logger usually reflects accidental code placement.

org.openrewrite.kotlin.logging.FindLoggerNotInCompanion$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.logging.FindLoggerNotInCompanion$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.