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:
$oclogsbc/blogReceiving source from STDIN as archive ...Pulling image ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access