Table of Contents
Once JBOSS has been extracted from its archive to the above mentioned folder, the following operations must be performed to prepare for bean installation.
The Log4j package is used to inserting log statements into Java code for debugging purposes. It is designed so that these statements can remain in shipped code without incurring a heavy performance cost. Also, logging behavior can be controlled by editing a configuration file, without touching the application binary.
You need not install Log4j. The EAR (Enterprise Archive) file which will be deployed on the JBoss Application Server already contains the Log4j package and JBoss provides support for Log4J.
As mentioned earlier, logging behavior is controlled by editing a configuration file. This file titled log4j.xml is available in two different locations.
Under the JBoss folder, in the path \server\default\conf\log4j.xml and
The EAR file provided by Starthis
Currently, JBoss Application Server 3.2.7 requires you to modify the log4j.xml file that comes with JBoss. Future versions will allow you to change the log4j.xml packaged with the EAR file provided by Starthis.
Now perform the following steps.
Locate the following file: c:\starthis_demo\jboss-3.2.7\server\default\conf\log4j.xml.
It is assumed that you have installed JBoss in the location c:\starthis_demo\jboss-3.2.7
Open log4j.xml file using an XML editor of your choice. Remember that double clicking on an XML file will open it in Internet Explorer which will not allow editing unless you already have associated XML files with an application of your choice that allows you to perform changes.
You could right-click on the XML file and choose Wordpad as a program to open the file with.
Now locate the following line by searching for it.
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
Immediately after this line, introduce a carriage return by pressing the ENTER key and then copy-paste the following as shown in Figure 4.1, “Editing the log4j.xml file: screenshot I”.
<appender name="SFILE" class="org.apache.log4j.FileAppender">
<param name="threshold" value="info"/>
<param name="Append" value="false"/>
<param name="File" value="c:/log/starthis-ejb.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%r %-5p [%c{1}] {%t} %m%n"/>
</layout>
</appender>
<category name="com.starthis">
<level value="info"/>
<appender-ref ref="SFILE"/>
</category>
Note that in the figure above, text enclosed within <!-- and --> are comments.
Now locate the following line.
<root>
Immediately after this line, press the Enter key to introduce a carriage return and then add the following as shown in Figure 4.2, “Editing the log4j.xml file: screenshot II”.
<appender-ref ref="SFILE"/>
Note that in the figure above, text enclosed within <!-- and --> are comments.
Save the changes that you just made to log4j.xml and close the file.