Chapter 18. Logging, Monitoring, and Debugging

Development and deployment of your application may not always go smoothly. It is therefore important to understand what tools are available in OpenShift for helping you to debug issues.

The primary means of working out what is going on are the logs generated when you build, deploy, and are running your application. These are supplemented by system events generated by OpenShift. You can also monitor for changes to resource objects.

To debug your running application, you can start up an interactive terminal session running inside your application container. For debugging why your application may not be starting up, you can create a special container with your application image where, instead of the application being run automatically, you are given an interactive shell so you can start it up yourself.

In this chapter you will learn about how to access logs, how to interact with your application using an interactive shell, and other methods for monitoring your application.

Viewing the Build Logs

When you build your application from source code in OpenShift, either using an S2I builder or from a Dockerfile, the build process is co-ordinated by a build pod. Any log output from the build process will be captured against this build pod.

To view the build logs for the last build run, you can run the oc logs command against the build configuration for your application:

$ oc logs bc/blog
Receiving source from STDIN as archive ...
Pulling image ...

Get Deploying to OpenShift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.