How to create separate log files for every jar that present in war file in JBOSS EAP/Wildfly

921 Views Asked by At

I have deployed one war file in JBOSS eap7.4, but all my logs are going to server.log file by default. I have 2 jars in my war file for which I need to log messages in separate files. Please help me.

This is the custom handler I have created in standalone.xml

And this is the module.xml

This is my log4j.xml file to implement logs for 2 jars with their package names

2

There are 2 best solutions below

1
James R. Perkins On

You need to exclude the org.apache.logging.api from your deployment in a jboss-deployment-structure.xml file. Then include both the log4j-api and log4j-core libraries in your deployment if you want to use a log4j2 configuration file. See the JBoss EAP 7.4 documentation for more details.

1
Arjun Ganta On