Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 243348 - www-servers/tomcat init script: catalina.out redirection broken with openrc-0.4.x [5.5 pending]
Summary: www-servers/tomcat init script: catalina.out redirection broken with openrc-0...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 322979
  Show dependency tree
 
Reported: 2008-10-23 08:18 UTC by Ylosar Goer
Modified: 2011-02-17 08:19 UTC (History)
1 user (show)

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


Attachments
use s-s-d stderr stdout and background arguments to get catalina.out back (ssd-openrc-redirect.patch,817 bytes, patch)
2008-10-23 08:21 UTC, Ylosar Goer
Details | Diff
tomcat 7 init.d script with stderr/stdout redirection to catalina.out (tomcat-7-init_catalina-out.patch,448 bytes, patch)
2011-02-15 08:11 UTC, Ylosar Goer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ylosar Goer 2008-10-23 08:18:46 UTC
It seems that /etc/init.d/tomcat-6 need to be updated to work with openrc-0.3 and redirect stdout and stderr to catalina.out via new start-stop-daemon's arguments (namely --background, --stdout and --stderr), instead of doing it via shell redirections.
Comment 1 Ylosar Goer 2008-10-23 08:21:12 UTC
Created attachment 169542 [details, diff]
use s-s-d stderr stdout and background arguments to get catalina.out back

will probably work with baselayout-2 only
Comment 2 Mike Weissman 2008-12-20 17:46:14 UTC
I wasn't able to re-produce this by:

1. forcing an error by changing a Tomcat Conf.d property
2. starting tomcat
3. start-stop-daemon errors appeared in Catalina.out

Can you try: sys-apps/openrc-0.4.0 ?

Thanks,
Mike
Comment 3 Ylosar Goer 2008-12-22 11:31:01 UTC
> 1. forcing an error by changing a Tomcat Conf.d property
> 2. starting tomcat
> 3. start-stop-daemon errors appeared in Catalina.out

No need to force an error on ssd, the problem is that *tomcat* outputs does not appear in catalina.out (in fact i did not check where ssd errors go nor should go).

When things are working, starting tomcat populates catalina.out with some INFO logs like "INFO: Server startup in 1150 ms", and applications messages and Exceptions printed to stderr at runtime should also appear in catalina.out.

When i start tomcat using the provided init script, nothing appears in catalina.out, when i start it with my patched init script, i get expected logs in catalina.out at startup.

> Can you try: sys-apps/openrc-0.4.0 ?

I can't at the moment as i run a mostly-stable system and openrc-0.4.0 require >=udev-133 which is blocked by cryptsetup-1.0.5-r1 and i don't really want to deal with unstable udev and co.

But if you get tomcat startup INFO logs and webapps Exceptions in catalina.out with openrc-0.4.0, i suppose there is nothing to do and this bug should probably be marked WORKSFORME or something. If this is the case, i will eventualy reopen it later if a newer openrc does not fix the problem for me (as soon as i am able to install it).
Comment 4 Mike Weissman 2008-12-22 16:58:28 UTC
My Quick test was just to show that i couldn't reproduce Tomcat Stderr from not appearing in the Catalina.out,  i tried this because i have had tomcat running in openrc-0.3 for awhile now and it has been logging fine. 

Have you modified the logging.properties file?

Do any of your webapps use a different logging facility?

