Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message formatted twice. #132

Closed
thorin0 opened this issue Sep 8, 2020 · 3 comments
Closed

Message formatted twice. #132

thorin0 opened this issue Sep 8, 2020 · 3 comments

Comments

@thorin0
Copy link

thorin0 commented Sep 8, 2020

Test code:

import mu.KotlinLogging

private val logger = KotlinLogging.logger {}

fun main() {
    logger.info("Message: {}", "String with {} curly braces")
}

Expected output:

Message: String with {} curly braces

Actual output:

Message: String with String with {} curly braces curly braces
@oshai
Copy link
Owner

oshai commented Sep 8, 2020

Thanks for reporting!
Can you please share more details: the version used, is it JVM/JS and do you use underlying framework for logging?
Ideally, a repo with reproduction will be best.

@thorin0
Copy link
Author

thorin0 commented Sep 9, 2020

It is JVM version with logback backend.

        <dependency>
            <groupId>io.github.microutils</groupId>
            <artifactId>kotlin-logging</artifactId>
            <version>1.8.3</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.1.9</version>
        </dependency>

For the first time, the message format is applied here:
https://github.com/MicroUtils/kotlin-logging/blob/d51e8683840cfc69a18636a9b774c7c88c242b64/src/jvmMain/kotlin/mu/internal/LocationAwareKLogger.kt#L200
For the second time, the message format is applied here:
https://github.com/qos-ch/logback/blob/bbc783e6d68482abe8e7dff0d06708175e971b91/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java#L314

@oshai
Copy link
Owner

oshai commented Sep 9, 2020

Thanks for the details! I managed to reproduce it in a test, and going to create a fix for it soon.

@oshai oshai closed this as completed in d888726 Sep 10, 2020
oshai added a commit that referenced this issue Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants