Index: src/java/org/apache/log/LogEvent.java
===================================================================
RCS file: /home/cvspublic/jakarta-avalon-logkit/src/java/org/apache/log/LogEvent.java,v
retrieving revision 1.2
diff -u -r1.2 LogEvent.java
--- src/java/org/apache/log/LogEvent.java	2001/05/12 05:38:56	1.2
+++ src/java/org/apache/log/LogEvent.java	2001/07/24 12:54:41
@@ -37,6 +37,14 @@
     ///The context stack associated with LogEvent.
     private ContextStack             m_contextStack;
 
+    ///The CallStack leading to the call to methods of this Class
+    ///The value is assigned when requested to avoid unnecessary
+    ///performance penalties when not in use!
+    private CallStack callStack = null;
+
+    /** The class that we will search for in the call stack */
+    private Class loggerClass = org.apache.log.Logger.class;
+
     /**
      * Get Priority for LogEvent.
      *
@@ -168,4 +176,63 @@
     {
         m_time = time;
     }
+    
+    /**
+     * Get the method path name for the method from which the LogEvent was
+     * created.
+     *
+     * @returns The method path name in the form "the.package.path.Method"
+     * @author Stuart Roebuck <a href="mailto:stuart.roebuck@adolos.com">&lt;stuart.roebuck@adolos.com&gt;</a>
+     */
+    public final String getMethod() {
+        if (callStack == null) callStack = new CallStack();
+        return getClass(callStack);
+    }
+
+    /** 
+     * Hack to get the call stack as an array of classes. The
+     * SecurityManager class provides it as a protected method, so
+     * change it to public through a new method !
+     *
+     * @author Sylvain Wallez <a href="mailto:sylvain.wallez@anyware-tech.com">&lt;sylvain.wallez@anyware-tech.com&gt;</a>
+     */
+    static public class CallStack extends SecurityManager
+    {
+        /**
+         * Returns the current execution stack as an array of classes.
+         * The length of the array is the number of methods on the execution
+         * stack. The element at index 0 is the class of the currently executing
+         * method, the element at index 1 is the class of that method's caller,
+         * and so on.
+         */
+
+        public Class[] get()
+        {
+            return getClassContext();
+        }
+    }
+
+    /**
+     * Finds the class that has called Logger.
+     */
+    private String getClass(CallStack callStack) {
+        
+        Class[] stack = callStack.get();
+        
+        // Traverse the call stack in reverse order until we find a Logger
+        for (int i = stack.length-1; i >= 0; i--) {
+            if (this.loggerClass.isAssignableFrom(stack[i])) {
+                
+                // Found : the caller is the previous stack element
+                String className = stack[i+1].getName();
+                
+                return className;
+            }
+        }
+        
+        // No Logger found in call stack : can occur with AsyncLogTarget
+        // where formatting takes place in a different thread.
+        return "Unknown-class";
+    }
+    
 }
Index: src/java/org/apache/log/format/PatternFormatter.java
===================================================================
RCS file: /home/cvspublic/jakarta-avalon-logkit/src/java/org/apache/log/format/PatternFormatter.java,v
retrieving revision 1.8
diff -u -r1.8 PatternFormatter.java
--- src/java/org/apache/log/format/PatternFormatter.java	2001/07/24 11:35:30	1.8
+++ src/java/org/apache/log/format/PatternFormatter.java	2001/07/24 12:54:48
@@ -36,6 +36,7 @@
     protected final static int         TYPE_RELATIVE_TIME   = 6;
     protected final static int         TYPE_THROWABLE       = 7;
     protected final static int         TYPE_PRIORITY        = 8;
+    protected final static int	       TYPE_METHOD	    = 9;
 
     protected final static String      TYPE_CATEGORY_STR      = "category";
     protected final static String      TYPE_CONTEXT_STR       = "context";
@@ -44,6 +45,7 @@
     protected final static String      TYPE_RELATIVE_TIME_STR = "rtime";
     protected final static String      TYPE_THROWABLE_STR     = "throwable";
     protected final static String      TYPE_PRIORITY_STR      = "priority";
+    protected final static String      TYPE_METHOD_STR	      = "method";
 
     protected final static String      SPACE_16               = "                ";
     protected final static String      SPACE_8                = "        ";
@@ -346,6 +348,10 @@
                 str = getPriority( event.getPriority(), run.m_format );
                 break;
 
+            case TYPE_METHOD:
+                str = getMethod( event.getMethod(), run.m_format );
+                break;
+
             default:
                 //TODO: Convert next line to use error handler
                 Hierarchy.getDefaultHierarchy().log( "Unknown Pattern specification." + run.m_type );
@@ -480,15 +486,25 @@
         else if( type.equalsIgnoreCase( TYPE_PRIORITY_STR ) ) return TYPE_PRIORITY;
         else if( type.equalsIgnoreCase( TYPE_TIME_STR ) ) return TYPE_TIME;
         else if( type.equalsIgnoreCase( TYPE_RELATIVE_TIME_STR ) ) return TYPE_RELATIVE_TIME;
-        else if( type.equalsIgnoreCase( TYPE_THROWABLE_STR ) )
-        {
-            return TYPE_THROWABLE;
-        }
+        else if( type.equalsIgnoreCase( TYPE_THROWABLE_STR ) ) return TYPE_THROWABLE;
+        else if( type.equalsIgnoreCase( TYPE_METHOD_STR ) ) return TYPE_METHOD;
         else
         {
             throw new IllegalArgumentException( "Unknown Type in pattern - " +
                                                 type );
         }
+    }
+    
+    /**
+     * Utility method to format method.
+     *
+     * @param method the method path name of the logging method.
+     * @param format ancilliary format parameter - allowed to be null
+     * @return the formatted string
+     */
+    protected String getMethod( final String method, final String format )
+    {
+        return method;
     }
 
     /**
Index: src/xdocs/whitepaper.xml
===================================================================
RCS file: /home/cvspublic/jakarta-avalon-logkit/src/xdocs/whitepaper.xml,v
retrieving revision 1.2
diff -u -r1.2 whitepaper.xml
--- src/xdocs/whitepaper.xml	2001/06/21 14:16:57	1.2
+++ src/xdocs/whitepaper.xml	2001/07/24 12:54:52
@@ -264,7 +264,7 @@
         should be left or right justified (defaults to left justified if unspecified).
         The #.# indicates the minimum and maximum size of output, if unspecified the
         output is neither padded nor truncated. 'field' indicates the field to be 
-        written and must be one of "category", "context", "message", "time", 
+        written and must be one of "category", "context", "method", "message", "time", 
         "throwable" or "priority". This parameter must be supplied and correlates to
         fields of LogEvent. 'subformat' is currently unused. 
       </p>
