skytreader
skytreader

Reputation: 11707

Enabling CodeIgniter logging in Ubuntu

I'm trying to enable logging for CodeIgniter in Ubuntu. However, nothing seems to be written in my application/logs directory. Here's what I've done so far...

In the controller login.php, I have the following lines:

public function index(){
    log_message("error", "Logging sanity check.");
}

I set it to error just to make sure it gets logged no matter what. Then, in my config.php, I set log_threshold to 3 (just to be safe).

Then, in the terminal running as superuser, I do chmod 666 logs and chown root logs.

Now no matter how many times I visit index.php/login, nothing seems to get logged. I've tried that both in a browser ran as superuser and as normal user. All I get in application/logs is an index.html which displays "Directory access is forbidden." I've even tried resetting XAMPP. What have I missed?

Upvotes: 2

Views: 1185

Answers (1)

favoretti
favoretti

Reputation: 30207

Apache on ubuntu doesn't run as root, that's for one. Secondly, directory permissions must be rwx, which equals to 7. So you have two options:

1) Relax writing permissions for everyone on the logs dir with chmod 777 logs, or 2) chown the directory to the user that's running apache (apache)

Upvotes: 5

Related Questions