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 in PHP by kartik
• 27,360 points
157 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 by Niroj
• 58,920 points

Related Questions In PHP

0 votes
2 answers
0 votes
1 answer

How to merge two arrays while keeping keys instead of reindexing in php?

Hello, Considering that you have $replaced = array('1' => ...READ MORE

answered Apr 1 in PHP by Niroj
• 58,920 points
88 views
0 votes
1 answer

How to get the client IP address in PHP ?

Hello, Here is a code sample of a good ...READ MORE

answered Apr 8 in PHP by Niroj
• 58,920 points
1,301 views
0 votes
1 answer

How to log in to phpMyAdmin with WAMP?

Hello @kartik,  Try-Username: root Password: (No password set). Sometimes it doesn't ...READ MORE

answered Apr 9 in PHP by Niroj
• 58,920 points
339 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 in Laravel by Niroj
• 58,920 points
2,186 views
0 votes
1 answer

What is redirection in Laravel?

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

answered Mar 18 in Laravel by Niroj
• 58,920 points
241 views
0 votes
1 answer

How to install Laravel via composer?

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

answered Mar 23 in Laravel by Niroj
• 58,920 points
189 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 in Laravel by Niroj
• 58,920 points
2,724 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 in PHP by Niroj
• 58,920 points
188 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 in PHP by Niroj
• 58,920 points
85 views