diff --git a/Enyim.Caching/Memcached/Protocol/Binary/DeleteOperation.cs b/Enyim.Caching/Memcached/Protocol/Binary/DeleteOperation.cs index f06a509d..880644dd 100644 --- a/Enyim.Caching/Memcached/Protocol/Binary/DeleteOperation.cs +++ b/Enyim.Caching/Memcached/Protocol/Binary/DeleteOperation.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using System.Text; namespace Enyim.Caching.Memcached.Protocol.Binary { public class DeleteOperation : BinarySingleItemOperation, IDeleteOperation { + private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(DeleteOperation)); public DeleteOperation(string key) : base(key) { } protected override BinaryRequest Build() @@ -23,6 +25,14 @@ protected internal override bool ReadResponse(PooledSocket socket) var retval = response.Read(socket); this.Cas = response.CAS; +#if EVEN_MORE_LOGGING + if (log.IsDebugEnabled) + if (retval) + log.DebugFormat("Delete succeeded for key '{0}'. Reason: {1}", this.Key); + else + log.DebugFormat("Delete failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count)); +#endif + return retval; } } diff --git a/Enyim.Caching/Memcached/Protocol/Binary/GetOperation.cs b/Enyim.Caching/Memcached/Protocol/Binary/GetOperation.cs index 6f0bbd53..6f3e8016 100644 --- a/Enyim.Caching/Memcached/Protocol/Binary/GetOperation.cs +++ b/Enyim.Caching/Memcached/Protocol/Binary/GetOperation.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using System.Text; namespace Enyim.Caching.Memcached.Protocol.Binary { public class GetOperation : BinarySingleItemOperation, IGetOperation { + private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(GetOperation)); private CacheItem result; public GetOperation(string key) : base(key) { } @@ -29,11 +31,21 @@ protected internal override bool ReadResponse(PooledSocket socket) this.result = new CacheItem((ushort)flags, response.Data); this.Cas = response.CAS; +#if EVEN_MORE_LOGGING + if (log.IsDebugEnabled) + log.DebugFormat("Get succeeded for key '{0}'.", this.Key); +#endif + return true; } this.Cas = 0; +#if EVEN_MORE_LOGGING + if (log.IsDebugEnabled) + log.DebugFormat("Get failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count)); +#endif + return false; } diff --git a/Enyim.Caching/Memcached/Protocol/Binary/StoreOperation.cs b/Enyim.Caching/Memcached/Protocol/Binary/StoreOperation.cs index 4689eaae..4a512399 100644 --- a/Enyim.Caching/Memcached/Protocol/Binary/StoreOperation.cs +++ b/Enyim.Caching/Memcached/Protocol/Binary/StoreOperation.cs @@ -52,9 +52,13 @@ protected internal override bool ReadResponse(PooledSocket socket) var retval = response.Read(socket); this.Cas = response.CAS; - if (!retval) - if (log.IsDebugEnabled) +#if EVEN_MORE_LOGGING + if (log.IsDebugEnabled) + if (retval) + log.DebugFormat("Store succeeded for key '{0}'. Reason: {1}", this.Key); + else log.DebugFormat("Store failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count)); +#endif return retval; }