Reputation: 169
I am having an issue with logging information for some of the microservices running on Quarkus. Some of the projects have the below settings in the build.gradle:
implementation 'org.apache.logging.log4j:log4j-core'
runtimeOnly 'org.jboss.logmanager:log4j2-jboss-logmanager'
Our code uses apache log4j LogManager and Logger to log information. When we have the projects with these 2 dependencies in the gradle file, the log settings don't work and as a result, nothing gets written (except for the default setting of error) irrespective of any settings in the application.properties. For the other projects where there is no dependency on log4j-core, the logging works perfectly fine.
What i was told by one of my colleagues is that there is some overriding happens when these 2 libraries are included in a project and he suggested using the org.jboss.logging.Logger in place of the apache log4j LogManager. I haven't tried any other settings but i do see the info logs now in the log file so it is working though i am having to change some code to match the method signatures on the jboss Logger object. While i am happy it's working, i would like to avoid having to code logic in 2 different ways across projects (example - Logger comes from LogManager in apache log4j whereas it just comes from Logger class itself in jboss approach)
I am trying to understand what is causing this conflict and why and also if anyone has any better way than what I did to make it work. Please let me know
Thanks in advance for your help!
Best Regards SG
Upvotes: 0
Views: 1121