Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 162379 - tomcat init script does not capture std out/err
Summary: tomcat init script does not capture std out/err
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: William L. Thomson Jr. (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-16 15:47 UTC by William L. Thomson Jr. (RETIRED)
Modified: 2007-07-17 16:46 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description William L. Thomson Jr. (RETIRED) gentoo-dev 2007-01-16 15:47:49 UTC
catalina.sh seems to capture std out/err via

org.apache.catalina.startup.Bootstrap "$@" start \
      >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &

Tried to update init script to capture that stuff already but start-stop-daemon is not helping matters :( Could use some help if anyone else want's to poke at this. Otherwise I will look into addressing when I have time.
Comment 1 William L. Thomson Jr. (RETIRED) gentoo-dev 2007-01-28 07:27:17 UTC
Well for some reason it did not like that in a variable. But basically ended up tagging on the code displayed. Also mentioned in the forums here, less the last & for backgrounding.

http://forums.gentoo.org/viewtopic-t-507085.html

Fix committed to tree, closing bug. Please allow time to sync to mirrors
Comment 2 Philippe Laflamme 2007-01-31 03:05:09 UTC
I don't think this solves the issue still...

I think the problem is coming from the start-stop-daemon utility. Seems that using the --background switch will fork the s-s-d process and redirect all the child's std* FDs to /dev/null.

If you search for "background" within the s-s-d source at:
http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-src/rc-scripts/src/start-stop-daemon.c?rev=1.5&content-type=text%2Fplain

you'll see the process fork itself, setup a /dev/null fd and later use that fd to override the child's stds using dup2().

Not sure why this was written this way. I'm sure there's a very valid reason for doing so.

I suggest completely removing the use of s-s-d to solve this issue.
Comment 3 William L. Thomson Jr. (RETIRED) gentoo-dev 2007-01-31 05:44:43 UTC
Likely have to wait for the newer version of s-s-d. It has a --stdout and I believe --stderr as well. Which we should be able to redirect to catalina.out. I am not sure if it's in ~arch yet. I believe it is, so will see about adding that to the ~arch version. Guess I will re-open bug if it's not fully resolved.
Comment 4 William L. Thomson Jr. (RETIRED) gentoo-dev 2007-05-17 21:17:06 UTC
Ok a work around for this has been put into place for now. We have dropped --background in favor of & for s-s-d. Only downfall/side effect so far seems to be a running s-s-d process. Oh well price to pay for stdout/stderr at this time.

When s-s-d has --stdout/--stderr flags I will switch back to --background and use those to capture/redirect output to catalina.out.

Fixed in 5.5.23-r3 and 6.0.13-r1 both were just committed. Please allow time to pass before sync. Closing bug as this has been confirmed by several to work including me :)
Comment 5 Perolo Silantico 2007-06-19 16:30:28 UTC
Another solution would be to use bash with "exec". Then "--background" can be used with s-s-d and we do not have a running s-s-d process.


start-helper() {
        local executor=${1}
        shift
        local arguments="--start --quiet --background --chuid ${CATALINA_USER}:${CATALINA_GROUP} \
                --make-pidfile --pidfile /var/run/tomcat.pid"
        args="$@"
        start-stop-daemon ${arguments} --exec ${executor} --startas /bin/bash -- -c "exec ${executor} ${OPTS_CP} $args ${CATALINA_ARGS} ${TOMCAT_START} >> \"$CATALINA_BASE/logs/catalina.out\" 2>&1"
        return $?
}
Comment 6 William L. Thomson Jr. (RETIRED) gentoo-dev 2007-06-19 17:09:01 UTC
Thanks I might go with that and will consider it in the mean time. I am waiting on baselayout 2 to hit tree since the version of s-s-d there, has support for --stdout --stderr
Comment 7 William L. Thomson Jr. (RETIRED) gentoo-dev 2007-07-17 16:36:02 UTC
(In reply to comment #6)
> Thanks I might go with that and will consider it in the mean time. I am waiting
> on baselayout 2 to hit tree since the version of s-s-d there, has support for
> --stdout --stderr
> 

If baselayout 2 is not stable by the next release of Tomcat, I will likely switch over to the method suggested in comment #5. I have a feeling it's going to be a little while before baselayout 2 is stable. Since I don't believe it's even in tree yet.
Comment 8 Roy Marples (RETIRED) gentoo-dev 2007-07-17 16:46:31 UTC
(In reply to comment #7)
> If baselayout 2 is not stable by the next release of Tomcat, I will likely
> switch over to the method suggested in comment #5. I have a feeling it's going
> to be a little while before baselayout 2 is stable. Since I don't believe it's
> even in tree yet.

baselayout-2 has been in the tree for over 6 months. It's just in package.mask and will be there for a little while longer.