<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>112530</bug_id>
          
          <creation_ts>2005-11-14 10:45 0000</creation_ts>
          <short_desc>tomcat-5.0.28-r9 profile capability is incomplete and logging setup is broken</short_desc>
          <delta_ts>2006-07-02 19:21:24 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Server</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>g2-mail@duboulder.com</reporter>
          <assigned_to>java@gentoo.org</assigned_to>
          <cc>wltjr@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>g2-mail@duboulder.com</who>
            <bug_when>2005-11-14 10:45:01 0000</bug_when>
            <thetext>The tomcat startup script /usr/share/tomcat-5/bin/catalina.sh unconditionally
sources /etc/conf.d/tomcat-5 even when called from a linked service startup
script such as /etc/init.d/tomcat-dev (which is a link from /etc/init.d/tomcat-5).

The prototype variables in /etc/conf.d/tomcat-5 don&apos;t allow for the profiles to
have separate log directories.

/etc/conf.d/tomcat-5 has an extraneous line that erases the log4j setup.

Reproducible: Always
Steps to Reproduce:
1. cd /etc/init.d; ln -s tomcat-5 tomcat-dev
2. cp /etc/conf.d/tomcat-5 /etc/conf.d/tomcat-dev
3. In /etc/conf.d/tomcat-dev, change PROFILE to dev
4. Duplicate /var/lib/tomcat-5/default to /var/lib/tomcat-5/dev
   (make dirs /var/{run,tmp}/tomcat-5/dev and /etc/tomcat-5/dev
    and create the symlinks in /var/lib/tomcat-5/dev).
5. /etc/init.d/tomcat-dev start


Actual Results:  
The scripts used /etc/conf.d/tomcat-5 to get the config variables. PROFILE was
still set to default.

log4j doesn&apos;t initializae properly, reports errors in
/var/log/tomcat-5/catalina.log.

Expected Results:  
The config variables in /etc/conf.d/tomcat-dev should have been used and the
PROFILE set to dev. Logging creates files under /var/log/tomcat-5/${PROFILE}.

log4j is initialized and produces log output for configured services.

Suggestions for a fix:

--- /usr/share/tomcat-5/bin/catalina.sh 2005-11-14 10:49:37.765565500 -0700
+++ /tmp/usr/share/tomcat-5/bin/catalina.sh 2005-11-14 10:42:47.591931000 -0700
@@ -40,7 +40,24 @@

 # source the appropriate files right away
 source /etc/profile
-source /etc/conf.d/tomcat-5
+if [[ ! -r &quot;/etc/conf.d/${SVCNAME}&quot; ]]; then
+    # STDOUT output gets swallowed by the environment
+    # that start-stop-daemon sets up, so try syslog and
+    # then logging to a file
+    logger=$(which logger)
+    if [[ ! -z &quot;$logger&quot; ]]; then
+        $logger -t ${SVCNAME} -p daemon.err \
+            &quot;${SVCNAME} missing configuration file /etc/conf.d/${SVCNAME}&quot;
+        exit 1
+    fi
+    if [[ -d /var/log/tomcat-5/ ]]; then
+        echo &quot;${SVCNAME} missing configuration file /etc/conf.d/${SVCNAME}&quot; \
+            &gt;&gt; /var/log/tomcat-5/${SVCNAME}.log
+    fi
+    exit 1
+else
+    source /etc/conf.d/${SVCNAME}
+fi

 # OS specific support.  $var _must_ be set to either true or false.
 cygwin=false

--- /etc/conf.d/tomcat-5    2005-11-14 10:58:57.516008500 -0700
+++ /tmp/etc/conf.d/tomcat-5    2005-11-14 11:02:08.287931000 -0700
@@ -50,8 +50,9 @@

 # (Optional) Java runtime options used when the &quot;start&quot;, &quot;stop&quot;, or &quot;run&quot;
 # commands are executed.
-CATALINA_OPTS=&quot;-Dlog4j.configuration=file:/etc/tomcat-5/log4j.properties&quot;
-CATALINA_OPTS=&quot;-Dbuild.compiler.emacs=true&quot;
+CATALINA_OPTS=&quot;-Dlog4j.configuration=file:/etc/tomcat-5/${PROFILE}/log4j.properties&quot;
+# This overrides the previous previous setting
+##CATALINA_OPTS=&quot;-Dbuild.compiler.emacs=true&quot;

 # Java Platform Debugger Architecture (JPDA)
 # http://java.sun.com/products/jpda/</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>g2-mail@duboulder.com</who>
            <bug_when>2005-11-15 09:36:08 0000</bug_when>
            <thetext>The duplicate CATALINA_OPTS line /etc/conf.d/tomcat-5 is porbably because of the
jikes use flag. The comments related to the JSP servlet in
/var/lib/tomcat-5/default/conf/web.xml (line 179) say to add the value
-Dbuild.compiler.emacs=true to CATALINA_OPTS when using jikes. So the
line in web.xml should be:

CATALINA_OPTS=&quot;${CATALINA_OPS} -Dbuild.compiler.emacs=true&quot;

instead of:

CATALINA_OPTS=&quot;-Dbuild.compiler.emacs=true&quot;


[ebuild   R   ] www-servers/tomcat-5.0.28-r9  +doc +examples +jikes 0 kB</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>wltjr@gentoo.org</who>
            <bug_when>2006-04-06 17:56:23 0000</bug_when>
            <thetext>Profiling will be removed soon. It was an experimental feature never added to stable versions of Tomcat in portage. Profiling has been removed from 5.5.16 in java experimental. I will see about removing from 5.0.x versions as well. Also we are no longer using catalina.sh to start/stop tomcat. Nor are we patching or modifying that file.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>wltjr@gentoo.org</who>
            <bug_when>2006-06-07 07:41:50 0000</bug_when>
            <thetext>Tomcat 5.0.x is very old now, and upstream (Tomcat Devs) highly recommend against anyone installing or using this version. Please use Tomcat 5.5.x in java-experimental overlay. http://www.gentoo.org/proj/en/java/experimental.xml

Tomcat 5.0.x ebuilds will be masked soon and eventually removed all together. Tomcat 5.5.x should be added to portage within a month or so. Just after migration to new java system is complete.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>nichoj@gentoo.org</who>
            <bug_when>2006-07-02 19:21:24 0000</bug_when>
            <thetext>This should be taken care of by tomcat-5.5.17 which I just added. Give it a few hours to get to your local mirror, and emerge --sync.</thetext>
          </long_desc>
      
    </bug>

</bugzilla>