log4j errors when porting a 5.5 webapp to 6.x: 
output/build/webapp/docs/logging.html

   1.  Create a file called log4j.properties with the following content and 
save it into $CATALINA_HOME/lib.
                  log4j.rootLogger=debug, R 
                  log4j.appender.R=org.apache.log4j.RollingFileAppender 
                  log4j.appender.R.File=${catalina.home}/logs/tomcat.log 
                  log4j.appender.R.MaxFileSize=10MB 
                  log4j.appender.R.MaxBackupIndex=10 
                  log4j.appender.R.layout=org.apache.log4j.PatternLayout 
                  log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n 
                  log4j.logger.org.apache.catalina=DEBUG, R
--done no problems--
                                        
   2. Download Log4J (v1.2 or later) and place the log4j jar in 
$CATALINA_HOME/lib.
--done no problems--   

   3. Build the commons-logging additional component using the extras.xml Ant 
build script which is part of the Tomcat source bundle.

--start extras.xml from Tomcat source bundle (which BTW has no references to 
log4j) --
<?xml version="1.0"?>
<project name="Tomcat 6.0" default="extras" basedir=".">


  <!-- ===================== Initialize Property Values =================== -->

  <!-- See "build.properties.sample" in the top level directory for all     -->
  <!-- property values you must customize for successful building!!!        -->
  <property file="${user.home}/build.properties"/>
  <property file="build.properties"/>

  <property file="build.properties.default"/>

  <!-- Project Properties -->
  <property name="name"                  value="Apache Tomcat" />
  <property name="year"                  value="2007" />
  <property name="version.major"         value="6" />
  <property name="version.minor"         value="0" />
  <property name="version.build"         value="0" />
  <property name="version.patch"         value="0" />
  <property name="version"               value="6.0.0-dev" />
  <property name="version.number"        
value="${version.major}.${version.minor}.${version.build}.${version.patch}" />

  <property name="project"               value="apache-tomcat" />
  <property name="final.name"            value="${project}-${version}" />
  <property name="final-src.name"        value="${project}-${version}-src" />

  <!-- Build Defaults -->
  <property name="tomcat.build"      value="${basedir}/output/build"/>
  <property name="tomcat.classes"    value="${basedir}/output/classes"/>
  <property name="tomcat.dist"       value="${basedir}/output/dist"/>
  <property name="tomcat.extras"     value="${basedir}/output/extras"/>
  <property name="tomcat.deployer"   value="${basedir}/output/deployer"/>
  <property name="tomcat.release"    value="${basedir}/output/release"/>
  <property name="test.failonerror"  value="true"/>
  <property name="test.runner"       value="junit.textui.TestRunner"/>

  <!-- Can't be lower - jsp uses templates -->
  <property name="compile.source" value="1.5"/>

  <!-- JAR artifacts -->
  <property name="bootstrap.jar" value="${tomcat.build}/bin/bootstrap.jar"/>

  <property name="annotations-api.jar" 
value="${tomcat.build}/lib/annotations-api.jar"/>
  <property name="servlet-api.jar" value="${tomcat.build}/lib/servlet-api.jar"/>
  <property name="jsp-api.jar" value="${tomcat.build}/lib/jsp-api.jar"/>
  <property name="el-api.jar" value="${tomcat.build}/lib/el-api.jar"/>
  <property name="catalina.jar" value="${tomcat.build}/lib/catalina.jar"/>
  <property name="catalina-ant.jar" 
value="${tomcat.build}/lib/catalina-ant.jar"/>
  <property name="catalina-ant-jmx.jar" 
value="${tomcat.build}/lib/catalina-ant-jmx.jar"/>
  <property name="tomcat-coyote.jar" 
