Steps to Configure log4j in JBOSS Application Server
Be default jboss provide an support for loggers. so if we want to to apply our own created loggers,then first you have to exclude default JBOSS loggers, then only it will take your own logger configurations.
Following are the steps to configure your own logger in JBOSS.........
Step1: Create jboss-deployment-structure.xml under main project ---> src >---->conf directory with following configurations.
<--jboss-deployment-structure> <--ear-subdeployments-isolated>false<--/ear-subdeployments-isolated> <--deployment> <--exclusions> <--module name="org.apache.log4j" /> // you can configure the things here that you want to exclude from JBOSS <--module name="org.slf4j" /> <--/exclusions> <--/deployment> <--sub-deployment name="YourApplicationName.war">// if you have sub modules <--exclusions> <--module name="org.apache.log4j" /> // you can configure the things here that you want to exclude from JBOSS <--module name="org.dom4j" /> <--/exclusions> <--/sub-deployment> <--sub-deployment name="YourApplicationName .jar"> <--exclusions> <--module name="org.apache.log4j"/> // you can configure the things here that you want to exclude from JBOSS <--module name="org.dom4j" /> <--/exclusions> <--/sub-deployment> <--/jboss-deployment-structure> <--/p>
remove comment '--' from jboss-deployment-structure before using
Note: There is no need of placing jboss-deployment-structure.xml any where else in your application, place it under conf directory only.
Here I had used Net Beans directory structure.