How to Fix the "Cannot write to log file" Error in Joomla

How to Fix the "Cannot write to log file" Error in Joomla

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:

Cannot write to log file error in Joomla

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

How to Fix the
  • 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:

Cant login to a Joomla site

About the author

Nick is the Director of Support at Joomlashack and you can find him in almost every area of the site, from answering support requests and account questions to creating tutorials and software.