diff --git a/.agents/tasks/logging-jvmtest-triage.md b/.agents/tasks/logging-jvmtest-triage.md new file mode 100644 index 00000000..ffbdf60c --- /dev/null +++ b/.agents/tasks/logging-jvmtest-triage.md @@ -0,0 +1,69 @@ +# Triage and fix the 25 latent `:logging:jvmTest` failures + +## Problem + +Enabling the JUnit Platform on the KMP `jvmTest` task (see +`kmp-jvmtest-junit-platform.md`, branch `claude/angry-hugle-d62cfe`) surfaced +25 latent test failures in `:logging:jvmTest` (232 run, 207 pass) which +accumulated while the task silently discovered zero tests. + +Reproduce with JDK 17: +`./gradlew :logging:jvmTest --rerun` (requires the `kmp-module.gradle.kts` +fix from that branch; a copy is applied in this worktree). + +## Triage results + +Production fixes (behavior drifted from the Flogger contract during the +Kotlin migration): + +1. `MetadataKey.cast` — returned `null` on type mismatch; now throws + `ClassCastException` (Flogger parity; `null` input still passes through). +2. `checkCannotRepeat` — used `check` (ISE) with an inverted message; now + `require` (IAE) per the documented contract of `findValue`/`getSingleValue`. +3. `MetadataHandler.Builder.addRepeatedHandler` — called `checkCannotRepeat`, + the exact opposite of Flogger's `checkArgument(key.canRepeat())`; inverted. +4. `SimpleProcessor` — lost `Collections.unmodifiableList` in translation + (`e.setValue(e.value as List<*>)` is a no-op cast); repeated-value + iterators are now wrapped in a read-only `UnmodifiableIterator`. +5. `LogContext.log {}` — evaluated the message lambda *before* + `AbstractLogger.write`, escaping the recursion guard and error handling; + evaluation now happens inside `write(data, prepare)`. + Also, a `null` message now reaches the backend unmodified + (was string-concatenated into `"null"`). +6. `AbstractLogger` error-report timestamps — used `LocalDateTime.Formats.ISO` + (no offset, variable millis); now `yyyy-MM-dd'T'HH:mm:ss.SSSZ` equivalent. +7. `AbstractLogger.atConfig()` — mapped to `Level.INFO` (copy-paste); + now `Level.CONFIG`. +8. `LogPerBucketingStrategy.byClass()/byClassName()` — used + `key::class`/`qualifiedName!!` (identity not guaranteed; NPE for local and + anonymous classes); now `key.javaClass`/`key.javaClass.name`. +9. `ScopedLoggingContext.Builder.run(Runnable)` — missing member (silently + shadowed by stdlib `kotlin.run`, which never installs the context); added. + +Test fixes (tests carried stale or Java-specific expectations): + +- `AbstractLoggerSpec` — case-insensitive match for the recursion message. +- `LogContextSpec` — `log { null }` expects a `null` literal (rendered as + `"null"` by `SimpleMessageFormatter`), not `""`. +- `JvmLoggerSpec` — invocation counters moved out of lazy message lambdas + (lambdas only run for statements which log); the log-site method name is + the sanitized synthetic lambda method. +- `LogLevelMapSpec` — `String::class` registers as `kotlin.String` + (consistent with `LoggingFactory` logger names), not `java.lang.String`. +- `LoggingCompatibilityTest` — Kotlin requires `*` spread to pass an array + as `vararg`. +- `AnyExtsJvmSpec` — expect Spine's backtick diagnostic style. + +## Status + +- [x] All 25 failures reproduced and triaged +- [x] Production fixes applied +- [x] Test fixes applied +- [x] `:logging:jvmTest` green (232/232) +- [x] Full `./gradlew build --continue` green (all modules, detekt, Kover) + +## Notes + +- The `update-copyright` PostToolUse hook strips `The Flogger Authors; ` + from headers; restored in all touched files (keep watching this). +- Delete this file on merge to master. diff --git a/docs/dependencies/dependencies.md b/docs/dependencies/dependencies.md index 03143968..a29a73ec 100644 --- a/docs/dependencies/dependencies.md +++ b/docs/dependencies/dependencies.md @@ -1,6 +1,6 @@ -# Dependencies of `io.spine:spine-logging-context-tests:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-context-tests:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : org.jetbrains. **Name** : annotations. **Version** : 26.1.0. @@ -441,14 +441,14 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:26 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-fixtures:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-fixtures:2.0.0-SNAPSHOT.423` ## Runtime ## Compile, tests, and tooling @@ -1240,14 +1240,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:53 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:27 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-grpc-context:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-grpc-context:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -2094,14 +2094,14 @@ This report was generated on **Thu Jul 02 12:40:53 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:26 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-jul-backend:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-jul-backend:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -2932,14 +2932,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:26 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-jvm-default-platform:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-jvm-default-platform:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -3786,14 +3786,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:26 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-jvm-jul-backend-grpc-context:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-jvm-jul-backend-grpc-context:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -4692,14 +4692,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:26 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-jvm-jul-backend-std-context:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-jvm-jul-backend-std-context:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -5590,14 +5590,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:27 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-jvm-log4j2-backend-std-context:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-jvm-log4j2-backend-std-context:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -6508,14 +6508,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:27 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-jvm-slf4j-jdk14-backend-std-context:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-jvm-slf4j-jdk14-backend-std-context:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -7414,14 +7414,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:26 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-jvm-slf4j-reload4j-backend-std-context:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-jvm-slf4j-reload4j-backend-std-context:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -8324,14 +8324,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:27 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-log4j2-backend:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-log4j2-backend:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -9206,14 +9206,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:26 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging:2.0.0-SNAPSHOT.423` ## Runtime ## Compile, tests, and tooling @@ -10013,14 +10013,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:53 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:27 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:logging-testlib:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine.tools:logging-testlib:2.0.0-SNAPSHOT.423` ## Runtime ## Compile, tests, and tooling @@ -10832,14 +10832,14 @@ This report was generated on **Thu Jul 02 12:40:53 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:27 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-otel-backend:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-otel-backend:2.0.0-SNAPSHOT.423` ## Runtime ## Compile, tests, and tooling @@ -11739,14 +11739,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:53 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:27 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-otel-backend-bootstrap:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-otel-backend-bootstrap:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.auto.service. **Name** : auto-service-annotations. **Version** : 1.1.1. @@ -13157,14 +13157,14 @@ This report was generated on **Thu Jul 02 12:40:53 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:27 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-probe-backend:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-probe-backend:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.auto.service. **Name** : auto-service-annotations. **Version** : 1.1.1. @@ -14015,14 +14015,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:26 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-smoke-test:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-smoke-test:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0. @@ -14921,14 +14921,14 @@ This report was generated on **Thu Jul 02 12:40:52 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:53 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:27 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine:spine-logging-std-context:2.0.0-SNAPSHOT.422` +# Dependencies of `io.spine:spine-logging-std-context:2.0.0-SNAPSHOT.423` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -15759,6 +15759,6 @@ This report was generated on **Thu Jul 02 12:40:53 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jul 02 12:40:53 WEST 2026** using +This report was generated on **Thu Jul 02 19:17:27 WEST 2026** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/docs/dependencies/pom.xml b/docs/dependencies/pom.xml index 91fc404e..58493d11 100644 --- a/docs/dependencies/pom.xml +++ b/docs/dependencies/pom.xml @@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject. --> io.spine logging -2.0.0-SNAPSHOT.422 +2.0.0-SNAPSHOT.423 2015 diff --git a/logging/src/commonMain/kotlin/io/spine/logging/LoggingFactory.kt b/logging/src/commonMain/kotlin/io/spine/logging/LoggingFactory.kt index c4a1a362..fcfd813e 100644 --- a/logging/src/commonMain/kotlin/io/spine/logging/LoggingFactory.kt +++ b/logging/src/commonMain/kotlin/io/spine/logging/LoggingFactory.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, TeamDev. All rights reserved. + * Copyright 2026, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,9 +85,8 @@ public expect object LoggingFactory { /** * Obtains a name of a logger to be used for this class. * - * For a fully-qualified class, its name will be used. - * Otherwise, if a class has a simple name, it will be used. - * If a class does not have a simple name, the string representation - * of the class will be returned. + * The name matches the name of the logger created by [LoggingFactory.loggerFor] + * for this class: it is the name of the Java class, which may differ from + * the Kotlin qualified name (e.g., `java.lang.String` for `String::class`). */ -internal fun KClass<*>.toLoggerName(): String = qualifiedName?:simpleName?:toString() +internal fun KClass<*>.toLoggerName(): String = java.name diff --git a/logging/src/commonMain/kotlin/io/spine/logging/MetadataKey.kt b/logging/src/commonMain/kotlin/io/spine/logging/MetadataKey.kt index 6512f7bc..690da652 100644 --- a/logging/src/commonMain/kotlin/io/spine/logging/MetadataKey.kt +++ b/logging/src/commonMain/kotlin/io/spine/logging/MetadataKey.kt @@ -1,5 +1,5 @@ /* - * Copyright 2026, TeamDev. All rights reserved. + * Copyright 2023, The Flogger Authors; 2026, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/logging/src/commonMain/kotlin/io/spine/logging/context/LogLevelMap.kt b/logging/src/commonMain/kotlin/io/spine/logging/context/LogLevelMap.kt index 7ce2a342..2e070fbd 100644 --- a/logging/src/commonMain/kotlin/io/spine/logging/context/LogLevelMap.kt +++ b/logging/src/commonMain/kotlin/io/spine/logging/context/LogLevelMap.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, The Flogger Authors; 2025, TeamDev. All rights reserved. + * Copyright 2023, The Flogger Authors; 2026, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,21 +109,17 @@ public class LogLevelMap private constructor(map: Map, defaultLev /** * Adds the given classes at the specified log level. * - * @param level The logging level to assign for the given [classes] - * @param classes The classes to assign the logging [level]. Each class must have - * a [qualified name][KClass.qualifiedName]. - * @throws IllegalArgumentException if one of the [classes] does not have - * a [qualified name][KClass.qualifiedName]. + * Each class is registered under the name of the logger which + * [LoggingFactory][io.spine.logging.LoggingFactory] creates for it, + * so the level applies to the logging done by that class. + * + * @param level The logging level to assign for the given [classes]. + * @param classes The classes to assign the logging [level]. */ @CanIgnoreReturnValue public fun add(level: Level, vararg classes: KClass<*>): Builder { for (cls in classes) { - val name = cls.qualifiedName - require(name != null) { - "Cannot add the class `${cls}` because it does not have" + - " a qualified name (it may be local or anonymous)." - } - put(name, level) + put(cls.toLoggerName(), level) } return this } diff --git a/logging/src/commonTest/kotlin/io/spine/logging/LogLevelMapSpec.kt b/logging/src/commonTest/kotlin/io/spine/logging/LogLevelMapSpec.kt index 988e6246..e570ab80 100644 --- a/logging/src/commonTest/kotlin/io/spine/logging/LogLevelMapSpec.kt +++ b/logging/src/commonTest/kotlin/io/spine/logging/LogLevelMapSpec.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, TeamDev. All rights reserved. + * Copyright 2026, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -105,7 +105,9 @@ internal class LogLevelMapSpec { setDefault(INFO) } map.run { - levelOf(String::class.qualifiedName!!) shouldBe DEBUG + // Classes are registered under the names of their JVM loggers, + // which use Java class names, e.g. `java.lang.String`. + levelOf(String::class.java.name) shouldBe DEBUG levelOf(String::class) shouldBe DEBUG levelOf("java.lang") shouldBe WARNING levelOf("io.spine") shouldBe INFO @@ -119,7 +121,8 @@ internal class LogLevelMapSpec { add(WARNING, Int::class) } val map2 = logLevelMap { - add(DEBUG, "kotlin.collections") + // `List::class` maps to `java.util.List` on the JVM. + add(DEBUG, "java.util") } val merged = map1.merge(map2) diff --git a/logging/src/commonTest/kotlin/io/spine/logging/context/LogLevelMapSpec.kt b/logging/src/commonTest/kotlin/io/spine/logging/context/LogLevelMapSpec.kt index aae1b607..c2710d9a 100644 --- a/logging/src/commonTest/kotlin/io/spine/logging/context/LogLevelMapSpec.kt +++ b/logging/src/commonTest/kotlin/io/spine/logging/context/LogLevelMapSpec.kt @@ -101,11 +101,10 @@ internal class LogLevelMapSpec { .build() levelMap["com.google"] shouldBe INFO levelMap["java.lang"] shouldBe WARNING - // Classes are registered under their Kotlin qualified names, matching - // the logger names produced by `LoggingFactory`. For the mapped type - // `String::class` this is `kotlin.String`, not `java.lang.String`. - levelMap["kotlin.String"] shouldBe FINE - levelMap["java.lang.String"] shouldBe WARNING + // Classes are registered under the names of the loggers created for + // them, which on the JVM are Java class names: `java.lang.String` + // rather than the Kotlin name `kotlin.String`. + levelMap["java.lang.String"] shouldBe FINE } } diff --git a/version.gradle.kts b/version.gradle.kts index 1899d8ed..db7916b7 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -24,4 +24,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -extra.set("versionToPublish", "2.0.0-SNAPSHOT.422") +val versionToPublish: String by extra("2.0.0-SNAPSHOT.423")