-
1. Re: Using LogBack but per WAR configuration on WildFly 9
rdul064 May 13, 2016 8:03 AM (in response to rdul064)Got a bit further,
The issue is related with the SLF4JBridgeHandler which is also installed.
Since java.util.logging is unaware of the different applications, only 1 installation of the handler is active and depending on the order of deployment, the jul is routed to a certain SLF4J (depending on which of the WAR files had done the installation of the handler)
So now the issue is that I need a custom BridgeHandler which keeps a record of all the deployed WAR files with their logback configuration. And a way to propagate the 'WAR name' to the custom BridgeHandler (and a ThreadLocal won't work as we might end up in an another classloader )
I'll post a description of the solution when I get there
Rudy
-
2. Re: Using LogBack but per WAR configuration on WildFly 9
jamezp May 16, 2016 6:30 PM (in response to rdul064)Are you including Hibernate in the WAR too or using the containers version? If you're using the containers version it should NOT be logging via logback at all.
--
James R. Perkins
-
3. Re: Using LogBack but per WAR configuration on WildFly 9
jamezp May 16, 2016 6:32 PM (in response to rdul064)Do you include logback and slf4j in each WAR or did you set them up as modules? Including the dependencies in each deployment should work.
--
James R. Perkins
-
4. Re: Using LogBack but per WAR configuration on WildFly 9
simranjeetsingh1786 Aug 26, 2016 9:57 AM (in response to rdul064)I am facing the same issue, I have 7 modules in my ear file, when i deploy the application it writes the logs in the referring to the logback.xml which was picked first.
Can anybody please help ?
-
5. Re: Using LogBack but per WAR configuration on WildFly 9
jamezp Aug 26, 2016 9:51 PM (in response to simranjeetsingh1786)Do you mean that everything is being logged to the first configuration loaded?
--
James R. Perkins
-
6. Re: Using LogBack but per WAR configuration on WildFly 9
simranjeetsingh1786 Aug 26, 2016 10:08 PM (in response to jamezp)@James : Yes.
-
7. Re: Using LogBack but per WAR configuration on WildFly 9
jamezp Aug 29, 2016 12:14 PM (in response to simranjeetsingh1786)If you're using a shared logback module that will likely be an issue. Which ever log configuration is used first will be the one used. You either have to put logback in each deployments WAR module, just deal with a shared configuration or use the logging subsystems logging-profiles to create a new context for each module.
--
James R. Perkins
-
8. Re: Using LogBack but per WAR configuration on WildFly 9
simranjeetsingh1786 Sep 7, 2016 6:06 PM (in response to jamezp)I am using a separate logback xml for each module, but the location of each logback xml was outside the respective wars.
Fixed this issue by placing a logback xml in the web-inf of each war and imported logback xml for each module in the war.
It worked for me. now the logs are getting generated in the respective log files.
I also ignored the default logging provided by wildfly by excluding the logging module in jboss-deployment-structure.xml. Also added log jars (logback, classic,slf4j, commons-logging) in each war file.