-Mike
Comment 5 Ylosar Goer 2008-12-22 18:17:27 UTC
(In reply to comment #4)
> My Quick test was just to show that i couldn't reproduce Tomcat Stderr from not
> appearing in the Catalina.out,

I think your test showed that start-stop-daemon's errors were going to catalina.out, not that tomcat's logs were going there too, which is my problem (also it may depends on what conf.d property you changed)

Using the original init script and pointing CATALINA_TMPDIR to a non-existant directory, i too get an ssd error in catalina.out. This means that in my case, the bash redirection works for ssd, but for some reason tomcat cannot use it.

lsof may provide some clue here :

lsof while using original init script :
# lsof | grep catalina.out
start-sto 30652       root    1w      REG        9,4  2803731    6832131 /var/log/tomcat-6/catalina.out
start-sto 30652       root    2w      REG        9,4  2803731    6832131 /var/log/tomcat-6/catalina.out

lsof while using patched init script :
# lsof | grep catalina.out
java      28604     tomcat    1w      REG        9,4  2803410    6832131 /var/log/tomcat-6/catalina.out
java      28604     tomcat    2w      REG        9,4  2803410    6832131 /var/log/tomcat-6/catalina.out

So in the first case ssd owns the file, in the latter case java owns the file. (even if i had no problems, this little difference alone may make the patch a good thing, but this is not the point)

> i tried this because i have had tomcat running
> in openrc-0.3 for awhile now and it has been logging fine. 

oops, may be caused by my mostly-stable setup then. I can't compare with other boxes since the faulty one is the only one using openrc.

> Have you modified the logging.properties file?

No, timestamps shows that this file is unmodified.

> Do any of your webapps use a different logging facility?

No. Only one webapp here with no logging (only some Exceptions supposed to be thrown to stderr...)

This is a quite fresh and simple tomcat setup with no customisation i can remember of except :
- GENTOO_VM="sun-jdk-1.6" in /etc/conf.d/tomcat-6
- using tomcat-native-1.1.15
Comment 6 Mike Weissman 2008-12-24 18:13:57 UTC
(In reply to comment #5)
Are any dated log being created:

(Example)
-rw-r--r-- 1 tomcat tomcat 3180 Aug 13 18:20 /var/lib/tomcat-6/logs/catalina.2008-08-13.log
-rw-r--r-- 1 tomcat tomcat 6372 Aug 14 18:04 /var/lib/tomcat-6/logs/catalina.2008-08-14.log

Comment 7 Ylosar Goer 2008-12-24 19:26:43 UTC
(In reply to comment #6)
> Are any dated log being created:

Yes, with expected logs in them :
-rw-r--r-- 1 tomcat tomcat 956 2008-12-24 20:23 catalina.2008-12-24.log
-rw-r--r-- 1 tomcat tomcat   0 2008-12-24 20:23 catalina.out


Comment 8 Ylosar Goer 2008-12-30 09:45:02 UTC
(In reply to comment #2)
> Can you try: sys-apps/openrc-0.4.0 ?

i finally tried openrc-0.4.1-r1 : no change in catalina.out.
Comment 9 Ylosar Goer 2008-12-30 09:48:17 UTC
Updated $Summary as openrc-0.3 is not in the tree anymore.
Comment 10 Mike Weissman 2009-01-05 18:16:51 UTC
Hey,

I was able to correctly reproduce this issue.

I have submitted 2 fixed ebuilds in [java-experimental] for both tomcat-5.5 and 6
See: 

https://overlays.gentoo.org/svn/proj/java/java-experimental/www-servers/tomcat/

Please test and let me know,

Thanks,
Mike
Comment 11 Ylosar Goer 2009-01-24 09:20:16 UTC
Successfully tested http://overlays.gentoo.org/proj/java/browser/java-experimental/www-servers/tomcat/files/6/tomcat-openrc.init (rev:7391) as a replacement for /etc/init.d/tomcat-6

note: portage changelog dated "20 Dec 2008" for tomcat appears to claim this fix is in the tree but this is not the case.
Comment 12 Mike Weissman 2009-03-08 20:56:16 UTC
(In reply to comment #11)

Please update to the latest -r6 in [java-experimental] to confirm that this still fixes the problem, then i can try and get this fix pushed into main tree.

Thanks,
weisso
Comment 13 Ylosar Goer 2009-03-08 23:13:34 UTC
> Please update to the latest -r6

i did a manual svn checkout of [java-experimental], rev:7602, and installed tomcat-r6. I confirm the problem is still fixed for me.

Note that i did not test with <baselayout-2 so i can't tell about start_helper_regular().
Comment 14 geek 2009-08-13 05:00:47 UTC
I can also confirm this fixes the problem.  I am tomcat-6.0.18-r6 from revision 7814 with openrc-0.4.3-r3.  It would be great if this could be added to the main tree.
Comment 15 Ylosar Goer 2009-08-13 08:15:29 UTC
(In reply to comment #14)
> It would be great if this could be added to the main tree.

As a workaround, you may want to install Tomcat from the main tree and only replace /etc/init.d/tomcat-6 by http://overlays.gentoo.org/proj/java/export/7535/java-experimental/www-servers/tomcat/files/6/tomcat.init.2 to get the openrc fix.
Comment 16 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2010-06-06 12:38:51 UTC
Fixed in 6.0.26-r2. 5.5 still pending I guess?
Comment 17 William L. Thomson Jr. 2011-02-15 02:46:31 UTC
Give it up, with Tomcat >= 7.x there is no more catalina.out. That stuff is written to the other log files, and if your still relying on catalina.out for some reason. Really need to see about updating your application or something. Its not a good approach, and therefore no longer supported on Gentoo. Sorry if you don't like it! 
Comment 18 Ylosar Goer 2011-02-15 08:05:48 UTC
(In reply to comment #17)
> with Tomcat >= 7.x there is no more catalina.out.

http://tomcat.apache.org/tomcat-7.0-doc/logging.html

"
When running Tomcat on unixes, the console output is usually redirected to a file named catalina.out. The name is configurable using an environment variable. (See the startup scripts). Whatever is written to System.err/out will be logged in that file. That may include:
    * Thread dumps, if you requested them via a system signal
    * Uncaught exceptions printed by java.lang.ThreadGroup.uncaughtException(..)
"
Comment 19 Ylosar Goer 2011-02-15 08:11:20 UTC
Created attachment 262569 [details, diff]
tomcat 7 init.d script with stderr/stdout redirection to catalina.out

Here is a trivial patch to the tomcat-7 init.d script currently in portage tree, that do stdout/stderr redirection to catalina.out.
Comment 20 William L. Thomson Jr. 2011-02-16 16:29:09 UTC
Look catalina.out is NOT coming back, I don't care what the upstream documentation says. You do realize all that stuff is log to another file. Tell me why it needs to be logged twice? You can redirect System.err/out, if you look at sources, pretty sure its already being done. Upstream docs likely need to be updated to reflect that.

Either way close this bug as WONTFIX, cause its not going to happen or come back. Its gone for GOOD! Please deal with it!
Comment 21 Alistair Bush (RETIRED) gentoo-dev 2011-02-17 08:19:59 UTC
I agree with wltjr.  closing WONTFIX.