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?
Apache on ubuntu doesn’t run as
root, that’s for one. Secondly, directory permissions must berwx, which equals to 7. So you have two options:1) Relax writing permissions for everyone on the logs dir with
chmod 777 logs, or2)
chownthe directory to the user that’s running apache (apache)