1

As you are using embedded tomcat so might be you can help me.

I am starting the tomcat using

some code

tomcat.start();

some code

and tomcat is getting started successfully but tomcat logs (talking about tomcat specific logs) are not getting generated in tomcat log folder.But when i start non embaded tomcat(through startup.sh) then logs are getting generated in log folder of tomcat.

Do you have any idea.whats the issue.Do we need to specify the path(or enable logs) programatically in case of embedded tomcat.

VJS
  • 2,891
  • 7
  • 38
  • 70

1 Answers1

1

Look at catalina.sh - it has parameter CATALINA_OUT, saying

#     CATALINA_OUT  (Optional) Full path to a file where stdout and stderr
#                   will be redirected.
#                   Default is $CATALINA_BASE/logs/catalina.out

Then later in the same script, it is used like this:

"$_RUNJAVA" <....lots of other parameters among multiple lines.....> \
  org.apache.catalina.startup.Bootstrap "$@" start \
  >> "$CATALINA_OUT" 2>&1 &

So, as you can see, Tomcat startup script redirects stdout to the catalina.out.

If you run Tomcat yourself, redirect its stdout elsewhere or look at LOGGING_CONFIG parameter how to override this.

mindas
  • 26,463
  • 15
  • 97
  • 154
  • while starting through embedded tomcat, tomcat does not read catalina.sh or even server.xml – VJS Jul 12 '11 at 18:44
  • Of course it doesn't. But I am explaining what it does in the normal mode so you can do the same. By the way, `server.xml` **can** be read when in embedded mode (depending how you launch it). – mindas Jul 12 '11 at 20:39
  • Thanks Mindas.I am checking it out.Do you know the way in order to let tomcat read the server.xml. – VJS Jul 13 '11 at 05:25
  • It does it if you launch Tomcat via org.apache.catalina.startup.Bootstrap class and provide catalina.base, catalina.home, etc. You will also need bootstrap.jar in your classpath. – mindas Jul 13 '11 at 08:47