Skip to content

Diagnosing Issues

Kyle Gabriel edited this page Mar 2, 2017 · 15 revisions

If you are having an issue, such as pages not loading or the daemon not starting, the first thing to do is to look over the logs for anything that resembles an error. These are the common logs that may give an indication of the issue:

/var/log/apache2/error.log
/var/log/mycodo/login.log
/var/log/mycodo/mycodo.log

Next will be to start the frontend and/or the backend in debug mode. This will generate verbose log messages that should give an indication of where the issue is, if not the actual error itself.

Daemon (Backend) Debug Mode

Ensure the daemon isn't running:

sudo service mycodo stop

Check if the daemon is still running:

ps aux | grep mycodo_daemon

If you see the mycodo_daemon.py process running after it was instructed to stop, then we will have to kill it. With the process ID from the ps aux command, above, enter that number in place of the "0000" in the following command:

sudo kill -9 0000

Issue the ps aux command again to verify it has been killed:

ps aux | grep mycodo_daemon

Remove the lock file:

sudo rm -rf /var/lock/mycodo.pid

Start the daemon in debug mode:

sudo python ~/Mycodo/mycodo/mycodo_daemon.py -d

You can monitor the logging output by continuously tailing the log file:


To stop the daemon from running, issue the following command:

```python ~/Mycodo/mycodo/mycodo_client.py -t```

## Flask (Frontend) Debug Mode

If you experience errors while navigating the web interface, you may be presented with a page informing you there's been an error, but not much more information than that. To receive a verbose output that includes a traceback of the error, the web UI will need to be running in debug mode when the error occurs. Follow these steps to start it in debug mode.

Stop apache2 that's running the Flask WSGI app which is the web server that hosts the web user interface:

```sudo /etc/init.d/apache2 stop```

Start the web UI in debug mode:

```sudo python ~/Mycodo/mycodo/mycodo_flask/start_flask_ui.py -d```

The debug log will appear in the terminal. Now attempt to cause the error again, and a more verbose error message should be presented to you.

To stop the web server, use the key combination Ctrl+C in the terminal it is running.