value="${tomcat.build}/lib/tomcat-coyote.jar"/>

  <property name="jasper.jar" value="${tomcat.build}/lib/jasper.jar"/>
  <property name="jasper-el.jar" value="${tomcat.build}/lib/jasper-el.jar"/>

  <property name="tomcat-dbcp.home" value="${base.path}/tomcat6-deps/dbcp" />
  <property name="jasper-jdt.home" value="${base.path}/tomcat6-deps/jdt" />
  <property name="tomcat-dbcp.jar" value="${tomcat-dbcp.home}/tomcat-dbcp.jar"/>
  <property name="jasper-jdt.jar" value="${jasper-jdt.home}/jasper-jdt.jar"/>

  <property name="tomcat-juli.jar" value="${tomcat.extras}/tomcat-juli.jar"/>
  <property name="tomcat-juli-adapters.jar" 
value="${tomcat.extras}/tomcat-juli-adapters.jar"/>
  <property name="catalina-ws.jar" value="${tomcat.extras}/catalina-ws.jar"/>
    
  <!-- Classpath -->
  <path id="tomcat.classpath">
    <pathelement location="${tomcat.classes}"/>
  </path>

  <target name="prepare">
    <mkdir dir="${tomcat.extras}"/>
  </target>

  <target name="clean">
      <delete dir="${tomcat.extras}"/>
  </target>

  <target name="commons-logging">
    
    <antcall target="downloadfile">
      <param name="sourcefile" value="${commons-logging-src.loc}"/>
      <param name="destfile" 
value="${tomcat.extras}/logging/commons-logging-src.tar.gz"/>
      <param name="destdir" value="${tomcat.extras}/logging/"/>
    </antcall>
    <gunzip src="${tomcat.extras}/logging/commons-logging-src.tar.gz" 
        dest="${tomcat.extras}/logging/commons-logging-src.tar"/>
    <untar src="${tomcat.extras}/logging/commons-logging-src.tar" 
        dest="${tomcat.extras}/logging/"/>
      
    <replace 
dir="${tomcat.extras}/logging/commons-logging-1.1-src/src/java/org/apache/commons"
 >
      <replacefilter token="org.apache.commons"
            value="org.apache.juli" />
    </replace>
    <mkdir 
dir="${tomcat.extras}/logging/commons-logging-1.1-src/src/java/org/apache/juli" 
/>
    <move 
todir="${tomcat.extras}/logging/commons-logging-1.1-src/src/java/org/apache/juli">
      <fileset 
dir="${tomcat.extras}/logging/commons-logging-1.1-src/src/java/org/apache/commons"
 />
    </move>

    <replace dir="${tomcat.extras}/logging/commons-logging-1.1-src" >
      <replacefilter token="org.apache.commons"
            value="org.apache.juli" />
        <replacefilter token="org/apache/commons/"
              value="org/apache/juli/" />
    </replace>
    <copy tofile="${tomcat.extras}/logging/commons-logging-1.1-src/build2.xml" 
        file="${tomcat.extras}/logging/commons-logging-1.1-src/build.xml" />

      <ant antfile="${tomcat.extras}/logging/commons-logging-1.1-src/build2.xml"
           dir="${tomcat.extras}/logging/commons-logging-1.1-src" 
           target="getlibs" />
    <copy todir="${tomcat.extras}/logging/commons-logging-1.1-src">
      <fileset dir="${tomcat.extras}/logging/commons-logging-1.1-src/lib" />
    </copy>
      <ant antfile="${tomcat.extras}/logging/commons-logging-1.1-src/build2.xml"
           dir="${tomcat.extras}/logging/commons-logging-1.1-src"
           target="compile" />
  
    <jar jarfile="${tomcat-juli.jar}">
      <fileset 
