Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Hi RedEagle see the following configuration which i have tested and its working fine...<br> <strong>Step-1</strong> Create a new module as </p> <p>jboss-as-7.1.1.Final/modules/com/company/mylog/main/</p> <pre><code> -module.xml -log4j-1.2.14.jar Content of module.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;module xmlns="urn:jboss:module:1.0" name="com.company.mylog"&gt; &lt;resources&gt; &lt;resource-root path="log4j-1.2.14.jar"/&gt; &lt;/resources&gt; &lt;dependencies&gt; &lt;module name="javax.api"/&gt; &lt;/dependencies&gt; &lt;/module&gt; </code></pre> <p><strong>Step-2</strong> Now IN my.ear/META-INF/</p> <pre><code> -jboss-deployment-structure.xml -MANIFEST.MF </code></pre> <p>content of jboss-deployment-structure.xml</p> <pre><code> &lt;jboss-deployment-structure&gt; &lt;deployment&gt; &lt;exclusions&gt; &lt;module name="org.apache.log4j" /&gt; &lt;/exclusions&gt; &lt;/deployment&gt; &lt;sub-deployment name="MyWeb.war"&gt; &lt;exclusions&gt; &lt;module name="org.apache.log4j" /&gt; &lt;/exclusions&gt; &lt;/sub-deployment&gt; &lt;sub-deployment name="MyBeans.jar"&gt; &lt;exclusions&gt; &lt;module name="org.apache.log4j" /&gt; &lt;/exclusions&gt; &lt;/sub-deployment&gt; &lt;/jboss-deployment-structure&gt; </code></pre> <p>Content of MANIFEST.MF</p> <pre><code> Manifest-Version: 1.0 Dependencies: com.company.mylog </code></pre> <p><strong>Step-3</strong> Content of MyLogger.java</p> <pre><code>public static Logger getLogger(String name) { Logger logger= LogManager.getLogger(name); PropertyConfigurator.configure("log4j.properties"); //Path to log4j.properties as many option available in my case for testing i used static path /home/gyani/log4j.properties return logger; } </code></pre> <p><strong>Step-4</strong> Here is log4j.properties</p> <pre><code>log4j.rootLogger=info,gyani log4j.appender.gyani=org.apache.log4j.RollingFileAppender log4j.appender.gyani.File=/home/gyani/myserverlog.log log4j.appender.gyani.Append=true log4j.appender.gyani.MaxFileSize=100000KB log4j.appender.gyani.MaxBackupIndex=10 log4j.appender.gyani.layout=org.apache.log4j.PatternLayout log4j.appender.gyani.layout.ConversionPattern=[%d{MMM d HH:mm:ss yyyy}] [%-5p] [%c]: %m%n </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload