Skip to content

8.x release notes #599

Closed
Closed

Description

@mutyonok

Hi,

Is it possible to provide release notes for 8.x? It's a major version bump and i suppose there should be breaking changes???

Activity

  1. github-actions commented on Mar 13, 2026

    @github-actions

    Thank you for reporting an issue. See the wiki for documentation and slack for questions.

  2. nickcaballero commented on Apr 16, 2026

    @nickcaballero

    Generated by Claude:


    kotlin-logging 8.0.01 — Complete Summary

    🚨 Breaking Changes

    1. Configuration structure overhaul (#584)

    The direct logging settings have been moved into a nested namespace. Old: KotlinLoggingConfiguration.logLevel = Level.INFO → New: KotlinLoggingConfiguration.direct.logLevel = Level.INFO. The same applies to appender and formatter. The property logFactory has also been renamed to loggerFactory. Additionally, DefaultLoggerFactory and KotlinLoggingLevel.kt (shadowed extension functions) have been removed.

    2. KLogger API cleanup — deprecated methods removed (#586)

    All deprecated methods have been deleted from KLogger, including legacy SLF4J-style string overloads (e.g., info(msg: String?)) and deprecated property accessors (e.g., isTraceEnabled). The API is now strictly lambda-oriented for lazy evaluation.

    The surviving method shapes are:

    fun info(message: () -> Any?)                                         // standard
    fun info(throwable: Throwable?, message: () -> Any?)                  // with exception
    fun info(marker: Marker?, message: () -> Any?)                        // with marker
    fun info(marker: Marker?, throwable: Throwable?, message: () -> Any?) // full

    The = null default value has also been removed from the throwable parameter in marker-accepting signatures to prevent compiler ambiguity and positional argument mishaps. Marker overloads that were previously deprecated have been restored as the primary, idiomatic way to log with markers.


    ✨ New Features

    3. Unified, swappable logger provider architecture (#584)

    The headline change of the release. This implements a Universal Provider Architecture, enabling swappable logging implementations across all platforms (JVM, Android, Native, Darwin, JS, and Wasm), and promotes the "Direct" logging implementation to be a first-class citizen available on every platform.

    • KotlinLoggingConfiguration is now accessible from commonMain and serves as the single entry point, with loggerFactory controlling the active provider.
    • DirectLoggerFactory and DarwinLoggerFactory have been moved from internal packages to io.github.oshai.kotlinlogging, allowing users to explicitly reference them when configuring KotlinLoggingConfiguration.loggerFactory.
    • You can now write a custom Appender once in commonMain and use it on every platform. On JVM/Android/Darwin, this requires opt-in via KotlinLoggingConfiguration.loggerFactory = DirectLoggerFactory.
    • Platform defaults: JVM defaults to SLF4J (with auto-detection of JUL, Logback, or Direct), Android detects AndroidNativeLoggerFactory or falls back to SLF4J, Darwin defaults to DarwinLoggerFactory (OSLog), and Native/JS/Wasm default to DirectLoggerFactory.
    • The configuration also prints warnings if you try to configure direct properties (like appender) while the active factory is not DirectLoggerFactory, preventing silent-ignore confusion.

    4. Timestamp added to KLoggingEvent (#591)

    A timestamp: Long field has been added to KLoggingEvent to capture event time. This is implemented via a new internal multiplatform KLoggingClock that provides getCurrentTime() on all targets (JVM/Android, JS, Native, Wasm) without external dependencies.

    5. Suppress startup message (#589)

    A logStartupMessage property has been added to KotlinLoggingConfiguration to allow disabling the "kotlin-logging: initializing..." startup message. It is implemented for all platforms (JVM, Android, Darwin, JS, Native, Wasm).

    6. JPMS support (#592)

    A module-info.java has been added, allowing kotlin-logging to be used as a named module in modularized Java applications. It uses a Multi-Release JAR strategy so that Kotlin classes still target Java 1.8, while the module descriptor targets Java 9+. Static requirements are declared for optional dependencies including Logback, kotlinx-coroutines-slf4j, and GraalVM native image.


    🐛 Fixes & Refactors

    7. Initialization timing fix (#585)

    The active factory diagnostic message is now printed during KotlinLogging's lazy initialization rather than eagerly, preventing premature logging before configuration is complete. The direct logging configuration factory check has also been centralized into a common internal function applied consistently across all platform setters.

    8. Darwin OSLog redaction fix (#590 + #594)

    Two PRs tackled the same underlying Darwin bug. os_log redacts dynamic strings by default in historical logs (viewed via log show or Console.app) for privacy. DarwinKLogger was updated to use %{public}s as a fixed format string, passing the message as an argument and explicitly marking it as public data to prevent redaction. PR #590 was a first attempt; #594 completed the fix properly by introducing a C-interop definition (oslog.def) with a static inline function that passes a constant C string literal to os_log_with_type, which is required for clang to place the format string in the correct binary section for log archival to work. If you're on Darwin and previously saw <compose failure> when reading historical logs, this is now resolved.

    9. CI/action fix (#593)

    A minor fix to the GitHub Actions workflow — no user-facing impact.


    Migration TL;DR

    The things most likely to affect you when upgrading from 7.x:

    1. Rename KotlinLoggingConfiguration.logLevel/appender/formatter → KotlinLoggingConfiguration.direct.*
    2. Rename logFactory → loggerFactory
    3. Remove any calls to old string-based KLogger methods (info(msg: String?), isTraceEnabled, etc.) and replace with lambda equivalents
    4. If you use the DefaultLoggerFactory class directly, switch to the appropriate platform-specific factory or DirectLoggerFactory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions