PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 22, 2022

[FIXED] Logs aren't showing in logs folder in codeigniter 3

 February 22, 2022     codeigniter, error-logging, php     No comments   

Issue

I'm attempting to add logging into my CI project. I have added the Error Logging Threshold in config as $config['log_threshold'] = 2; and kept the log path empty $config['log_path'] = ''; I'm writing the logging in my controller as

    $product = $this->Pizza_Model->find_pizza($id);
        if ($product == '')
    {
        log_message('error', 'Pizza is not fetched from database');
    }
    else
    {
        log_message('debug', 'Pizza was fetched'.print_r($product,TRUE));
    }

When i run my application nothing is written on the logs folder. Do i have to specifically give the log path in the config file for logs to be written? if so how can i give the log path in the config file?


Solution

$config['log_path'] is supposed to be a path to a directory, not a file. Try a path to a directory, and make sure to include a trailing slash.

Also try 755 (or 777 be careful) permissions on directory if it still doesn't work.

EX. $config['log_path'] = '/var/log/ci_logs/';



Answered By - Mohit Deshwal
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing