diff -urp ./cacherouter-old/Cache.php ./cacherouter/Cache.php
--- ./cacherouter-old/Cache.php	2009-09-05 15:03:25.000000000 +0200
+++ ./cacherouter/Cache.php	2011-03-02 15:50:15.174311002 +0100
@@ -123,4 +123,61 @@ class Cache {
   function unlock() {
     unlink($this->lock);
   }
+
+  /**
+   * trace()
+   *   used to log messages.
+   *
+   * @param $type
+   *   The category to which this message belongs. Can be any string, but the
+   *   general practice is to use the name of the module calling watchdog().
+   * @param $message
+   *   The message to store in the log. See t() for documentation
+   *   on how $message and $variables interact. Keep $message
+   *   translatable by not concatenating dynamic values into it!
+   * @param $variables
+   *   Array of variables to replace in the message on display or
+   *   NULL if message is already translated or not possible to
+   *   translate.
+   * @param $severity
+   *   The severity of the message, as per RFC 3164. Possible values are
+   *   WATCHDOG_ERROR, WATCHDOG_WARNING, etc.
+   * @param $link
+   *   A link to associate with the message.
+   *
+   * @see watchdog_severity_levels()
+   */
+  function trace($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {
+    // If the bootstrap is fully done, use watchdog
+    if (function_exists("module_invoke")) {
+      watchdog($type, $message, $variables, $severity, $link);
+    }
+    // Otherwise use error_log
+    else {
+      // Prepare the fields to be logged
+      $log_message = array(
+        'type'        => $type,
+        'message'     => $message,
+        'variables'   => $variables,
+        'severity'    => $severity,
+        'link'        => $link,
+        'user'        => $user,
+        'request_uri' => $base_root . $_SERVER['REQUEST_URI'],
+        'referer'     => $_SERVER['HTTP_REFERER'],
+        'ip'          => $_SERVER['REMOTE_ADDR'],
+        'timestamp'   => time(),
+      );
+
+      $formatted_message = "CacheRouter: ".$log_message['timestamp'];
+      $formatted_message .= '|'. $log_message['type'];
+      $formatted_message .= '|'. $log_message['ip'];
+      $formatted_message .= '|'. $log_message['request_uri'];
+      $formatted_message .= '|'. $log_message['referer'];
+      $formatted_message .= '|'. $log_message['user']->uid;
+      $formatted_message .= '|'. strip_tags($log_message['link']);
+      $formatted_message .= '|'. strip_tags(is_null($log_message['variables']) ? $log_message['message'] : strtr($log_message['message'], $log_message['variables']));
+
+      error_log($formatted_message);
+    }
+  }
 }
diff -urp ./cacherouter-old/engines/memcache.php ./cacherouter/engines/memcache.php
--- ./cacherouter-old/engines/memcache.php	2009-09-05 15:03:25.000000000 +0200
+++ ./cacherouter/engines/memcache.php	2011-03-02 15:52:46.994311001 +0100
@@ -93,7 +93,12 @@ class memcacheCache extends Cache {
           }
 
           // Resave the lookup table (even on failure)
-          $this->memcache->set($this->lookup, $lookup, FALSE, 0);  
+          if(!$this->memcache->set($this->lookup, $lookup, FALSE, 0)) {
+            // TODO: Add code to deal with that case
+
+            // That could mean that the lookup value has reached more than 1MB and thus has been removed by memcache server
+            $this->trace('cache', 'An error occured while setting the lookup of %table', array('%table' => $this->name), WATCHDOG_ERROR);
+          }
 
           // Remove lock.
           $this->unlock();
@@ -123,7 +128,12 @@ class memcacheCache extends Cache {
           }
         }
         if ($this->lock()) {
-          $this->memcache->set($this->lookup, $lookup, FALSE, 0); 
+          if(!$this->memcache->set($this->lookup, $lookup, FALSE, 0)) {
+            // TODO: Add code to deal with that case
+
+            // That could mean that the lookup value has reached more than 1MB and thus has been removed by memcache server
+            $this->trace('cache', 'An error occured while setting the lookup of %table', array('%table' => $this->name), WATCHDOG_ERROR);
+          }
           $this->unlock();
         }
       }
@@ -164,7 +174,12 @@ class memcacheCache extends Cache {
         }
 
         // Resave the lookup table (even on failure)
-        $this->memcache->set($this->lookup, $lookup, FALSE, 0);
+        if(!$this->memcache->set($this->lookup, $lookup, FALSE, 0)) {
+          // TODO: Add code to deal with that case
+
+          // That could mean that the lookup value has reached more than 1MB and thus has been removed by memcache server
+          $this->trace('cache', 'An error occured while setting the lookup of %table', array('%table' => $this->name), WATCHDOG_ERROR);
+        }
 
         // Remove lock
         $this->unlock();
@@ -184,6 +199,8 @@ class memcacheCache extends Cache {
       $time = time();
       while ($this->memcache->add($this->lock, $this->settings['compress'], 0) === FALSE) {
         if (time() - $time >= 3) {
+          // This could mean that a cache table is locked forever
+          $this->trace('cache', 'Cannot acquire lock for %table', array('%table' => $this->name), WATCHDOG_WARNING);
           return FALSE;
         }
       }
@@ -192,7 +209,14 @@ class memcacheCache extends Cache {
   }
   
   function unlock() {
-    return $this->memcache->delete($this->lock);
+    $return = $this->memcache->delete($this->lock);
+
+    if ($return === FALSE) {
+      // This may result to a cache table that will stay locked forever
+      $this->trace('cache', 'Cannot release lock for %table', array('%table' => $this->name), WATCHDOG_ERROR);
+    }
+
+    return $return;
   }
   
   function connect() {
@@ -200,7 +224,7 @@ class memcacheCache extends Cache {
     foreach ($this->settings['servers'] as $server) {
       list($host, $port) = explode(':', $server);
       if (!$this->memcache->addServer($host, $port)) {
-        watchdog('cache', "Unable to connect to memcache server $host:$port", WATCHDOG_ERROR);
+        $this->trace('cache', "Unable to connect to memcache server $host:$port", WATCHDOG_ERROR);
       }
     }
   }
@@ -226,4 +250,4 @@ class memcacheCache extends Cache {
     );
     return $stats;
   }
-}
\ Pas de fin de ligne à la fin du fichier.
+}
