Horizon being a Django application follows the standard Django logging model. The configuration of logging is set in the /etc/openstack_dashboard/local_settings.py
file; if we have to modify the logging levels, we need to look at the logger_root
and handler_file
section of file/etc/keystone/logging.conf.
Let's take a look at the different logging levels for both standard OpenStack services and Horizon in escalating levels of severity:
Logging levels |
OpenStack standard |
Horizon |
---|---|---|
|
Yes |
Yes |
|
Yes |
Yes |
|
Yes |
No |
|
Yes |
Yes |
|
Yes |
Yes |
|
Yes |
Yes |
|
Yes |
No |
When we set the logging levels to DEBUG
, all the different messages are logged; when we set the logging level to anything else, the logs for that level and the ones on a higher level are logged. This is true for both Horizon and OpenStack services.
The TRACE
logs are shown wherever there is a stack trace to be shown. In Horizon, the TRACE
logs are shown almost at all times, as the underlying Python call will generate the stack trace.
You can configure Horizon to send different logs to different files and apply filters in exactly the same way you would do for any other Django application, but this is beyond the scope of the book and so is not covered here.
Coming to the errors that you can face in Horizon, one is the installation error; this error is normally caused by a wrong version of Python and related libraries. The second most common error is the HTTP500 Internal server error, which normally ensues from one of the underlying systems—for instance, Apache not functioning properly or an error in configuration.
The Horizon log normally has two parts: the actual log and the Python stack trace. Let's take look at the following log, as an example:
2015-08-22 01:08:51 17409 CRITICAL cinder [-] Bad or unexpected response from the storage volume backend API: volume group cinder-volumes doesn't exist 2015-08-22 01:08:51 17409 TRACE cinder Traceback (most recent call last): 2015-08-22 01:08:51 17409 TRACE cinder File "/usr/bin/cinder-volume", line 48, in in check_for_setup_error
Some more of the stack trace follows:
2015-08-22 01:08:51 17409 TRACE cinder raise exception.VolumeBackendAPIException(data=exception_message) 2015-08-22 01:08:51 17409 TRACE cinder VolumeBackendAPIException: Bad or unexpected response from the storage volume backend API: volume group cinder-volumes doesn't exist 2015-08-22 01:08:51 17409 TRACE cinder
As you can see, the first line shows that the problem is with the Cinder service and the other lines are the stack trace of the service. So, in order to troubleshoot this further, we will have to go to the Cinder logs and continue the troubleshooting from here.
Horizon can also throw errors if you have installed custom dashboards that interfere with the normal functioning of Horizon's other dashboards. Hence, if you have created a new dashboard, panel, or anything else, you may want to run the tests on another instance of Horizon using the run_tests.sh
script. Remember to use a different port rather than the standard port on which the Horizon production is running.