How to do error logging in CodeIgniter

0 votes
I want error logging in PHP CodeIgniter. How do I enable error logging? What are all the steps to log an error and How do you e-mail that error to an email address?
May 19, 2020 in PHP by kartik
• 37,530 points
6,779 views

1 answer to this question.

0 votes

Hello @kartik,

CodeIgniter has some error logging functions built in.

  • 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.');
  • To send an email you need to extend the core CI_Exceptions class method log_exceptions(). 
answered May 19, 2020 by Niroj
• 82,860 points

Related Questions In PHP

0 votes
1 answer

How to view query error in PDO PHP?

Hello, You need to set the error mode ...READ MORE

answered Oct 20, 2020 in PHP by Niroj
• 82,860 points
809 views
0 votes
1 answer

How to set time zone in codeigniter?

Hii, Add this line inside the main index.php of codeigniter ...READ MORE

answered Nov 6, 2020 in PHP by Niroj
• 82,860 points
478 views
0 votes
1 answer

How to solve JSON_ERROR_UTF8 error in php json_decode?

Hello @kartik, You need simple line of code: $input ...READ MORE

answered Nov 8, 2020 in PHP by Niroj
• 82,860 points
1,020 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
3,351 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,860 points
10,433 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,860 points
1,169 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,860 points
945 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,860 points
11,922 views
0 votes
1 answer

How to select all records from one table that do not exist in another table?

Hello @kartik, You can either do like this: SELECT ...READ MORE

answered Jul 21, 2020 in PHP by Niroj
• 82,860 points
17,843 views
0 votes
1 answer

How do I convert a PDF document to a preview image in PHP?

Hello @kartik, You need ImageMagick and GhostScript <?php $im = new imagick('file.pdf[0]'); $im->setImageFormat('jpg'); header('Content-Type: image/jpeg'); echo ...READ MORE

answered Aug 14, 2020 in PHP by Niroj
• 82,860 points
2,029 views