Skip to content


Better debugging for DB Cache path #1998

merged 2 commits into from

3 participants


Because there is no debug level logging for the cache path, it may be difficult to figure out problems associated with setting up DB caching. Also, the check for is dir and is really writable being in the same if statement doesn't really allow for specific debug messages.


You can bind together:

log_message('debug', 'Cache Path Error: It is not a folder or can not writable. '.$path);

@appleboy, some level of debug logging is better than nothing, but I decided to separate the if statement and have two different debug level log messages because of my experience when I first tested caching. I had never used it before, and when trying to apply the correct path in my config, I had no feedback, and was quite puzzled with the exact reason why debugging wasn't working. Maybe there is a better solution?


Since there are many types of cache, we should prefix these log messages with 'DB' to make it more obvious. Also, while at it - it would probably be better if only the first word in the log message started with a capital letter.

@narfbg narfbg merged commit 20209d6 into bcit-ci:develop

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 14, 2012
  1. Better debugging for DB Cache path

    Brian Gottier committed
  2. Changes per narfbg

    Brian Gottier committed
Showing with 11 additions and 1 deletion.
  1. +11 −1 system/database/DB_cache.php
12 system/database/DB_cache.php
@@ -95,12 +95,22 @@ public function check_path($path = '')
: rtrim($path, '/').'/';
- if ( ! is_dir($path) OR ! is_really_writable($path))
+ if ( ! is_dir($path))
+ log_message('debug', 'DB cache path error: '.$path);
// If the path is wrong we'll turn off caching
return $this->db->cache_off();
+ if ( ! is_really_writable($path))
+ {
+ log_message('debug', 'DB cache dir not writable: '.$path);
+ // If the path is not really writable we'll turn off caching
+ return $this->db->cache_off();
+ }
$this->db->cachedir = $path;
return TRUE;
Something went wrong with that request. Please try again.