I've updated the Log4JCategoryLog.java to use the Log4J method Category.log
() which allows the fully qualified class name (FQCN) of  the user's logger
class to be passed through into Log4J.  In this case the logger class FQCN
will be "org.apache.commons.logging.impl.Log4JCategoryLog".  This allows
Log4J to correctly identify the location in the code from which the logger
is being called, if required.  Without this Log4J reports that the calling
location is ALWAYS Log4JCategoryLog.java:132.


   Index: org/apache/commons/logging/impl/Log4JCategoryLog.java
   ===================================================================
   RCS file:
   
/home/cvspublic/jakarta-commons/logging/src/java/org/apache/commons/logging/impl/Log4JCategoryLog.java,v
   retrieving revision 1.2
   diff -u -r1.2 Log4JCategoryLog.java
   --- org/apache/commons/logging/impl/Log4JCategoryLog.java       15 Feb
   2002 03:54:19 -0000       1.2
   +++ org/apache/commons/logging/impl/Log4JCategoryLog.java       4 Mar
   2002 22:14:20 -0000
   @@ -83,6 +83,9 @@
        // -------------------------------------------------------------
   Attributes


   +    /** The fully qualified name of the Log4JCategoryLog class. */
   +    private static final String FQCN = Log4JCategoryLog.class.getName
   ();
   +
        /** Log to this category */
        private Category category = null;

   @@ -112,7 +115,7 @@
         * Currently logs to <code>DEBUG</code> level in Log4J.
         */
        public void trace(Object message) {
   -        category.debug(message);
   +        category.log(FQCN, Priority.DEBUG, message, null);
        }


   @@ -121,7 +124,7 @@
         * Currently logs to <code>DEBUG</code> level in Log4J.
         */
        public void trace(Object message, Throwable t) {
   -        category.debug(message,t);
   +        category.log(FQCN, Priority.DEBUG, message, t);
        }


   @@ -129,7 +132,7 @@
         * Log a message to the Log4j Category with <code>DEBUG</code>
   priority.
         */
        public void debug(Object message) {
   -        category.debug(message);
   +        category.log(FQCN, Priority.DEBUG, message, null);
        }


   @@ -137,7 +140,7 @@
         * Log an error to the Log4j Category with <code>DEBUG</code>
   priority.
         */
        public void debug(Object message, Throwable t) {
   -        category.debug(message,t);
   +        category.log(FQCN, Priority.DEBUG, message, t);
        }


   @@ -145,7 +148,7 @@
         * Log a message to the Log4j Category with <code>INFO</code>
   priority.
         */
        public void info(Object message) {
   -        category.info(message);
   +        category.log(FQCN, Priority.INFO, message, null);
        }


   @@ -153,7 +156,7 @@
         * Log an error to the Log4j Category with <code>INFO</code>
   priority.
         */
        public void info(Object message, Throwable t) {
   -        category.info(message,t);
   +        category.log(FQCN, Priority.INFO, message, t);
        }


   @@ -161,7 +164,7 @@
         * Log a message to the Log4j Category with <code>WARN</code>
   priority.
         */
        public void warn(Object message) {
   -        category.warn(message);
   +        category.log(FQCN, Priority.WARN, message, null);
        }


   @@ -169,7 +172,7 @@
         * Log an error to the Log4j Category with <code>WARN</code>
   priority.
         */
        public void warn(Object message, Throwable t) {
   -        category.warn(message,t);
   +        category.log(FQCN, Priority.WARN, message, t);
        }


   @@ -177,7 +180,7 @@
         * Log a message to the Log4j Category with <code>ERROR</code>
   priority.
         */
        public void error(Object message) {
   -        category.error(message);
   +        category.log(FQCN, Priority.ERROR, message, null);
        }


   @@ -185,7 +188,7 @@
         * Log an error to the Log4j Category with <code>ERROR</code>
   priority.
         */
        public void error(Object message, Throwable t) {
   -        category.error(message,t);
   +        category.log(FQCN, Priority.ERROR, message, t);
        }


   @@ -193,7 +196,7 @@
         * Log a message to the Log4j Category with <code>FATAL</code>
   priority.
         */
        public void fatal(Object message) {
   -        category.fatal(message);
   +        category.log(FQCN, Priority.FATAL, message, null);
        }


   @@ -201,7 +204,7 @@
         * Log an error to the Log4j Category with <code>FATAL</code>
   priority.
         */
        public void fatal(Object message, Throwable t) {
   -        category.fatal(message,t);
   +        category.log(FQCN, Priority.FATAL, message, t);
        }




(See attached file: Log4JCategoryLog.java)

*******************************************
Richard A. Sitze            [EMAIL PROTECTED]
CORBA Interoperability & WebServices
IBM WebSphere Development

Attachment: Log4JCategoryLog.java
Description: Binary data

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to