Add info about new commons-logging-adapters jar
Remove info about non-existent optional jar Update info about commons-logging-api jar git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@371233 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -45,8 +45,8 @@
|
|||||||
<li><a href='#Jars Included in the Standard Distribution'>Jars Included in the Standard Distribution</a>
|
<li><a href='#Jars Included in the Standard Distribution'>Jars Included in the Standard Distribution</a>
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href='#commons-logging.jar'>commons-logging.jar</a></li>
|
<li><a href='#commons-logging.jar'>commons-logging.jar</a></li>
|
||||||
<li><a href='#commons-logging-optional.jar'>commons-logging-optional.jar</a></li>
|
|
||||||
<li><a href='#commons-logging-api.jar'>commons-logging-api.jar</a></li>
|
<li><a href='#commons-logging-api.jar'>commons-logging-api.jar</a></li>
|
||||||
|
<li><a href='#commons-logging-adapters.jar'>commons-logging-adapters.jar</a></li>
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
<li><a href='#JCL Best Practices'>JCL Best Practices</a></li>
|
<li><a href='#JCL Best Practices'>JCL Best Practices</a></li>
|
||||||
@@ -348,42 +348,47 @@ pre-1.4 systems.
|
|||||||
In most cases, including <code>commons-logging.jar</code> and your preferred
|
In most cases, including <code>commons-logging.jar</code> and your preferred
|
||||||
logging implementation in the classpath should be all that is required to
|
logging implementation in the classpath should be all that is required to
|
||||||
use JCL.
|
use JCL.
|
||||||
</p>
|
|
||||||
</subsection>
|
|
||||||
<subsection name="commons-logging-optional.jar">
|
|
||||||
<p>
|
|
||||||
The optional jar includes, oddly enough, optional classes that are useful but
|
|
||||||
not strictly required to make JCL functional. As these classes introduce
|
|
||||||
dependencies on JDK 1.3+ JVMs and a goal of JCL is to be usable on JDK 1.2
|
|
||||||
and earlier JVMs, these optional classes are not included in the main
|
|
||||||
<code>commons-logging.jar</code>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Included in the optional jar are classes which allow JCL to (potentially) improve
|
|
||||||
it's memory utilization (see
|
|
||||||
<a href='#Classloader and Memory Management'>Classloader and Memory Management</a>
|
|
||||||
below). It is therefore recommended that (when running on a 1.3+ JDK) the optional jar
|
|
||||||
be deployed alongside the
|
|
||||||
main <code>commons-logging.jar</code>. It should be deployed such that it will be loaded
|
|
||||||
by the same classloader that loads <code>LogFactory</code>. When so deployed, JCL will
|
|
||||||
discover the appropriate classes and configure itself to use them.
|
|
||||||
</p>
|
</p>
|
||||||
</subsection>
|
</subsection>
|
||||||
<subsection name="commons-logging-api.jar">
|
<subsection name="commons-logging-api.jar">
|
||||||
<p>
|
<p>
|
||||||
The <code>commons-logging-api.jar</code> file includes the JCL API and the
|
The <code>commons-logging-api.jar</code> file includes the JCL API and the
|
||||||
default <code>LogFactory</code> implementation, but does not include the
|
default <code>LogFactory</code> implementation as well as the built-in
|
||||||
wrapper <code>Log</code> implementations for <code>Log4j</code>,
|
<code>Log</code> implementations SimpleLog and NoOpLog. However it does not
|
||||||
<code>Avalon</code> and <code>Lumberjack</code>. This jar is intended for
|
include the wrapper <code>Log</code> implementations that require additional
|
||||||
use in specialized containers such as
|
libraries such as <code>Log4j</code>, <code>Avalon</code> and
|
||||||
<a href='http://tomcat.apache.org/'>Tomcat</a> that wish to use
|
<code>Lumberjack</code>.
|
||||||
JCL internally but also need to make JCL available for use by deployed
|
|
||||||
applications.
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
If this jar is used, in order to benefit from improved memory management in modern JVMs (1.3+),
|
This jar is intended for use by projects that recompile the commons-logging
|
||||||
it is recommended that the <code>commons-logging-optional.jar</code> is deployed in
|
source using alternate java environments, and cannot compile against all of
|
||||||
the same classloader as this jar.
|
the optional libraries that the Apache release of commons-logging supports.
|
||||||
|
Because of the reduced dependencies of this jarfile, such projects should be
|
||||||
|
able to create an equivalent of this library with fewer difficulties.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
This jar is also useful for build environments that automatically track
|
||||||
|
dependencies, and thus have difficulty with the concept that the main
|
||||||
|
commons-logging.jar has "optional" dependencies on various logging
|
||||||
|
implementations that can safely go unsatisfied at runtime.
|
||||||
|
</p>
|
||||||
|
</subsection>
|
||||||
|
<subsection name="commons-logging-adapters.jar">
|
||||||
|
<p>
|
||||||
|
The <code>commons-logging-adapters.jar</code> file includes only adapters
|
||||||
|
to third-party logging implementations, and none of the core commons-logging
|
||||||
|
framework. As such, it cannot be used alone; either commons-logging.jar or
|
||||||
|
commons-logging-api.jar must also be present in the classpath.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
This library will not often be used; it is only intended for situations where
|
||||||
|
a container has deployed commons-logging-api.jar in a shared classpath but a
|
||||||
|
webapp wants to bind logging to one of the external logging implementations
|
||||||
|
that the api jar does not include. In this situation, deploying the
|
||||||
|
commons-logging.jar file within the webapp can cause problems as this leads to
|
||||||
|
duplicates of the core commons-logging classes (Log, LogFactory, etc) in
|
||||||
|
the classpath which in turn can cause unpleasant ClassCastException exceptions
|
||||||
|
to occur. Deploying only the adapters avoids this problem.
|
||||||
</p>
|
</p>
|
||||||
</subsection>
|
</subsection>
|
||||||
</section>
|
</section>
|
||||||
@@ -618,20 +623,15 @@ classloader (and thus to all the classes loaded by it) will be
|
|||||||
held in <code>LogFactory</code>'s static hashtable.
|
held in <code>LogFactory</code>'s static hashtable.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Beginning with JCL 1.0.5, <code>LogFactory</code> will attempt to cache factory
|
Beginning with JCL 1.1, <code>LogFactory</code> caches factory implementations in a
|
||||||
implementations in a
|
"WeakHashtable". This class is similar to <code>java.util.WeakHashMap</code> in that it holds a
|
||||||
<a href='http://jakarta.apache.org/commons/logging/optional/apidocs/org/apache/commons/logging/impl/WeakHashtable.html'>WeakHashtable</a>.
|
<code>WeakReference</code> to each key's value, thus allowing classloaders to be GC'd
|
||||||
This class is analogous to <code>java.util.WeakHashMap</code> in that it holds
|
|
||||||
<code>WeakReference</code>s to its keys, thus allowing classloaders to be GC'd
|
|
||||||
even if <code>LogFactory.release()</code> is never invoked.
|
even if <code>LogFactory.release()</code> is never invoked.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Because <code>WeakHashtable</code> depends on JDK 1.3+ features, it cannot
|
Because <code>WeakHashtable</code> depends on JDK 1.3+ features, it is dynamically
|
||||||
be included in the main <code>commons-logging.jar</code> file. It is found
|
loaded depending on the JVM version; when commons-logging is run on java versions
|
||||||
in <code>commons-logging-optional.jar</code>. <strong>J2EE container
|
prior to 1.3 the code defaults to a standard Hashtable instead.
|
||||||
implementors who distribute JCL with their application are strongly
|
|
||||||
encouraged to place <code>commons-logging-optional.jar</code> on the classpath
|
|
||||||
in the same location where <code>LogFactory</code> is loaded.</strong>
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
In a particular usage scenario, <code>WeakHashtable</code> alone will
|
In a particular usage scenario, <code>WeakHashtable</code> alone will
|
||||||
@@ -642,8 +642,8 @@ loaded by a parent classloader and a concrete subclass implementation of
|
|||||||
implementation will have a strong reference to the child classloader via the
|
implementation will have a strong reference to the child classloader via the
|
||||||
chain <code>getClass().getClassLoader()</code>. The <code>WeakHashtable</code>
|
chain <code>getClass().getClassLoader()</code>. The <code>WeakHashtable</code>
|
||||||
will have a strong reference to the <code>LogFactory</code> implementation as
|
will have a strong reference to the <code>LogFactory</code> implementation as
|
||||||
one of the values in its map. This chain of references will prevent
|
one of the keys in its map (only values can use weak references). This chain
|
||||||
collection of the child classloader.
|
of references will prevent collection of the child classloader.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Such a situation would typically only occur if commons-logging.jar were
|
Such a situation would typically only occur if commons-logging.jar were
|
||||||
|
|||||||
Reference in New Issue
Block a user