Setting up a log in Wildfly

I have terrible problems figuring out how to configure logging through logback in my Java EE application on Wildfly 10. I tried putting slf4j-api-1.7.21.jar , logback-classic-1.1.7.jar and logback-core-1.1.7.jar in the ear in /lib/ , add logback.xml to the resources in my ejb module and add jboss-deployment-structure.xml in the ear of META-INF . It almost works ... Logback creates my log files and logs correctly in them. Unfortunately, logging into the console works weirdly. It looks like the default wildfly clutch template with my template from the log configuration.

After that, I tried putting logback as a module in wildfly. I added the modules org.slf4j and ch.qos.logback . I also made the org.jboss.logging module out of it. The configuration file ( logback.xml ) is placed in $JBOSS_HOME/standalone/configuration , and -Dlogback.configurationFile=$JBOSS_HOME/standalone/configuration/logback.xml added to JAVA_OPTS . Unfortunately, this works the exact same way.

I tried to experiment with a lot of combinations of the two above approaches. I tried various exceptions in jboss-deployment-structure.xml and various module configurations, but none of them work. I was pushing my sample project to github at https://github.com/mlewando/jboss-logback . I made two tags: LOGBACK_IN_APP for the first approach and LOGBACK_IN_SERVER for the second.

I would be very happy if someone knew what I was doing wrong. I'm starting to have a little time. I have been searching for and finding bugs for almost 4 days, and it should work before Wednesday. I will really appreciate any help.

Update: Right after the publication of this question, I found another question about the same situation: Logback + Wildfly 8 is the wrong template (as always, I find something right after asking my question ...). This gives some light on my problem, but does not solve it. After I advised the answer, I found that I do not have any logs in the console at all.

+6
source share

All Articles