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,510 points
19,056 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,880 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,880 points
5,617 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,880 points
3,200 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,880 points
5,320 views
0 votes
1 answer

How do I convert a string to a number in PHP?

You don't have to do this, since ...READ MORE

answered Feb 23, 2022 in PHP by Aditya
• 7,680 points
410 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,880 points
21,875 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,880 points
2,678 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,880 points
2,540 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,880 points
41,714 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,880 points
51,679 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,880 points
4,287 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP