1
votes

i need a logs from codeigniter 3. But i got this error message,

A PHP Error was encountered

Severity: Warning

Message: mkdir(): Permission denied

Filename: core/Log.php

Line Number: 122

Backtrace:

File: /home/admin/mysite/index.php Line: 292 Function: require_once

How can i solve this?

2
What is the Logging Directory Path you set in config.php file? You can specify the path $config['log_path'] = ''; If you set nothing on this variable, then log will write "application/logs/" Check whether you have set proper folder permission for writing logs. - Saji
If in logs folder make sure you have set the correct folder permissions I think 0700 is fine - Mr. ED
i did it, but no changes - Bobby

2 Answers

2
votes

CodeIgniter has some error logging functions built in. You can log any errors to system log with function log_message

Also you can set log level in your application/config/config.php here is the sample settings:

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|       0                           = Disables logging, Error logging TURNED OFF
|       1                           = Error Messages (including PHP errors)
|       2                           = Debug Messages
|       3                           = Informational Messages
|       4                           = All Messages|
*/
  • Make your /application/logs folder writable
  • In /application/config/config.php set
    $config['log_threshold'] = 1;
    or use a higher number, depending on how much detail you want in your logs
  • Use log_message('error', 'Some variable did not contain a value.');

Hope it will help you.

1
votes

This mean that your app cannot create application/logs folder, because it doesn't have permission.

Go to applications folder; Create "logs" folder (without quotes); Give permission to folder: chmod 0755 logs.

That's it.