The logging module of Object Cache Pro allows you to log and analyze anything your WordPress object cache does, as well as easily debug issues.

By default, Object Cache Pro uses the ErrorLogLogger which logs all critical errors to stderr using PHP's error_log() function.

When WP_DEBUG or SAVEQUERIES is enabled, the ArrayLogger is used, which stores all log entries on a per-request basis, which is used for the Debug Bar integration to show you who is calling the cache, how long it takes, and what’s being done.

You can, of course, use your own logging implementation, any PSR-3 compatible logger, or one of the included loggers such as the NullLogger.

Upon request custom loggers for CloudWatch, Papertrail, and others may be added.



It does nothing to keep the memory footprint low.


Stores all log entries in runtime memory and can be read using ArrayLogger::messages(). Additionally extends the ErrorLogLogger class, which logs critical errors to strerr.


By default, all critical errors are logged to stderr using PHP error_log() function. You can adjust the log_levels configuration option to adjust which messages are logged.

define('WP_REDIS_CONFIG', [
'logger' => \RedisCachePro\Loggers\ErrorLogLogger::class,
// log all messages
'log_levels' => null,
// only log warnings and notices
'log_levels' => ['warning', 'notice'],

Custom Loggers

Loggers must implement the RedisCachePro\Loggers\LoggerInterface which is identical to PSR-3’s Psr\Log\LoggerInterface.

To register a logger, pass its fully qualified class name to your config:

define('WP_REDIS_CONFIG', [
// ...
'logger' => \RedisCachePro\Loggers\ErrorLogLogger::class,

An instance of it will be created when WordPress calls wp_cache_init().

To keep things simple when writing your own logger, you can extend RedisCachePro\Loggers\Logger class, which implements all necessary methods except the log() method itself:

class SyslogLogger extends \RedisCachePro\Loggers\Logger
* Logs with an arbitrary level to the system log.
* @param mixed $level
* @param string $message
* @param array $context
* @return void
public function log($level, $message, array $context = [])
if (! openlog('wordpress.redis', LOG_PID, LOG_USER)) {
throw new \LogicException("Can’t open syslog for ident LOG_PID and facility LOG_USER.");
syslog($level, (string) $message);