dir="${tomcat.extras}/logging/commons-logging-1.1-src/target/classes">
        <include name="org/apache/juli/logging/*.class" /> 
        <include name="org/apache/juli/logging/impl/LogFactoryImpl*.class" /> 
        <include name="org/apache/juli/logging/impl/WeakHashtable*.class" /> 
        <include name="org/apache/juli/logging/impl/SimpleLog*.class" /> 
        <include name="org/apache/juli/logging/impl/NoOpLog*.class" /> 
        <include name="org/apache/juli/logging/impl/Jdk14Logger.class" /> 
        <include name="META-INF/LICENSE.txt" /> 
        <include name="META-INF/NOTICE.txt" /> 
        <!-- Javadoc and i18n exclusions -->
        <exclude name="**/package.html" />
        <exclude name="**/LocalStrings_*" />
      </fileset>
      <fileset dir="${tomcat.classes}">
        <include name="org/apache/juli/*" />
        <!-- Javadoc and i18n exclusions -->
        <exclude name="**/package.html" />
        <exclude name="**/LocalStrings_*" />
      </fileset>
    </jar>
    <checksum file="${tomcat-juli.jar}"
              forceOverwrite="yes" fileext=".md5" />

    <jar jarfile="${tomcat-juli-adapters.jar}">
      <fileset 
dir="${tomcat.extras}/logging/commons-logging-1.1-src/target/classes">
        <include name="org/apache/juli/logging/impl/**.class" /> 
        <exclude name="org/apache/juli/logging/impl/WeakHashtable*.class" /> 
        <exclude name="org/apache/juli/logging/impl/LogFactoryImpl.class" /> 
        <include name="META-INF/LICENSE.txt" /> 
        <include name="META-INF/NOTICE.txt" /> 
        <!-- Javadoc and i18n exclusions -->
        <exclude name="**/package.html" />
        <exclude name="**/LocalStrings_*" />
      </fileset>
    </jar>
    <checksum file="${tomcat-juli-adapters.jar}"
              forceOverwrite="yes" fileext=".md5" />

  </target>

  <target name="webservices">
    
        <mkdir dir="${tomcat.extras}/webservices"/>
    
        <antcall target="downloadfile">
          <param name="sourcefile" value="${jaxrpc-src.loc}"/>
          <param name="destfile" 
value="${tomcat.extras}/webservices/jaxrpc.jar"/>
          <param name="destdir" value="${tomcat.extras}/webservices/"/>
        </antcall>
    
        <antcall target="downloadfile">
          <param name="sourcefile" value="${wsdl4j-src.loc}"/>
          <param name="destfile" 
value="${tomcat.extras}/webservices/wsdl4j.jar"/>
          <param name="destdir" value="${tomcat.extras}/webservices/"/>
        </antcall>
    
        <!-- Classpath -->
        <path id="tomcat.webservices.classpath">
          <pathelement path="${tomcat.classpath}"/>
          <fileset dir="${tomcat.extras}/webservices">
            <include name="jaxrpc.jar"/>
            <include name="wsdl4j.jar"/>
          </fileset>
        </path>
    
        <!-- Compile internal server components -->
        <javac srcdir="java" destdir="${tomcat.classes}"
               debug="${compile.debug}"
               deprecation="${compile.deprecation}"
               source="${compile.source}"
               optimize="${compile.optimize}">
          <classpath refid="tomcat.webservices.classpath" />
          <include name="org/apache/naming/factory/webservices/**" />
        </javac>
    
        <!-- Catalina Main JAR File -->
        <jar jarfile="${catalina-ws.jar}">
          <fileset dir="${tomcat.classes}">
            <include name="org/apache/naming/factory/webservices/**" />
            <!-- Javadoc and i18n exclusions -->
            <exclude name="**/package.html" />
            <exclude name="**/LocalStrings_*" />
          </fileset>
        </jar>
        <checksum file="${catalina-ws.jar}"
              forceOverwrite="yes" fileext=".md5" />
    
  </target>

  <target name="extras" depends="prepare,commons-logging,webservices">
  </target>

  <!-- Download and dependency building -->
  <target name="proxyflags">
    <!-- check proxy parameters. -->
    <condition property="useproxy">
      <equals arg1="${proxy.use}" arg2="on" />
    </condition>
  </target>

  <target name="setproxy" depends="proxyflags" if="useproxy">
    <taskdef name="setproxy"
            classname="org.apache.tools.ant.taskdefs.optional.net.SetProxy" />
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"
              proxyuser="${proxy.user}" proxypassword="${proxy.password}" />
    <echo message="Using ${proxy.host}:${proxy.port} to download 
