I spent last few days for trying to set up logback with my wildfly 10 project.
My goal are:
- Server logs should be created by wildfly logger.
- My EAR logs should be created by logback.
- Logback and wildfly logger logs to console.
My project skeleton is generated by maven and is as follow:
- projectname
- projectname-ear
- projectname-ejb
- projectname-parent
- projectname-web
I try to add logback.xml to resources in web and ejb project - it's not working. I'm new in wildfly and not sure if I am doing it right.
I tried to add following code to jboss-deployment-structure.xml in all projects according to this page:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j" />
<module name="org.jboss.logging" />
<module name="org.jboss.logging.jul-to-slf4j-stub" />
<module name="org.jboss.logmanager" />
<module name="org.jboss.logmanager.log4j" />
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Nothing happen. Then I fond another one:
<jboss-deployment-structure>
<deployment>
<!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->
<!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->
<exclude-subsystems>
<subsystem name="logging" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
Nothing happen at all. Am I doing something wrong in this moment?
Then I found solution with replacing wildfly logger in this tutorial.
It works but there is one huge disadvantage. Logs are doubled - it looks that logback and wildfly logger logging at once to console. Disabling wildfly logger in logger.properties doesn't work.
I had no idea that I spent so much time for implementing logger. Logback + android was a peace of cake. I appreciate all good advices and experience with this problem.