Debugging
From MoCa Development Wiki
Contents |
Access the Android Phone Error Logs
- In Eclipse, if you are using the emulator or the phone is connected via USB cable to the computer:
Window > Open Perspective > DDMS (android icon next to it), Find logcat window - If you want to stay on the command line, you can also redirect the output to a file with "adb logcat > myfile.txt".
- More information on adb
Access the MDS Error Logs
- Use the django admin interface to view the request logs at <address of MDS>/admin
(i.e. MIT Server Django Interface [1]) - Use the Moca MDS Log Interface at <address of MDS>/log
(i.e. MIT Server MDS Error Logs [2])
Click on the URI to expand and see the debug messages.
Access the OpenMRS error logs
- ssh into the MIT Media Lab Moca server
- ssh joe@moca.media.mit.edu but insert your own username instead of ‘joe’
- If you don’t have a ssh client, you can use PuTTY for Windows
PuTTY for Windows on Intel x86 - putty.exe - Host Name: moca.media.mit.edu
Port: 22
Connection Type: SSH
Type in username and password
- In the terminal window, execute
tail -300 /var/log/daemon.log | sed 's/\^I/\n\t/g' | less
That will give you the first page of the last 300 lines of the log. To get to the end, hit shift-G. Usually the end is what you want since that's where the last error will show. Use space to page forward, 'b' to page back. - You may need to restart the Tomcat server if you receive an error in OpenMRS and can't return back to the home page (i.e. "An error has occurred! The following error happened somewhere on this page: javax.servlet.jsp.JspException: org.openmrs.api.APIException: Service not found: interface org.openmrs.api.AdministrationService")
- In the terminal window, execute
sudo /etc/init.d/tomcat6 restart - When you refresh the browser, you should be able to login to OpenMRS without a problem
- In the terminal window, execute
Access the MySQL Database Tables
An explanation of the database tables is found in the OpenMRS data model image. Click on the image to zoom in and pan around. OpenMRS Data Model
Start by scrolling to the very left and seeing the “Patient” group of tables, then “’Person/Relationship” tables, “Groups/Workflows” tables, “Encounter” tables, “Observation tables,” “Concept” tables, “Form” tables, “Order” tables, and etc…
- ssh into moca.media.mit.edu as shown above
- In the terminal window, execute
- mysql –u root –p
password: ****(not shown)****
- mysql –u root –p
- MySQL connection will open. Type the following.
- show databases;
- use openmrs;
- show tables;
- select * from __(insert a table name)____;
- Alternatively, you can use phpMyAdmin for a graphical interface to view the MySQL tables (if you don’t want to use the command line to access MySQL)
- Download it here
http://www.phpmyadmin.net/home_page/downloads.php
(It’s basically a set of folders that you can drop on your server, configure some settings, and then it works!) - Once it's setup, for example at: http://moca.media.mit.edu/~kkuan87/phpMyAdmin/
- Login with username and password
- On the left hand side, click “openmrs (83)”
- Then feel free to browse through the tables listed in the left hand column
- Download it here
