You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xu...@apache.org on 2009/06/22 11:06:10 UTC

svn commit: r787174 - in /geronimo/server/trunk/plugins/tomcat: geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/ geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/ tomca...

Author: xuhaihong
Date: Mon Jun 22 09:06:09 2009
New Revision: 787174

URL: http://svn.apache.org/viewvc?rev=787174&view=rev
Log:
GERONIMO-4684 Recover the AccessLogValve and LogManager, those two GBeans are needed by console

Modified:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/HostGBean.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/EngineType.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/HostType.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java
    geronimo/server/trunk/plugins/tomcat/tomcat6/pom.xml
    geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/history/dependencies.xml
    geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/resources/tomcat-base/server.xml

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/HostGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/HostGBean.java?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/HostGBean.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/HostGBean.java Mon Jun 22 09:06:09 2009
@@ -26,15 +26,13 @@
 import org.apache.catalina.Manager;
 import org.apache.catalina.Realm;
 import org.apache.catalina.Valve;
-import org.apache.catalina.core.StandardEngine;
 import org.apache.catalina.core.StandardHost;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatLogManagerImpl.java Mon Jun 22 09:06:09 2009
@@ -72,10 +72,10 @@
     private final static int GROUP_RESPONSE_LENGTH = 8;
     private final static String ACCESS_LOG_DATE_FORMAT = "dd/MMM/yyyy:HH:mm:ss ZZZZ";
     private final static String LOG_FILE_NAME_FORMAT = "yyyy-MM-dd";
-    private final Collection logGbeans;
+    private final Collection<ValveGBean> logGbeans;
     private final ServerInfo serverInfo;
 
