Book Image

OpenShift Cookbook

By : Shekhar Gulati
Book Image

OpenShift Cookbook

By: Shekhar Gulati

Overview of this book

Table of Contents (19 chapters)
OpenShift Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Running OpenShift on a Virtual Machine
Index

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:

  1. You can view the logs of a Tomcat application using the rhc tail command. Tomcat logs are written to a file named jbossews.log inside the $OPENSHIFT_LOG_DIR directory:

    $ rhc tail --files */log*/jbossews.log --app jobstore
    
  2. The jbossews.log file will contain logs of both Tomcat-specific and application...