Error logs are useful for finding syntax errors, runtime errors, configuration errors, and other issues that may prevent your application from running properly. In this tutorial we will show you how to enable error logs on OpenLiteSpeed servers on RunCloud, so that you can debug your PHP applications more easily.

Step 1: Edit the LiteSpeed Configuration on a Server Level

Firstly, you’ll need to log in to your RunCloud account and select the server that you want to configure. On the dashboard, click on the “Settings” menu and scroll down to the bottom of the page to find “LiteSpeed Server Config”.

OpenLiteSpeed Server on RunCloud

Next, you’ll need to edit the LiteSpeed configuration file. To enable error logs on the server level, change the logLevel parameter from ERROR to DEBUG in the errorlog section.

This will make LiteSpeed log all errors and warnings to the error log file. The debugLevel parameter controls how much detail is logged for debugging purposes. You can set it to 0 for minimal output, or High for more verbose output.

The rollingSize parameter specifies how large the error log file can grow before it’s rotated. You can set it to a value in bytes, kilobytes (K), megabytes (M), or gigabytes (G).

The enableStderrLog parameter determines whether LiteSpeed redirects PHP errors and warnings to the error log file. You can leave these settings to their default values.

Here is an example of how the errorlog section should look like after editing:

errorlog logs/error.log {
  logLevel                DEBUG
  debugLevel              High
  rollingSize             10M
  enableStderrLog         1
}

Next, click on “Update Config” to save and close the file after you have finished editing.

Step 2: Edit the LiteSpeed Configuration on Web Application Level

After editing the server configuration, you need to edit the web application part of LiteSpeed configuration file. To do this, open the web application and click on the “LiteSpeed Config” in the left menu.

To enable error logs on the web application level, change the logLevel parameter from ERROR to DEBUG in the errorlog section. This will make LiteSpeed log all errors and warnings related to your web application to a separate log file.

Here is an example of how the errorlog section should look after editing:

errorlog /home/runcloud/logs/<webapplicationname>.log {
  useServer               0
  logLevel                DEBUG
  rollingSize             10M
}

After editing, click on the “Update Config” button to save the file.

Step 3: Check the Error Logs

Now you have enabled error logs on OpenLiteSpeed servers on RunCloud, you can check these logs by using the RunCloud web interface – or by accessing the log files directly on your server.

To check the error logs by using the RunCloud web interface, go to your application dashboard and click on “Web Server Log” in the left menu, and then switch to the “LSWS Error” tab to view the server level error log file. You can also filter the log entries by date, level, or keyword.

To check the error logs by accessing the log files directly on your server, you can use any command-line tool to view the files, such as cat, tail, or less. The web application level error log file is located at /home/runcloud/logs/<webapplicationname>_error.log on your server.

In the above example we executed the tail -f /home/runcloud/logs/app-grimes_error.log command, which continuously displays new errors as they occur. The server level error log file is located at /usr/local/lsws/logs/error.log – however, you will need super user permissions to access it.