This repository was archived by the owner on Feb 18, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on Feb 18, 2026. It is now read-only.
Adopt KotlinLogging across project (replace SLF4J LoggerFactory) #550
Copy link
Copy link
Open
Description
The coding guidelines specify using KotlinLogging for lazy evaluation and Kotlin idioms, but the project currently lacks this dependency and uses SLF4J's LoggerFactory consistently. This file follows the established pattern; however, if the team decides to migrate to KotlinLogging, add it to gradle/libs.versions.toml and refactor all logging instances.
Background and rationale:
- KotlinLogging provides idiomatic Kotlin logging APIs and supports lazy evaluation which avoids unnecessary string allocation.
- Current codebase initializes loggers via
org.slf4j.LoggerFactoryand therefore can't use KotlinLogging conveniences. - Migrating will make logging more consistent with Kotlin idioms and reduce allocations in hot paths.
Acceptance criteria / checklist:
- Add KotlinLogging dependency to
gradle/libs.versions.toml(include a suggested version entry) and to relevant Gradle modules (server/engine and any Kotlin modules). - Replace
LoggerFactory.getLogger(...)usage withmu.KotlinLogging.logger {}(or recommended KotlinLogging pattern) across the codebase. - Ensure logging calls use lazy evaluation where appropriate (e.g.,
logger.debug { "... $value" }). - Run
./gradlew buildand relevant unit/integration tests and fix any compile errors introduced by migration. - Update coding guidelines/docs to reference KotlinLogging and give examples.
- Optional: Provide a small automated codemod or script (grep/sed/ktlint/gradle-migrator) to help mass-refactor logging statements.
Additional notes for the assignee:
- Start by adding the dependency to
gradle/libs.versions.tomlso the project compiles. - Search for
LoggerFactory.getLoggerandorg.slf4j.LoggerFactoryusages; those are the primary migration targets. - Validate the change in CI and ensure no logging tests break.
Suggested labels: tech-debt, refactor, backend, kotlin.
Priority: medium.
Estimate: 2-4 days depending on scope.
Reactions are currently unavailable