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
log4j and logback conflict when running as packaged application #4341
Comments
The classpath ordering is a separate issue but ideally you shouldn't rely on that. As for the SLF4J error message, please check the documentation that explains you how to configure log4j2 with Spring Boot. |
Thanks. Turned out I had another (non-springboot) dependency using the logback implementation. |
I encountered the same problem, but I prefer to use log4j, how could i do ?thanks. |
@binnchx This issue has been closed for a while now. Please ask on stackoverflow.com instead. |
I am mixing now few starters (springboot web, data, jpa, etc.) in multimodule project with Vaadin and custom libraries and get away from logback can become really nasty... I don't ask here a question, but instead of this mess, something like switch in application.properties defining the provider to pull automatically the right dependencies might, or anything else more easy ... this is simply mess for new users. But spring is not for new users 💃 --- I fixed my case myself, but the errors are not always straightforwardly leading to resolution.... As for reference from my point of view:
Surprisingly the starter-parent doesn't pull in the logback either defined as type pom, but I put it as standard dependency -> no logback pulled in:
The problem in my case before fixed was also followed by logging failing completely as bellow (plus warding about multiple slf4j providers of course):
By completely get rid of lopback and enforce instead springboot starter for log4j2, both the warning and the error disapeared. I also note, that I don't use (in the moment) log4j2-spring.xml, but standard log4j2.xml file which could possibly cause some unexpected behaviour, but probably other, not with classpath |
hii Can you please help me i am getting error logback core and logback classic status as forbidden in my spring boot project |
my mail id pramanikatim3@gmail.com |
When using spring-boot-starter-log4j2, the following exception is thrown while starting the application as a packaged application (
java -jar target/myproject-0.0.1-SNAPSHOT.jar
):When running the application with Maven plugin (
mvn spring-boot:run
), it starts successfully, and I've noticed that the ordering of the classpath is different betweenmvn spring-boot:run
andjava -jar
and a different binding is being picked up:The exception is identical to #541, although I'm using Maven 3.2.1 to package the jar, and there's no issue with running the application with Maven directly as mentioned previously.
Relevant dependencies:
We are using Java 1.8.0_66.
The text was updated successfully, but these errors were encountered: