Working with Tomcat application logs
In this recipe, you will learn how to work with logs in Tomcat cartridges. You will start with tailing the logs of an existing Tomcat application, and then you will learn how to add application-specific logging using the SLF4J
library.
Getting ready
This recipe will use the application created in the Creating and Deploying Spring Applications using the Tomcat 7 cartridge recipe in Chapter 7, OpenShift for Java Developers. You can recreate the application using the following command:
$ rhc create-app jobstore tomcat-7 mysql-5.5 --from-code https://github.com/OpenShift-Cookbook/chapter7-jobstore-spring.git --timeout 180
How to do it…
Perform the following steps:
- You can view the logs of a Tomcat application using the
rhc tail
command. Tomcat logs are written to a file namedjbossews.log
inside the$OPENSHIFT_LOG_DIR
directory:$ rhc tail --files */log*/jbossews.log --app jobstore
- The
jbossews.log
file will contain logs of both Tomcat-specific and application...