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

Exception in combination with Log4J #22

Closed
quickstep24 opened this issue Dec 17, 2020 · 3 comments
Closed

Exception in combination with Log4J #22

quickstep24 opened this issue Dec 17, 2020 · 3 comments
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@quickstep24
Copy link

My project uses Log4J in combination with kotlin-logging:

dependencies {
   ...
   implementation("io.github.microutils", "kotlin-logging-jvm", "2.0.3")
   implementation("org.apache.logging.log4j", "log4j-slf4j-impl", "2.13.0")
}

This library is obviously hard-coded to expect logback loggers:

Exception in thread "main" java.lang.ClassCastException: org.apache.logging.slf4j.Log4jLogger cannot be cast to ch.qos.logback.classic.Logger
	at org.jetbrains.kotlinx.dl.api.inference.InferenceModel.setLevel(InferenceModel.kt:64)
	at org.jetbrains.kotlinx.dl.api.core.Sequential.internalFit(Sequential.kt:364)
	at org.jetbrains.kotlinx.dl.api.core.Sequential.fit(Sequential.kt:313)
@quickstep24
Copy link
Author

A workaround is to set verbose to true.
Btw: why is verbose a parameter? Shouldn't this be handled through logger configuration?

@zaleslaw
Copy link
Collaborator

Thanks for feedback, @quickstep24 looks like here are in battle two approaches: Keras API consistency, which uses verbose as a method parameter and log configuration traditions from JVM world. I suppose we should be closer to JVM.

@zaleslaw zaleslaw added bug Something isn't working enhancement New feature or request labels Dec 18, 2020
@zaleslaw zaleslaw added this to the 0.1.1 milestone Jan 12, 2021
@zaleslaw
Copy link
Collaborator

Dear @quickstep24 . I removed all logback usages in the code (all of them related to the logging level set up in code) and make a step to be more JVM library. But logback dependency is in api module. What do you think? Is it enough for your request? If you will have logback dependecy and log4j dependency on classpath, you could use the following solution, isn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants