Search code examples
codeigniterloggingmkdir

MKDIR() Permission Denied Codeigniter 3


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?


Solution

  • 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.