Skip to main content

Debugging Overview

Basic Debugging

Logs for Xylok can be collected from three sources:

  • The Xylok manager logs command: /opt/xylok/xylok logs
  • The raw log files on disk at, by default, /var/log/xylok
  • Systemctl: journalctl -u xylok -xe

In-depth Debugging with Debug Mode

If you receive a 500 Server Error message from Xylok, enabling debug mode may provide more information to help with debugging. If your instance of Xylok is accessible on a wider network (such as the Internet), it is recommended to disable debug mode after getting the needed information.

  1. In a text editor, as root open /etc/xylok/xylok.conf

    sudo nano /etc/xylok/xylok.conf
  2. If a DEBUG=False line exists, change it to DEBUG=True. If it does not exist, add it. A complete xylok.conf file might look like:

    HTTP_PORT=8000
    HTTPS_PORT=8001
    SERVER_MODE=prod
    DEBUG=True
    DATABASE_PASSWORD=postgres
    SECRET_KEY='REPLACE ME'
  3. Save and close the configuration file (in Nano, the text editor used in the example above, hit ctrl-x followed by y and Enter).

  4. Restart Xylok to pull in the new configuration: systemctl restart xylok

Collecting Debug Information

  1. Try the action which caused the server error

  2. If the error is displayed in a format similar to the example below, either take a screenshot of the entire page, or alternatively, write down:

  3. If a "Traceback" is shown find any lines that points to /code/src or and write down the file and line number. In this case it would be:

    /code/src/controls/views.py in inner
    34. response = get_response(request)
  4. If the error is not displayed in the above format, open the web browser's developer tools (hitting F12 will usually open them) and switch to the "Network" tab. Try the error-causing action again. The screenshots below are from Chrome, but most browsers have similar looking displays.

    Network tab in Chrome

  5. If one of the network requests is red, click it, then click the "Preview" or "Response" tabs.

    Network response preview in Chrome

  6. Follow steps 4-7 for the displayed information.

  7. Finally, click the "Console" tab near the top of the developer tools to view any Javascript errors or messages from the browser.

    JS console in Chrome

  8. The format on console errors will vary, but take note of anything not reflected in the other error messages displayed.

  9. The last 500 lines of server logs can be viewed by going to the user menu and clicking "Sever Logs." This view is only available to users marked as "staff" in Django:

    Logs on website

Disabling

  1. In a text editor, as root open /etc/xylok/xylok.conf

    sudo nano /etc/xylok/xylok.conf
  2. If a DEBUG=True line exists, change it to DEBUG=False. If it does not exist, add it. A complete xylok.conf file might look like:

    HTTP_PORT=8000
    HTTPS_PORT=8001
    SERVER_MODE=prod
    DEBUG=False
    DATABASE_PASSWORD=postgres
    SECRET_KEY='REPLACE ME'
  3. Save and close the configuration file (in Nano, the text editor used in the example above, hit ctrl-x followed by y and Enter).

  4. Restart Xylok to pull in the new configuration: systemctl restart xylok