|
⇤ ← Revision 1 as of 2005-01-12 03:04:18
Size: 2407
Comment: Importing old wiki ...
|
← Revision 2 as of 2009-09-20 22:47:49 ⇥
Size: 2407
Comment: converted to 1.6 markup
|
| No differences found! | |
Q: How do I make Axis and my applications to use the same log-system as my servlet engine?
A: What you need to do is:
-define the used logger and it's properties in the servlet-engine level -remove contradicting logger definitions and properties files from axis level and application level -program log-functionality with jakarta-commons-logging (that's what Axis and Jetty use)
Example with Axis 1.1, Log4j 1.2.8 and Jetty 4.2-14rc1:
1) Use Jetty that has log4j included. (for example Jetty-4.2.14rc1-all.zip)
2) Configure the jetty-plus functionality into use (documented in http://jetty.mortbay.org/jetty/plus/)
2a) Edit jetty.xml
-Replace <Configure class="org.mortbay.jetty.Server"> with <Configure class="org.mortbay.jetty.plus.Server">
-Add the following lines
<Call name="instance" class="org.mortbay.util.Log">
<Call name="disableLog"/>
<Call name="add">
<Arg>
<New class="org.mortbay.util.log4j.Log4jSink">
<Call name="start"/>
</New>
</Arg>
</Call>
</Call>
3) Copy log4j.properties to ${jetty.home}/etc
4) remove log4j.properties and simplelog.properties from axis.jar
5) startup Jetty as Jettyplus
6) define log4j.configuration -5 and 6 can be done by starting Jetty with command:
java -Djetty.server=org.mortbay.jetty.plus.Server -Dlog4j.configuration=log4j.properties -jar start.jar
7) You can also delete log4j and commons-logging jars from the WEB-INF/lib direcory. You don't have to,
but applying KISS on jars can make life a little easier. Having more than one log4j running is not
a good thing.
The log4j.properties categories can look something like this:
log4j.rootCategory=WARN, CONSOLE log4j.logger.org.mortbay=WARN, JETTY log4j.logger.org.apache.axis=WARN, AXIS log4j.logger.com.mycompany=WARN, MYCOMPANY
Q: Why?
A: Logging is good. Badly configured logging is a security risk. Configuring all the logging in one place makes bad configurations a bit harder to make. Using rollover file loggers with max filesize and index you can have an exact space-limit for the logfiles created by one servlet-engine installation. You don't want to fill your disk with logs, now do you?