-    public TomcatLogManagerImpl(ServerInfo serverInfo, Collection logGbeans) {
+    public TomcatLogManagerImpl(ServerInfo serverInfo, Collection<ValveGBean> logGbeans) {
         this.serverInfo = serverInfo;
         this.logGbeans = logGbeans;
     }
@@ -88,8 +88,8 @@
      *
      */
     public String[] getLogNames() {
-        List logNames = new ArrayList();
-        for (Iterator it = logGbeans.iterator(); it.hasNext();) {
+        List<String> logNames = new ArrayList<String>();
+        for (Iterator<ValveGBean> it = logGbeans.iterator(); it.hasNext();) {
             ValveGBean logGBean = (ValveGBean) it.next();
             AccessLogValve logFile = (AccessLogValve) logGBean.getInternalObject();
             if(logFile != null) {
@@ -108,7 +108,7 @@
      *
      */
     public String[] getLogFileNames(String logName) {
-        List names = new ArrayList();
+        List<String> names = new ArrayList<String>();
 
         // Find all the files for this logName
         File[] logFiles = getLogFiles(logName);
@@ -174,7 +174,7 @@
         long start = startDate == null ? 0 : startDate.getTime();
         long end = endDate == null ? 0 : endDate.getTime();
 
-        List list = new LinkedList();
+        List<LogMessage> list = new LinkedList<LogMessage>();
         boolean capped = false;
         int lineCount = 0, fileLineCount = 0;
 

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatServerGBean.java Mon Jun 22 09:06:09 2009
@@ -26,9 +26,6 @@
 import java.io.Reader;
 import java.io.StringReader;
 import java.util.Arrays;
-import java.util.Map;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
@@ -39,7 +36,6 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.catalina.Engine;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.Server;
 import org.apache.catalina.Service;
@@ -49,9 +45,9 @@
 import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.gbean.annotation.ParamSpecial;
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.system.configuration.PluginAttributeStore;
 import org.apache.geronimo.system.jmx.MBeanServerReference;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.geronimo.system.configuration.PluginAttributeStore;
 import org.apache.geronimo.tomcat.model.ServerType;
 import org.apache.tomcat.util.modeler.Registry;
 import org.xml.sax.SAXException;
@@ -64,7 +60,7 @@
 public class TomcatServerGBean implements GBeanLifecycle {
     public static final XMLInputFactory XMLINPUT_FACTORY = XMLInputFactory.newInstance();
     public static final JAXBContext SERVER_CONTEXT;
-
+    private static final String DEFAULT_CATALINA_HOME = "var/catalina";
     static {
         try {
             SERVER_CONTEXT = JAXBContext.newInstance(ServerType.class);
@@ -81,6 +77,7 @@
 
     public TomcatServerGBean(@ParamAttribute(name = "serverConfig")String serverConfig,
                              @ParamAttribute(name = "serverConfigLocation")String serverConfigLocation,
+                             @ParamAttribute(name= "catalinaHome")String catalinaHome,
                              @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
                              @ParamReference(name = "AttributeManager", namingType = "AttributeStore") PluginAttributeStore attributeStore,
                              @ParamReference(name = "MBeanServerReference") MBeanServerReference mbeanServerReference,
@@ -92,6 +89,12 @@
         if(mbeanServerReference != null) {
             Registry.setServer(mbeanServerReference.getMBeanServer());
         }
+        
+        if (catalinaHome == null){
+            catalinaHome = DEFAULT_CATALINA_HOME;
+        }
+        System.setProperty("catalina.home", serverInfo.resolveServerPath(catalinaHome));
+        System.setProperty("catalina.base", serverInfo.resolveServerPath(catalinaHome));
 
         if (serverConfig == null) {
             File loc = serverInfo.resolveServer(serverConfigLocation);

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/ValveGBean.java Mon Jun 22 09:06:09 2009
@@ -16,15 +16,20 @@
  */
 package org.apache.geronimo.tomcat;
 
-import java.lang.ClassLoader;
 import java.util.Map;
 
+import org.apache.catalina.Container;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Pipeline;
+import org.apache.catalina.Service;
 import org.apache.catalina.Valve;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.GBeanLifecycle;
 
 /**
  * @version $Rev$ $Date$
@@ -35,52 +40,102 @@
 
     public static final String J2EE_TYPE = "TomcatValve";
         
-    private final Valve valve;
-    private final ValveGBean nextValve;
-    private final String className;
+    private Valve valve;
+
+    private ValveGBean nextValve;
+
+    private String className;
     
     public ValveGBean(){      
         valve = null;
         nextValve = null;
         className = null;
     }
-    
-    public ValveGBean(String className, Map initParams, ValveGBean nextValve, ClassLoader classLoader) throws Exception{
 
-        //Validate
-        if (className == null){
-            throw new IllegalArgumentException("className cannot be null.");
-        }
+    public ValveGBean(
+            //fish engine out of server configured with server.xml
+            @ParamReference(name="Server")TomcatServerGBean server,
+            @ParamAttribute(name="serviceName")String serviceName,
+            @ParamAttribute(name="containerName") String containerName,
+            @ParamAttribute(name="seq") int seq,
+            
+            //Legacy configuration
+            @ParamAttribute(name="className") String className, 
+            @ParamAttribute(name = "initParams") Map<String,String> initParams, 
+            @ParamReference(name="NextValve") ValveGBean nextValve, 
+            @ParamSpecial(type=SpecialAttributeType.classLoader) ClassLoader classLoader) throws Exception{
         
-        if (nextValve != null){
-            if (!(nextValve.getInternalObject() instanceof Valve)){
-                throw new IllegalArgumentException("The class given as the NextValve attribute does not wrap an object of org.apache.catalina.Valve type.");                
+        if (server != null) {
+            Service service = server.getService(serviceName);
+            Container targetContainer = null;
+            Container engine = service.getContainer();
+            if (engine.getName().equals(containerName)) {
+                targetContainer = engine;
+            } else {
+                targetContainer = engine.findChild(containerName);
+            }
+            if (targetContainer == null) {
+                log.warn("Could not find the container named [" + containerName + "] in the service [" + serviceName + "]");
+                return;
+            }
+            Valve targetValve = findValve(targetContainer, seq);
+            if (targetValve == null) {
+                log.warn("Could not find the container named [" + containerName + "] with sequence [" + seq + "] in the service [" + serviceName + "]");
+                return;
             }
-            this.nextValve = nextValve;
+            valve = targetValve;
         } else {
-            this.nextValve = null;
+            //Validate
+            if (className == null) {
+                throw new IllegalArgumentException("className cannot be null.");
+            }
+            if (nextValve != null) {
+                if (!(nextValve.getInternalObject() instanceof Valve)) {
+                    throw new IllegalArgumentException("The class given as the NextValve attribute does not wrap an object of org.apache.catalina.Valve type.");
+                }
+                this.nextValve = nextValve;
+            } else {
+                this.nextValve = null;
+            }
+            this.className = className;
+            //Create the Valve object
+            valve = (Valve) classLoader.loadClass(className).newInstance();
+            //Set the parameters
+            setParameters(valve, initParams);
         }
         
-        this.className = className;
-
-        //Create the Valve object
-        valve = (Valve)classLoader.loadClass(className).newInstance();
-
-        //Set the parameters
-        setParameters(valve, initParams);
-        
     }
+
     
+    private Valve findValve(Container container, int seq) {        
+        Pipeline pipeline = container.getPipeline();
+        if (pipeline == null) {
+            return null;
+        }
+        Valve[] valves = pipeline.getValves();
+        if (valves == null || seq >= valves.length) {
+            return null;
+        } else {
+            return valves[seq];
+        }
+    }
+
     public void doStart() throws Exception {
-        log.debug(className + " started.");
+        if (className != null) {
+            log.debug(className + " started.");
+        }
     }
 
     public void doStop() throws Exception {
-        log.debug(className + " stopped.");
+        if (className != null) {
+            log.debug(className + " stopped.");
+        }
     }
 
     public void doFail() {
-        log.warn(className + " failed.");
+        if (className != null) {
+            log.debug(className + " failed.");
+        }
     }
 
     public Object getInternalObject() {
@@ -89,24 +144,5 @@
 
     public ValveGBean getNextValve() {
         return nextValve;
-    }
-    
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ValveGBean.class, J2EE_TYPE);
-        infoFactory.addAttribute("className", String.class, true);
-        infoFactory.addAttribute("initParams", Map.class, true);
-        infoFactory.addAttribute("classLoader", ClassLoader.class, false);
-        infoFactory.addReference("NextValve", ValveGBean.class, J2EE_TYPE);
-        infoFactory.addOperation("getInternalObject");
-        infoFactory.addOperation("getNextValve");
-        infoFactory.setConstructor(new String[] { "className", "initParams", "NextValve", "classLoader" });
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
+    }       
 }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/EngineType.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/EngineType.java?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/EngineType.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/EngineType.java Mon Jun 22 09:06:09 2009
@@ -12,6 +12,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAnyAttribute;
@@ -20,13 +21,12 @@
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.namespace.QName;
 
-import org.apache.catalina.core.StandardEngine;
 import org.apache.catalina.Engine;
-import org.apache.catalina.Realm;
 import org.apache.catalina.Host;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.Server;
+import org.apache.catalina.Realm;
+import org.apache.catalina.core.StandardEngine;
 import org.apache.xbean.recipe.ObjectRecipe;
 import org.apache.xbean.recipe.Option;
 

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/HostType.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/HostType.java?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/HostType.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/model/HostType.java Mon Jun 22 09:06:09 2009
@@ -9,27 +9,25 @@
 package org.apache.geronimo.tomcat.model;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlAnyAttribute;
 import javax.xml.namespace.QName;
 
 import org.apache.catalina.Host;
-import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.Lifecycle;
-import org.apache.catalina.Valve;
+import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.Pipeline;
-import org.apache.catalina.Cluster;
 import org.apache.catalina.Realm;
+import org.apache.catalina.Valve;
 import org.apache.catalina.core.StandardHost;
-import org.apache.catalina.core.ContainerBase;
 import org.apache.xbean.recipe.ObjectRecipe;
 import org.apache.xbean.recipe.Option;
 

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/test/java/org/apache/geronimo/tomcat/TomcatServerGBeanTest.java Mon Jun 22 09:06:09 2009
@@ -56,7 +56,7 @@
     }
     public void testGBeanServer1() throws Exception {
         ServerInfo serverInfo = new BasicServerInfo(BASEDIR.getAbsolutePath());
-        TomcatServerGBean tomcatServerGBean = new TomcatServerGBean(null, SERVER_1, serverInfo, null, null, getClass().getClassLoader());
+        TomcatServerGBean tomcatServerGBean = new TomcatServerGBean(null, SERVER_1, null ,serverInfo, null, null, getClass().getClassLoader());
         try {
             tomcatServerGBean.doStart();
         } finally {

Modified: geronimo/server/trunk/plugins/tomcat/tomcat6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/tomcat6/pom.xml?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/tomcat6/pom.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/tomcat6/pom.xml Mon Jun 22 09:06:09 2009
@@ -136,6 +136,9 @@
                         <plugin-artifact>
                             <copy-file relative-to="server" dest-dir="var/catalina">tomcat-base/</copy-file>
                             <config-xml-content>
+                                <gbean name="AccessLogValve">
+                                    <attribute name="containerName">${ServerHostname}</attribute>
+                                </gbean
                                 <!-- To disable accesslogging uncomment the following lines
                                 <gbean name="TomcatEngine">
                                     <reference name="TomcatValveChain" />

Modified: geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/history/dependencies.xml?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/history/dependencies.xml Mon Jun 22 09:06:09 2009
@@ -38,6 +38,16 @@
     </dependency>
     <dependency>
         <groupId>org.apache.geronimo.ext.tomcat</groupId>
+        <artifactId>juli</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.geronimo.ext.tomcat</groupId>
+        <artifactId>shared</artifactId>
+        <type>jar</type>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.geronimo.ext.tomcat</groupId>
         <artifactId>tribes</artifactId>
         <type>jar</type>
     </dependency>

Modified: geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/plan/plan.xml?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/plan/plan.xml Mon Jun 22 09:06:09 2009
@@ -74,6 +74,25 @@
         </reference>
     </gbean>
 
+    <gbean name="TomcatAccessLogManager" class="org.apache.geronimo.tomcat.TomcatLogManagerImpl">
+        <reference name="ServerInfo">
+            <name>ServerInfo</name>
+        </reference>
+        <references name="LogGBeans">
+            <pattern>
+                <name>AccessLogValve</name>
+            </pattern>
+        </references>
+    </gbean>
+
+    <gbean name="AccessLogValve" class="org.apache.geronimo.tomcat.ValveGBean">
+        <reference name="Server">
+            <name>TomcatServer</name>
+        </reference>
+        <attribute name="seq">0</attribute>
+        <attribute name="containerName">${PlanServerHostname}</attribute>
+    </gbean>
+
     <!--
     <gbean name="AprLifecycleListener" class="org.apache.geronimo.tomcat.LifecycleListenerGBean">
         <attribute name="className">org.apache.geronimo.tomcat.listener.GeronimoAprLifecycleListener</attribute>

Modified: geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/resources/tomcat-base/server.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/resources/tomcat-base/server.xml?rev=787174&r1=787173&r2=787174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/resources/tomcat-base/server.xml (original)
+++ geronimo/server/trunk/plugins/tomcat/tomcat6/src/main/resources/tomcat-base/server.xml Mon Jun 22 09:06:09 2009
@@ -109,7 +109,7 @@
     <!-- You should set jvmRoute to support load-balancing via AJP ie :
     <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
     -->
-    <Engine name="Catalina" defaultHost="localhost">
+    <Engine name="Catalina" defaultHost="${ServerHostname}">
 
       <!--For clustering, please take a look at documentation at:
           /docs/cluster-howto.html  (simple how to)
@@ -135,10 +135,12 @@
       <!-- Define the default virtual host
            Note: XML Schema validation will not work with Xerces 2.2.
        -->
-      <Host name="localhost"  appBase="tomcat-base"
+      <Host name="${ServerHostname}"  appBase="tomcat-base"
             unpackWARs="true" autoDeploy="true"
             xmlValidation="false" xmlNamespaceAware="false">
 
+        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+               prefix="${ServerHostname}_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> 
         <!-- SingleSignOn valve, share authentication between web applications
              Documentation at: /docs/config/valve.html -->
         <!--