diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-11-21 08:47:18 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-11-21 08:47:18 +0000 |
commit | ce2b2a6f5ca8e2bbdcbe90661bb39bd7d2d16422 (patch) | |
tree | c688f9721443d62109de1d955e514dbe7f5a1d3a /sca-cpp/trunk/components/cache | |
parent | 57ff384203570508e81cdf5dfaa0cb96478e7654 (diff) |
Change default log level from 'info' to 'notice' and improve some of the log messages.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1204402 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/components/cache')
-rw-r--r-- | sca-cpp/trunk/components/cache/datacache.cpp | 7 | ||||
-rw-r--r-- | sca-cpp/trunk/components/cache/memcache.hpp | 37 |
2 files changed, 31 insertions, 13 deletions
diff --git a/sca-cpp/trunk/components/cache/datacache.cpp b/sca-cpp/trunk/components/cache/datacache.cpp index e1cfdbfa57..502a57671d 100644 --- a/sca-cpp/trunk/components/cache/datacache.cpp +++ b/sca-cpp/trunk/components/cache/datacache.cpp @@ -52,8 +52,11 @@ const failable<value> get(const value& key, const lambda<value(const list<value> // Lookup level2 cache const value val2 = rcache2(mklist<value>("get", key)); - if (isNil(val2)) - return mkfailure<value>("Couldn't get cache entry"); + if (isNil(val2)) { + ostringstream os; + os << "Couldn't get cache entry: " << key; + return mkfailure<value>(str(os)); + } // Update level1 cache wcache1(mklist<value>("put", key, val2)); diff --git a/sca-cpp/trunk/components/cache/memcache.hpp b/sca-cpp/trunk/components/cache/memcache.hpp index e4cdceb6fa..5d23ff7c42 100644 --- a/sca-cpp/trunk/components/cache/memcache.hpp +++ b/sca-cpp/trunk/components/cache/memcache.hpp @@ -94,11 +94,14 @@ private: const failable<bool> addServer(const string& host, const int port) { apr_memcache_server_t *server; const apr_status_t sc = apr_memcache_server_create(pool, c_str(host), (apr_port_t)port, 1, 1, 1, 600, &server); - if (sc != APR_SUCCESS) - return mkfailure<bool>("Could not create memcached server"); + if (sc != APR_SUCCESS) { + ostringstream os; + os << "Couldn't connect to memcached server: " << host << ":" << port; + return mkfailure<bool>(str(os)); + } const apr_status_t as = apr_memcache_add_server(mc, server); if (as != APR_SUCCESS) - return mkfailure<bool>("Could not add memcached server"); + return mkfailure<bool>("Couldn't add memcached server"); return true; } @@ -134,8 +137,11 @@ const failable<bool> post(const value& key, const value& val, const MemCached& c const string ks(scheme::writeValue(key)); const string vs(scheme::writeValue(val)); const apr_status_t rc = apr_memcache_add(cache.mc, nospaces(c_str(ks)), const_cast<char*>(c_str(vs)), length(vs), 0, 27); - if (rc != APR_SUCCESS) - return mkfailure<bool>("Could not add memcached entry"); + if (rc != APR_SUCCESS) { + ostringstream os; + os << "Couldn't add memcached entry: " << key; + return mkfailure<bool>(str(os)); + } debug(true, "memcache::post::result"); return true; @@ -151,8 +157,11 @@ const failable<bool> put(const value& key, const value& val, const MemCached& ca const string ks(scheme::writeValue(key)); const string vs(scheme::writeValue(val)); const apr_status_t rc = apr_memcache_set(cache.mc, nospaces(c_str(ks)), const_cast<char*>(c_str(vs)), length(vs), 0, 27); - if (rc != APR_SUCCESS) - return mkfailure<bool>("Could not set memcached entry"); + if (rc != APR_SUCCESS) { + ostringstream os; + os << "Couldn't set memcached entry: " << key; + return mkfailure<bool>(str(os)); + } debug(true, "memcache::put::result"); return true; @@ -168,8 +177,11 @@ const failable<value> get(const value& key, const MemCached& cache) { char *data; apr_size_t size; const apr_status_t rc = apr_memcache_getp(cache.mc, cache.pool, nospaces(c_str(ks)), &data, &size, NULL); - if (rc != APR_SUCCESS) - return mkfailure<value>("Could not get memcached entry"); + if (rc != APR_SUCCESS) { + ostringstream os; + os << "Couldn't get memcached entry: " << key; + return mkfailure<value>(str(os)); + } const value val(scheme::readValue(string(data, size))); debug(val, "memcache::get::result"); @@ -184,8 +196,11 @@ const failable<bool> del(const value& key, const MemCached& cache) { const string ks(scheme::writeValue(key)); const apr_status_t rc = apr_memcache_delete(cache.mc, nospaces(c_str(ks)), 0); - if (rc != APR_SUCCESS) - return mkfailure<bool>("Could not delete memcached entry"); + if (rc != APR_SUCCESS) { + ostringstream os; + os << "Couldn't delete memcached entry: " << key; + return mkfailure<bool>(str(os)); + } debug(true, "memcache::delete::result"); return true; |