${sourcefile}"/>
  </target>

  <target name="testexist">
    <echo message="Testing  for ${destfile}"/>
    <available file="${destfile}" property="exist"/>
  </target>

  <target name="downloadfile" unless="exist" depends="setproxy,testexist">
    <!-- Download extract the file -->
    <mkdir dir="${destdir}" />
    <get src="${sourcefile}" dest="${destfile}" />
  </target>

</project>
--end  extras.xml (which has no log4j.references) --

   4. Replace $CATALINA_HOME/bin/tomcat-juli.jar with 
output/extras/tomcat-juli.jar.
--where is output/extras/tomcat-juli.jar in apache-tomcat-6.0.14.zip it is in 
bin only?

   5. Place output/extras/tomcat-juli-adapters.jar in $CATALINA_HOME/lib.
--where is output/extras/tomcat-juli.jar in apache-tomcat-6.0.14.zip it is in 
bin only?

   6. Start Tomcat
--no effect log4j is not started..

?
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung / Disclaimer and confidentiality note 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
This message is confidential and may be privileged. If you are not the intended 
recipient, we kindly ask you to  please inform the sender. Any unauthorised 
dissemination or copying hereof is prohibited. This message serves for 
information purposes only and shall not have any legally binding effect. Given 
that e-mails can easily be subject to manipulation, we can not accept any 
liability for the content provided.






> From: chuck.caldar...@unisys.com
> To: users@tomcat.apache.org
> Date: Sat, 4 Apr 2009 21:08:55 -0500
> Subject: RE: How to debug Error: listenerStart?
> 
> > From: Dan Armbrust [mailto:daniel.armbrust.l...@gmail.com]
> > Subject: Re: How to debug Error: listenerStart?
> > 
> > Perhaps it is behaving different on Tomcat 6.  I didn't try 6, only
> > the latest 5.5, since that's what I'm using in production.
> 
> Sorry, I didn't realize this was only a 5.5 issue.  I did try it again on 
> 5.5.27, and verified your findings.
> 
> > Also, your stack trace is showing that it was indeed, logged by
> > tomcat's loggers.  Did you try renaming the log4j.properties.hidden
> > file that I provided?
> 
> Just tried it again on 6.0.18 with the unhidden log4j.properties, and there 
> was no difference.  Also, with the original, untouched a.war, there were no 
> messages about log4j initialization problems.  So under 6.0, it appears that 
> Tomcat is *not* trying to use your log4j.
> 
> > I contend that it should never be printed by log4j, since that is
> > within the webapp which is failing - and tomcat can't know that log4j
> > has been configured.  But yet, on my system, that is exactly what is
> > happening.
> 
> I think I figured out what's going on.  Tomcat 5.5 uses an unmodified 
> LogFactory from commons-logging, which pokes around for logging mechanisms - 
> and finds your log4j.jar inside your webapp.  Tomcat 6.0, on the other hand, 
> uses a modified LogFactory, which is hard-coded to use an enhanced version of 
> java.util.logging, so it never looks for your log4j.  Looks like Tomcat 6 
> implements what you're looking for, so you might want to consider moving up.
> 
> > I'm also still looking into a (possibly?) related issue 
> > that I have where log4j in every webapp deployed beyond 
> > the first fails to auto-configure.
> 
> I suspect it is related.  Since commons-logging is loaded by the system 
> classloader, I'm wondering if it may be hanging onto data from the first 
> log4j.properties it finds (since there's no global log4j) rather than looking 
> for one for each webapp.  Again, this doesn't appear to be an issue in 6.0.
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
> MATERIAL and is thus for use only by the intended recipient. If you received 
> this in error, please contact the sender and delete the e-mail and its 
> attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 

_________________________________________________________________
Rediscover Hotmail®: Get quick friend updates right in your inbox. 
http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Updates1_042009

Reply via email to