Using Error Logs

THDL Toolbox > Developers' Zone > Using Error Logs

Using Error Logs

Contributor(s): THDL Staff

As we develop the THDL site, we should periodically check the server's error logs, as per the good suggestions of Guy Mengel. The logs record where errors are occurring that may not be causing noticeable problems on-line but are wasting CPU resources and generally slowing things down.

There are two main logs we should check

  1. the server's error log: this is a file located at: /etc/httpd/logs/error_log
  2. Tomcat's error log: this is for XML transfomations in Saxon run through Tomcat. It is located at: /usr/local/tomcat/logs/catalina.out

Both are text files, even though "error_log" has no extension.

The "tail" ends of these files can be copied to a file on the THDL site, through the following command which uses the "error_log" file as an example:

  • tail -n1000 /etc/httpd/logs/error_log >/lv1/thdl/test/error-log.txt

This command copies the last 1000 lines from the error_log to the "error-log.txt" file in the test folder. To simply look at the last 100 lines in your CRT screen, you can simply type "tail -n### and the name of the file". Thus, the two commands would be:

  • tail -n100 /etc/httpd/logs/error_log
  • tail -n100 /usr/local/tomcat/logs/catalina.out

Tail can be done in real time using the "-f" option. Thus:

  • tail -f /etc/httpd/logs/error_log
  • tail -f /usr/local/tomcat/logs/catalina.out

These commands will show the last few lines of the error file and then display new errors in real time as they occur. You can thus do this command in your terminal window and go and test out pages that might be causing errors.

Provided for unrestricted use by the external link: Tibetan and Himalayan Digital Library