-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Slf4j + logback #15884
Comments
As much as I myself would also love to use logback, as you said yourself:
I'm therefore going to convert this to an enhancement. /cc @dmlloyd for general logging context and @stuartwdouglas for the classloading part |
A logging framework has four parts which are relevant to this discussion:
So while on the one hand I can accurately state that "Quarkus does not, nor will it ever, support LogBack/log4j/etc. in place of its internal logging system", on the other hand doing so would completely miss the point that whatever you are trying to use LogBack for (and it's typically going to be for a particular appender or formatter), we either already support directly, could support directly, or could support via interfacing with LogBack at an SPI level like we do with So, what is your particular use case for which you are trying to consume LogBack? |
As an aside: part of this is that we do need a good mechanism for detecting class path conflicts. This would be necessary before we can solve the "same error in both situations" part of the problem. |
The only reason I use logback is to have access to the SiftingAppender, which I use to create logfiles "on demand", based on MDC properties. I need this to create separate log files per processing threads in a ETL pipeline. Other then that, I'll live happily without it! |
same here, I can see in quarkus logging docs, that it supports Sfj4j and exists and adapter for it, documented in the following url https://quarkus.io/guides/logging#logging-adapters However there is not any documentation to get Quarkus + Sfj4j + Logback + external appenders working. Any help will be appreciated. |
@eriknyk Loggly can be used via rsyslog, and Quarkus has a syslog happen, see https://quarkus.io/guides/logging#syslog-log-handler @seseso the issue with dev mode may be due to its classloader, can you try to register logback as a parent first dependency to see if it solves the issu? See https://quarkus.io/guides/class-loading-reference#parent-first-dependencies |
Thanks @loicmathieu, |
So I guess the question comes down to:
/cc @jamezp for additional perspective. |
For me, something like E.g. to suppress specific WARN and ERROR messages while doing negative tests. |
I can't find where this |
This sounds like a filter assigned to a logger instead of a handler. |
Any Update about this? Best Regards. |
maybe you can check this extension |
Describe the bug
First of all, I know that logback is not supported and JBoss Logging is the official logging framework. That being said, I manage to work with logback but found out that it only works in Profile prod and not in dev. I see a different behavior and that's why I open this issue.
The problem arise at:
ch.qos.logback.classic.LoggerContext lc = (ch.qos.logback.classic.LoggerContext) org.slf4j.LoggerFactory.getILoggerFactory();
which works in profile prod but throws a ClassCastException in profile dev:
ERROR: class org.slf4j.impl.Slf4jLoggerFactory cannot be cast to class ch.qos.logback.classic.LoggerContext (org.slf4j.impl.Slf4jLoggerFactory is in unnamed module of loader 'app'; ch.qos.logback.classic.LoggerContext is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @73c9e8e8)
Expected behavior
I would expect the same behavior in both profiles (even if that would mean a failure on both)
To Reproduce
https://github.com/seseso/quarkus-logback
Works as excpeted
mvn quarkus:dev
ERROR: class org.slf4j.impl.Slf4jLoggerFactory cannot be cast to class ch.qos.logback.classic.LoggerContext (org.slf4j.impl.Slf4jLoggerFactory is in unnamed module of loader 'app'; ch.qos.logback.classic.LoggerContext is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @1a2b65ad)
Environment (please complete the following information):
Output of
uname -a
orver
Linux hp-spectre-x360 5.8.0-44-generic #50-Ubuntu SMP Tue Feb 9 06:29:41 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
GraalVM version (if different from Java)
N/A - Don't need to run in native mode
Quarkus version or git rev
1.12.2-Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.6.3
The text was updated successfully, but these errors were encountered: