Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: oshai/kotlin-logging
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7.0.5
Choose a base ref
...
head repository: oshai/kotlin-logging
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7.0.6
Choose a head ref
  • 4 commits
  • 5 files changed
  • 4 contributors

Commits on Mar 16, 2025

  1. Bump com.android.library from 8.8.2 to 8.9.0

    Bumps com.android.library from 8.8.2 to 8.9.0.
    
    ---
    updated-dependencies:
    - dependency-name: com.android.library
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored and oshai committed Mar 16, 2025
    Copy the full SHA
    fe2f82a View commit details

Commits on Mar 25, 2025

  1. Bump actions/cache from 4.2.2 to 4.2.3

    Bumps [actions/cache](https://github.com/actions/cache) from 4.2.2 to 4.2.3.
    - [Release notes](https://github.com/actions/cache/releases)
    - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
    - [Commits](actions/cache@v4.2.2...v4.2.3)
    
    ---
    updated-dependencies:
    - dependency-name: actions/cache
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored and oshai committed Mar 25, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    730e279 View commit details

Commits on Mar 27, 2025

  1. Fix native image compilation when Logback is not on the classpath (#491)

    * Fix native image compilation when Logback is not on the classpath
    
    Fixes #465
    
    
    ---------
    
    Co-authored-by: Lars Bilger <lars.bilger@lht.dlh.de>
    lbilger and Lars Bilger authored Mar 27, 2025
    Copy the full SHA
    06f6e71 View commit details

Commits on Mar 31, 2025

  1. bump version to 7.0.7

    oshai committed Mar 31, 2025
    Copy the full SHA
    1b81239 View commit details
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ jobs:

- name: Restore native cache
id: cache-native
uses: actions/cache@v4.2.2
uses: actions/cache@v4.2.3
with:
path: |
scripts/build
@@ -56,7 +56,7 @@ jobs:

- name: Restore Gradle cache
id: cache-gradle
uses: actions/cache@v4.2.2
uses: actions/cache@v4.2.3
with:
path: |
~/.gradle/caches
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ plugins {
kotlin("multiplatform") version "2.0.21"
// This version is dependent on the maximum tested version
// of this plugin within the Kotlin multiplatform library
id("com.android.library") version "8.8.2"
id("com.android.library") version "8.9.0"

id("org.jetbrains.dokka") version "2.0.0"

@@ -24,7 +24,7 @@ plugins {
apply("versions.gradle.kts")

group = "io.github.oshai"
version = "7.0.6"
version = "7.0.7"

repositories {
google()
@@ -144,6 +144,7 @@ kotlin {
compileOnly("org.slf4j:slf4j-api:${extra["slf4j_version"]}")
compileOnly("ch.qos.logback:logback-classic:${extra["logback_version"]}")
compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:${extra["coroutines_version"]}")
compileOnly("org.graalvm.sdk:nativeimage:${extra["nativeimage_version"]}")
}
}
val jvmLogbackTest by getting {
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@ internal actual object KLoggerFactory {

/** get logger by explicit name */
internal actual fun logger(name: String): KLogger {
// Note: any changes here might have to be also applied to
// [Target_io_github_oshai_kotlinlogging_internal_KLoggerFactory].
if (System.getProperty("kotlin-logging-to-jul") != null) {
return JulLoggerFactory.wrapJLogger(JulLoggerFactory.jLogger(name))
} else if (System.getProperty("kotlin-logging-to-logback") == "true") {
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package io.github.oshai.kotlinlogging.internal

import com.oracle.svm.core.annotate.Substitute
import com.oracle.svm.core.annotate.TargetClass
import com.oracle.svm.core.annotate.TargetElement
import io.github.oshai.kotlinlogging.KLogger
import io.github.oshai.kotlinlogging.jul.internal.JulLoggerFactory
import io.github.oshai.kotlinlogging.slf4j.internal.Slf4jLoggerFactory
import java.util.function.BooleanSupplier

/**
* This class is a substitution class as described in
* [https://build-native-java-apps.cc/developer-guide/substitution/]. It fixes an issue where the
* native build (GraalVM native-image) fails if Logback is not on the classpath. See
* [https://github.com/oshai/kotlin-logging/issues/465]. The weird-looking class name is according
* to convention.
*/
@Suppress("unused")
internal class Target_io_github_oshai_kotlinlogging_internal_KLoggerFactory {
@TargetClass(
className = "io.github.oshai.kotlinlogging.internal.KLoggerFactory",
onlyWith = [LogbackNotOnClasspath::class],
)
companion object {
@Substitute
@TargetElement(name = "logger\$kotlin_logging")
fun logger(name: String): KLogger {
if (System.getProperty("kotlin-logging-to-jul") != null) {
return JulLoggerFactory.wrapJLogger(JulLoggerFactory.jLogger(name))
}
// Intentionally leave out the logback branch as logback is not on the classpath.
// default to SLF4J
return Slf4jLoggerFactory.wrapJLogger(Slf4jLoggerFactory.jLogger(name))
}
}
}

internal class LogbackNotOnClasspath : BooleanSupplier {
override fun getAsBoolean(): Boolean {
try {
Class.forName("ch.qos.logback.classic.LoggerContext")
return false
} catch (_: ClassNotFoundException) {
return true
}
}
}
1 change: 1 addition & 0 deletions versions.gradle.kts
Original file line number Diff line number Diff line change
@@ -6,3 +6,4 @@ extra["junit_version"] = "5.9.2"
extra["logback_version"] = "1.5.11"
extra["logstash_logback_encoder_version"] = "8.0"
extra["jackson_version"] = "2.18.3"
extra["nativeimage_version"] = "24.2.0"