Codeigniter not creating any log files
Asked Answered
D

5

15

Under config.php I have:

$config['log_threshold'] = 4;
$config['log_path'] = '/home/myaccount/logFilesFolder';

In index.php I have:

error_reporting(E_ALL);

The only way I can seem to get anything to log is if I chmod that directory to rwx (777), which doesn't seem right to me. That and it doesn't see to be logging all the errors.

In my local/dev environment it seems to be working but on my production server nothing is being logged. I can't seem to figure out why.

Demarcusdemaria answered 20/6, 2011 at 16:43 Comment(1)
did your problem solved?Portamento
D
12

The log filename in the configuration settings needs a trailing "/" above making sure the webserver process has writeable access to the directory.

Demarcusdemaria answered 3/7, 2011 at 2:26 Comment(0)
P
5

Change the logs owner and group to what owner/group your live web server is running, give it write perms and it should work. I take it that in your local/dev server your CI folder is owned by you that is why you need to chmod it to 777 to make it work.

Portamento answered 20/6, 2011 at 16:47 Comment(0)
W
3

The directory where you want the log files to be saved needs to be writable.

Walkyrie answered 20/6, 2011 at 16:50 Comment(1)
thank you!!!! dont know how many times ive restarted the server to get this wokringNucleate
V
0

I have tried a lot of solutions and finally what worked for me was this:

Open system/libraries/Log.php and change the following lines; set the value of: $this->log_path to a writable directory, preferably home directory so that there are no permission issues. If you want to change the filename also, search for the variable $filepath and change the name. Example: $this->log_path = '/log'; touch /log/ restart the webserver. The logs will start coming.

I have tried a lot of other options, none worked, this is not neat approach but at least I can see my logs now.

Vitovitoria answered 24/9, 2014 at 8:53 Comment(0)
R
0

I had the same problem with my Codeigniter 4 project. The log was created successfully in my local window machine but was not creating on the remote Linux machine. I was using a custom path to generate log files under the 'app' folder. So what I did is to change the settings in my config/Logger.php file back to

'path' => WRITEPATH.'logs/',

and it created the log files under writeable/logs folder.

Ragi answered 16/9, 2022 at 19:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.