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
• 11,890 points
24 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
• 23,950 points

Related Questions In PHP

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
• 23,950 points
60 views
0 votes
1 answer

How to get current route in Symfony 2?

Hii,  The easiest way to do this: class MyController ...READ MORE

answered Apr 15 in PHP by Niroj
• 23,950 points
38 views
0 votes
1 answer

How to implement a callback in PHP?

Hello, Implementation of a callback is done like ...READ MORE

answered Apr 15 in PHP by Niroj
• 23,950 points
18 views
0 votes
1 answer

How to Debug Variables like in PHP var_dump()?

Hello @kartik, Try out with the Smarty Session: {$smarty.session|@debug_print_var} or {$smarty.session|@print_r} To ...READ MORE

answered Apr 20 in PHP by Niroj
• 23,950 points
27 views
0 votes
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
• 23,950 points
475 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
• 23,950 points
63 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
• 23,950 points
68 views
0 votes
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
• 23,950 points
172 views
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
• 23,950 points
39 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
• 23,950 points
243 views