Bug 1048608 - Tomcat console output is not going to ${CATALINA_BASE}/logs/catalina.out
Summary: Tomcat console output is not going to ${CATALINA_BASE}/logs/catalina.out
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: tomcat
Version: 20
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Ivan Afonichev
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-05 19:48 UTC by Karthic
Modified: 2014-12-15 18:37 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-03-25 22:22:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karthic 2014-01-05 19:48:31 UTC
Description of problem: Tomcat console output (System.out and System.err) are not going to ${CATALINA_BASE}/logs/catalina.out. As per Apache Tomcat documentation (http://tomcat.apache.org/tomcat-7.0-doc/logging.html#Console), console messages go to ${CATALINA_BASE}/logs/catalina.out Previous versions of fedora outputs to /usr/share/tomcat/logs/catalina.out


Version-Release number of selected component (if applicable):


How reproducible:
All times

Steps to Reproduce:
1. Develop a simple tomcat web application. Add debug statements in servlet that prints to System.out or System.err.
2. Deploy it to tomcat server on Fedora 20 and start the tomcat server
3. Invoke the servlet.

Actual results:

No file appears /usr/share/tomcat/logs/catalina.out

Expected results:

Debug statements put on System.out and System.err shall appear in file /usr/share/tomcat/logs/catalina.out

Additional info:

Comment 1 Ivan Afonichev 2014-01-07 20:20:07 UTC
There is no options to make systemd service write it's output to file
see this thread about the same issue with postgres service output: http://lists.freedesktop.org/archives/systemd-devel/2012-March/004701.html

Comment 2 Karthic 2014-01-10 02:13:14 UTC
That's not good. Fedora 19 was doing good with the original scripts from Apache tomcat package. Debug statements are needed at few instances in production environment wherein a regular java juli or log4j (both loggers) cannot be used. Console output does a great job here.

Comment 3 Ivan Afonichev 2014-01-10 16:40:30 UTC
Fedora have never used original tomcat scripts.
It seems all stdout and strerr output of tomcat can be found via:
journalctl -u tomcat
or in syslog in /var/log/messages

Comment 4 Karthic 2014-01-11 01:41:46 UTC
"journalctl -u tomcat" and "/var/log/messages" is having so many other things more than what I am looking for. I am looking for a file that is exclusively for all console outputs from Apache Tomcat (like Catalina.out).

It's hard to troubleshoot an issue with this environment. I hope Fedora resolves this issue ASAP through a fix. I was always happy with Fedora and Redhat since its inception but I am going to try other Linux flavors like openSUSE or Ubuntu till this issue gets resolved with Fedora.

Comment 5 Ivan Afonichev 2014-01-11 09:29:21 UTC
"journalctl -u tomcat" is having only tomcat messages.
"/var/log/messages" and rsyslog will be deprecated soon.
But you can configure rsyslog to write tomcat messages to separate file.
I don't think this tomcat rsyslog config should be included in tomcat package because rsyslog seems to be not included in fedora by default now
https://fedoraproject.org/wiki/Changes/NoDefaultSyslog

Fedora/RedHat way now is to use journald instead of logfiles.
So it is recomended to use "journalctl -u tomcat"

Comment 6 Karthic 2014-01-14 03:18:49 UTC
I overcome this issue with a workaround and could get a dedicated console file by an unconventional way. 

I have to write a startup servlet and change the System.out and System.err with a file based PrintStream on the servlet init method. 

I solved this problem (for myself) but if Fedora can solve it on this release through a path or fix in future release, that will benefit all the tomcat users.

Comment 7 Richard Körber 2014-12-15 18:37:14 UTC
journald seems to truncate leading spaces and empty lines.

When getting a Java thread dump (via kill -3), the output returned from journalctl is almost illegible because of that.

Is there a recommended way of getting this fixed? If not, this bug should be reopened. I have tried "journalctl -o cat -u tomcat", but the output looks something like that (extract):

"main" #1 prio=5 os_prio=0 tid=0x00007f790c009000 nid=0x3587 runnable [0x00007f7914f93000]
java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:404)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:451)
at org.apache.catalina.startup.Catalina.await(Catalina.java:777)
at org.apache.catalina.startup.Catalina.start(Catalina.java:723)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
"VM Thread" os_prio=0 tid=0x00007f790c076800 nid=0x358e runnable
"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00007f790c01e800 nid=0x3588 runnable
"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x00007f790c020000 nid=0x3589 runnable
"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x00007f790c022000 nid=0x358a runnable
"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x00007f790c024000 nid=0x358b runnable
"GC task thread#4 (ParallelGC)" os_prio=0 tid=0x00007f790c025800 nid=0x358c runnable
"GC task thread#5 (ParallelGC)" os_prio=0 tid=0x00007f790c027800 nid=0x358d runnable
"VM Periodic Task Thread" os_prio=0 tid=0x00007f790c0ce800 nid=0x3596 waiting on condition
JNI global references: 282
Heap
PSYoungGen      total 245760K, used 78375K [0x00000000eb600000, 0x00000000fef80000, 0x0000000100000000)
eden space 216576K, 22% used [0x00000000eb600000,0x00000000ee66ad00,0x00000000f8980000)
from space 29184K, 98% used [0x00000000f9200000,0x00000000fae1ef48,0x00000000fae80000)
to   space 52224K, 0% used [0x00000000fbc80000,0x00000000fbc80000,0x00000000fef80000)
ParOldGen       total 142336K, used 66141K [0x00000000c2200000, 0x00000000cad00000, 0x00000000eb600000)
object space 142336K, 46% used [0x00000000c2200000,0x00000000c6297418,0x00000000cad00000)
Metaspace       used 91581K, capacity 94316K, committed 94592K, reserved 1132544K
class space    used 10756K, capacity 11309K, committed 11392K, reserved 1048576K


Note You need to log in before you can comment on or make changes to this bug.