Working with Python application logs
In this recipe, you will learn how to add view and logging to your Python applications. As discussed in Chapter 8, OpenShift for Python Developers, OpenShift Python applications use Apache with mod_wsgi
.
Getting ready
This recipe will use the application created in the Creating and deploying Flask web applications using Python and PostgreSQL cartridges recipe in Chapter 8, OpenShift for Python Developers. You can recreate the application using the following command:
$ rhc create-app jobstore python-2.7 postgresql-9.2 --from-code https://github.com/OpenShift-Cookbook/chapter8-jobstore-python-flask.git
How to do it…
Perform the following steps:
- Open a new command-line terminal, and navigate to the directory where you have created the Python application.
- To view the logs of a Python application, run the following command:
$ rhc tail --files */log*/python.log
- By visiting the application URL, you will see the following logs in the
rhc tail
command output...