• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Don't log 404 errors in error log

On our live site we get a lot of 404 errors from our site been probed by bots looking for phpMyAdmin/wordpress etc. This is filling up our log files with loads of  "404 Page Not Found: Phpmyadmin2015/index" etc.

What's the best way to stop any 404 errors being logged into our log files?

Many thanks!

Not sure if my question is not clear or if it's just nobody knows?!

I assume you are talking about the logs that CodeIgniter creates and not server or php logs.

Perhaps the least hackish way would be to extend the core class CI_Exceptions and override the method show_404. All the override has to do is call the parent method setting the second parameter to false.

The whole class definition is simple.


PHP Code:
class MY_Exceptions extends CI_Exceptions
    public function show_404($page ''$log_error TRUE)

The hack way to accomplish your goal is to modify CodeIgniter.php and change line 494 (version 3.1.6) from

PHP Code:
PHP Code:

Ah great idea to extend the exceptions. nice and clean.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.