A number of our students have had an error message occur inside Joomla:

“Cannot write to log file”

Here’s how the error message appears inside their Joomla administrator area:

The tutorial will explain the issue and show you how to fix it.

Some background information on the error

When someone attempts to log into the administrator using incorrect login info, Joomla logs that attempt in its log file.

However, if the file can’t be accessed or written into, the error is generated.

There are two main reasons that the file can’t be accessed or written to:

  1. Incorrect $log_path setting in Joomla’s configuration.php file
  2. Folder and file permissions aren’t set up correctly

How to fix the problem

  • Edit the configuration.php file and make sure your logs file is properly set to the absolute path. The logs folder is in the root of your Joomla site, so you can use the location of the configuration.php for its path as well and add “logs” to the end. Pro tip: as an alternative, you can set it to “administrator/logs” instead.
  • If that doesn’t resolve the issue, make sure the folder exists (if it doesn’t, create it). Then ask your host to fix the folder and file permissions for the site. It will take them a few minutes to do that.

The end result

After this error is fixed, entering incorrect login info will now result in a message stating the issue: