Blob Blame History Raw
From 37391a05f78b099bc02f84e555cf173409538346 Mon Sep 17 00:00:00 2001
From: Manikandan Selvaganesh <mselvaga@redhat.com>
Date: Mon, 6 Apr 2015 16:21:43 +0530
Subject: [PATCH 081/101] protocol/client : porting log messages to new framework

Change-Id: I9bf2ca08fef969e566a64475d0f7a16d37e66eeb
BUG: 1231775
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Reviewed-on: http://review.gluster.org/10042
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/50886
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
---
 xlators/protocol/client/src/Makefile.am        |    2 +-
 xlators/protocol/client/src/client-callback.c  |   16 +-
 xlators/protocol/client/src/client-handshake.c |  330 +++++++------
 xlators/protocol/client/src/client-helpers.c   |   17 +-
 xlators/protocol/client/src/client-lk.c        |   23 +-
 xlators/protocol/client/src/client-messages.h  |  624 ++++++++++++++++++++++++
 xlators/protocol/client/src/client-rpc-fops.c  |  593 +++++++++++++++--------
 xlators/protocol/client/src/client.c           |  243 ++++-----
 xlators/protocol/client/src/client.h           |    3 +-
 9 files changed, 1346 insertions(+), 505 deletions(-)
 create mode 100644 xlators/protocol/client/src/client-messages.h

diff --git a/xlators/protocol/client/src/Makefile.am b/xlators/protocol/client/src/Makefile.am
index cf89d42..fcdf5e3 100644
--- a/xlators/protocol/client/src/Makefile.am
+++ b/xlators/protocol/client/src/Makefile.am
@@ -11,7 +11,7 @@ client_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
 client_la_SOURCES = client.c client-helpers.c client-rpc-fops.c  \
 	client-handshake.c client-callback.c client-lk.c
 
-noinst_HEADERS = client.h client-mem-types.h
+noinst_HEADERS = client.h client-mem-types.h client-messages.h
 
 AM_CPPFLAGS = $(GF_CPPFLAGS) \
 	-I$(top_srcdir)/libglusterfs/src \
diff --git a/xlators/protocol/client/src/client-callback.c b/xlators/protocol/client/src/client-callback.c
index 78b9cef..d36a64b 100644
--- a/xlators/protocol/client/src/client-callback.c
+++ b/xlators/protocol/client/src/client-callback.c
@@ -16,11 +16,12 @@
 #include "client.h"
 #include "rpc-clnt.h"
 #include "defaults.h"
+#include "client-messages.h"
 
 int
 client_cbk_null (struct rpc_clnt *rpc, void *mydata, void *data)
 {
-        gf_log (THIS->name, GF_LOG_WARNING,
+        gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
                 "this function should not be called");
         return 0;
 }
@@ -28,7 +29,7 @@ client_cbk_null (struct rpc_clnt *rpc, void *mydata, void *data)
 int
 client_cbk_fetchspec (struct rpc_clnt *rpc, void *mydata, void *data)
 {
-        gf_log (THIS->name, GF_LOG_WARNING,
+        gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
                 "this function should not be called");
         return 0;
 }
@@ -36,7 +37,7 @@ client_cbk_fetchspec (struct rpc_clnt *rpc, void *mydata, void *data)
 int
 client_cbk_ino_flush (struct rpc_clnt *rpc, void *mydata, void *data)
 {
-        gf_log (THIS->name, GF_LOG_WARNING,
+        gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_FUNCTION_CALL_ERROR,
                 "this function should not be called");
         return 0;
 }
@@ -51,7 +52,7 @@ client_cbk_cache_invalidation (struct rpc_clnt *rpc, void *mydata, void *data)
         struct gf_upcall_cache_invalidation ca_data = {0,};
         gfs3_cbk_cache_invalidation_req     ca_req  = {0,};
 
-        gf_log (THIS->name, GF_LOG_TRACE, "Upcall callback is called");
+        gf_msg_trace (THIS->name, 0, "Upcall callback is called");
 
         if (!rpc || !mydata || !data)
                 goto out;
@@ -61,7 +62,8 @@ client_cbk_cache_invalidation (struct rpc_clnt *rpc, void *mydata, void *data)
                                (xdrproc_t)xdr_gfs3_cbk_cache_invalidation_req);
 
         if (ret < 0) {
-                gf_log (THIS->name, GF_LOG_WARNING,
+                gf_msg (THIS->name, GF_LOG_WARNING, -ret,
+                        PC_MSG_CACHE_INVALIDATION_FAIL,
                         "XDR decode of cache_invalidation failed.");
                 goto out;
         }
@@ -69,8 +71,8 @@ client_cbk_cache_invalidation (struct rpc_clnt *rpc, void *mydata, void *data)
         upcall_data.data = &ca_data;
         gf_proto_cache_invalidation_to_upcall (&ca_req, &upcall_data);
 
-        gf_log (THIS->name, GF_LOG_TRACE, "Upcall gfid = %s, ret = %d",
-                ca_req.gfid, ret);
+        gf_msg_trace (THIS->name, 0, "Upcall gfid = %s, ret = %d",
+                      ca_req.gfid, ret);
 
         default_notify (THIS, GF_EVENT_UPCALL, &upcall_data);
 
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index b4c4604..457fa25 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -24,6 +24,7 @@
 #include "glusterfs3.h"
 #include "portmap-xdr.h"
 #include "rpc-common-xdr.h"
+#include "client-messages.h"
 
 #define CLIENT_REOPEN_MAX_ATTEMPTS 1024
 extern rpc_clnt_prog_t clnt3_3_fop_prog;
@@ -52,15 +53,16 @@ client3_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
         frame = myframe;
 
         if (!frame || !frame->this) {
-                gf_log (THIS->name, GF_LOG_ERROR, "frame not found with the request, "
-                        "returning EINVAL");
+                gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
+                        "frame not found with the request, returning EINVAL");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
         }
         if (-1 == req->rpc_status) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "received RPC status error, returning ENOTCONN");
+                gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
+                        PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
+                        "returning ENOTCONN");
                 rsp.op_ret   = -1;
                 rsp.op_errno = ENOTCONN;
                 goto out;
@@ -68,7 +70,8 @@ client3_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_getspec_rsp);
         if (ret < 0) {
-                gf_log (frame->this->name, GF_LOG_ERROR,
+                gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED,
                         "XDR decoding failed, returning EINVAL");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
@@ -76,8 +79,9 @@ client3_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
 
         if (-1 == rsp.op_ret) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "failed to get the 'volume file' from server");
+                gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+                        PC_MSG_VOL_FILE_NOT_FOUND, "failed to get the 'volume "
+                        "file' from server");
                 goto out;
         }
 
@@ -113,7 +117,7 @@ int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data)
                                      (xdrproc_t)xdr_gf_getspec_req);
 
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_SEND_REQ_FAIL,
                         "failed to send the request");
         }
 
@@ -133,8 +137,9 @@ client_notify_parents_child_up (xlator_t *this)
         conf = this->private;
         ret = client_notify_dispatch (this, GF_EVENT_CHILD_UP, NULL);
         if (ret)
-                gf_log (this->name, GF_LOG_INFO,
-                        "notify of CHILD_UP failed");
+                gf_msg (this->name, GF_LOG_INFO, 0,
+                        PC_MSG_CHILD_UP_NOTIFY_FAILED, "notify of CHILD_UP "
+                        "failed");
 
         return 0;
 }
@@ -173,17 +178,18 @@ client_set_lk_version_cbk (struct rpc_req *req, struct iovec *iov,
         GF_VALIDATE_OR_GOTO ("client", fr, out);
 
         if (req->rpc_status == -1) {
-                gf_log (fr->this->name, GF_LOG_WARNING,
-                        "received RPC status error");
+                gf_msg (fr->this->name, GF_LOG_WARNING, ENOTCONN,
+                        PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
                 goto out;
         }
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_set_lk_ver_rsp);
         if (ret < 0)
-                gf_log (fr->this->name, GF_LOG_WARNING,
-                        "xdr decoding failed");
+                gf_msg (fr->this->name, GF_LOG_WARNING, 0,
+                        PC_MSG_XDR_DECODING_FAILED, "xdr decoding failed");
         else
-                gf_log (fr->this->name, GF_LOG_INFO,
+                gf_msg (fr->this->name, GF_LOG_INFO, 0,
+                        PC_MSG_LOCK_VERSION_SERVER,
                         "Server lk version = %d", rsp.lk_ver);
 
         ret = 0;
@@ -226,7 +232,7 @@ client_set_lk_version (xlator_t *this)
                 goto out;
         }
 
-        gf_log (this->name, GF_LOG_DEBUG, "Sending SET_LK_VERSION");
+        gf_msg_debug (this->name, 0, "Sending SET_LK_VERSION");
 
         ret = client_submit_request (this, &req, frame,
                                      conf->handshake,
@@ -238,7 +244,7 @@ out:
         GF_FREE (req.uid);
         return ret;
 err:
-        gf_log (this->name, GF_LOG_WARNING,
+        gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_SET_LK_VERSION_ERROR,
                 "Failed to send SET_LK_VERSION to server");
 
         return ret;
@@ -461,19 +467,21 @@ client_reacquire_lock_cbk (struct rpc_req *req, struct iovec *iov,
         conf  = (clnt_conf_t *) this->private;
 
         if (req->rpc_status == -1) {
-                gf_log ("client", GF_LOG_WARNING,
+                gf_msg ("client", GF_LOG_WARNING, 0, PC_MSG_CLIENT_REQ_FAIL,
                         "request failed at rpc");
                 goto out;
         }
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lk_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 goto out;
         }
 
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_ERROR, "lock request failed");
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_LOCK_REQ_FAIL,
+                        "lock request failed");
                 ret = -1;
                 goto out;
         }
@@ -482,10 +490,10 @@ client_reacquire_lock_cbk (struct rpc_req *req, struct iovec *iov,
 
         gf_proto_flock_to_flock (&rsp.flock, &lock);
 
-        gf_log (this->name, GF_LOG_DEBUG, "%s type lock reacquired on file "
-                "with gfid %s from %"PRIu64 " to %"PRIu64,
-                get_lk_type (lock.l_type), uuid_utoa (fdctx->gfid),
-                lock.l_start, lock.l_start + lock.l_len);
+        gf_msg_debug (this->name, 0, "%s type lock reacquired on file "
+                      "with gfid %s from %"PRIu64 " to %"PRIu64,
+                      get_lk_type (lock.l_type), uuid_utoa (fdctx->gfid),
+                      lock.l_start, lock.l_start + lock.l_len);
 
         if (!clnt_fd_lk_local_error_status (this, local) &&
             clnt_fd_lk_local_unref (this, local) == 0) {
@@ -531,9 +539,9 @@ _client_reacquire_lock (xlator_t *this, clnt_fd_ctx_t *fdctx)
 
         local = clnt_fd_lk_local_create (fdctx);
         if (!local) {
-                gf_log (this->name, GF_LOG_WARNING, "clnt_fd_lk_local_create "
-                        "failed, aborting reacquring of locks on %s.",
-                        uuid_utoa (fdctx->gfid));
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_LOCK_ERROR,
+                        "clnt_fd_lk_local_create failed, aborting reacquring "
+                        "of locks on %s.", uuid_utoa (fdctx->gfid));
                 clnt_reacquire_lock_error (this, fdctx, conf);
                 goto out;
         }
@@ -546,9 +554,9 @@ _client_reacquire_lock (xlator_t *this, clnt_fd_ctx_t *fdctx)
                 /* to avoid frame being blocked if lock cannot be granted. */
                 ret = client_cmd_to_gf_cmd (F_SETLK, &gf_cmd);
                 if (ret) {
-                        gf_log (this->name, GF_LOG_WARNING,
-                                "client_cmd_to_gf_cmd failed, "
-                                "aborting reacquiring of locks");
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
+                                PC_MSG_LOCK_ERROR, "client_cmd_to_gf_cmd "
+                                "failed, aborting reacquiring of locks");
                         break;
                 }
 
@@ -576,8 +584,9 @@ _client_reacquire_lock (xlator_t *this, clnt_fd_ctx_t *fdctx)
                                              NULL, NULL, 0, NULL, 0, NULL,
                                              (xdrproc_t)xdr_gfs3_lk_req);
                 if (ret) {
-                        gf_log (this->name, GF_LOG_WARNING,
-                                "reacquiring locks failed on file with gfid %s",
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
+                                PC_MSG_LOCK_REACQUIRE, "reacquiring locks "
+                                "failed on file with gfid %s",
                                 uuid_utoa (fdctx->gfid));
                         break;
                 }
@@ -602,8 +611,8 @@ client_reacquire_lock (xlator_t *this, clnt_fd_ctx_t *fdctx)
         GF_VALIDATE_OR_GOTO (this->name, fdctx, out);
 
         if (client_fd_lk_list_empty (fdctx->lk_ctx, _gf_false)) {
-                gf_log (this->name, GF_LOG_DEBUG,
-                        "fd lock list is empty");
+                gf_msg_debug (this->name, 0,
+                              "fd lock list is empty");
                 fdctx->reopen_done (fdctx, this);
         } else {
                 lk_ctx = fdctx->lk_ctx;
@@ -665,7 +674,7 @@ client_child_up_reopen_done (clnt_fd_ctx_t *fdctx, xlator_t *this)
 
         client_reopen_done (fdctx, this);
         if (fd_count == 0) {
-                gf_log (this->name, GF_LOG_INFO,
+                gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_CHILD_UP_NOTIFY,
                         "last fd open'd/lock-self-heal'd - notifying CHILD-UP");
                 client_set_lk_version (this);
                 client_notify_parents_child_up (this);
@@ -692,8 +701,9 @@ client3_3_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
         fdctx = local->fdctx;
 
         if (-1 == req->rpc_status) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "received RPC status error, returning ENOTCONN");
+                gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
+                        PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
+                        "returning ENOTCONN");
                 rsp.op_ret   = -1;
                 rsp.op_errno = ENOTCONN;
                 goto out;
@@ -701,20 +711,21 @@ client3_3_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
         if (ret < 0) {
-                gf_log (frame->this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
         }
 
         if (rsp.op_ret < 0) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "reopen on %s failed (%s)",
+                gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+                        PC_MSG_DIR_OP_SUCCESS, "reopen on %s failed (%s)",
                         local->loc.path, strerror (rsp.op_errno));
         } else {
-                gf_log (frame->this->name, GF_LOG_DEBUG,
-                        "reopen on %s succeeded (remote-fd = %"PRId64")",
-                        local->loc.path, rsp.fd);
+                gf_msg_debug (frame->this->name, 0,
+                              "reopen on %s succeeded (remote-fd = %"PRId64")",
+                              local->loc.path, rsp.fd);
         }
 
         if (rsp.op_ret == -1) {
@@ -741,13 +752,14 @@ client3_3_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
         if (attempt_lock_recovery) {
                 /* Delay decrementing the reopen fd count until all the
                    locks corresponding to this fd are acquired.*/
-                gf_log (this->name, GF_LOG_DEBUG, "acquiring locks "
-                        "on %s", local->loc.path);
+                gf_msg_debug (this->name, 0, "acquiring locks "
+                              "on %s", local->loc.path);
                 ret = client_reacquire_lock (frame->this, local->fdctx);
                 if (ret) {
                         clnt_reacquire_lock_error (this, local->fdctx, conf);
-                        gf_log (this->name, GF_LOG_WARNING, "acquiring locks "
-                                "failed on %s", local->loc.path);
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
+                                PC_MSG_LOCK_ERROR, "acquiring locks failed "
+                                "on %s", local->loc.path);
                 }
         }
 
@@ -781,8 +793,9 @@ client3_3_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 
         if (-1 == req->rpc_status) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "received RPC status error, returning ENOTCONN");
+                gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
+                        PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
+                        "returning ENOTCONN");
                 rsp.op_ret   = -1;
                 rsp.op_errno = ENOTCONN;
                 goto out;
@@ -790,20 +803,21 @@ client3_3_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp);
         if (ret < 0) {
-                gf_log (frame->this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
         }
 
         if (rsp.op_ret < 0) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "reopendir on %s failed (%s)",
+                gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+                        PC_MSG_DIR_OP_FAILED, "reopendir on %s failed (%s)",
                         local->loc.path, strerror (rsp.op_errno));
         } else {
-                gf_log (frame->this->name, GF_LOG_INFO,
-                        "reopendir on %s succeeded (fd = %"PRId64")",
-                        local->loc.path, rsp.fd);
+                gf_msg (frame->this->name, GF_LOG_INFO, 0,
+                        PC_MSG_DIR_OP_SUCCESS, "reopendir on %s succeeded "
+                        "(fd = %"PRId64")", local->loc.path, rsp.fd);
         }
 
         if (-1 == rsp.op_ret) {
@@ -858,8 +872,8 @@ protocol_client_reopendir (clnt_fd_ctx_t *fdctx, xlator_t *this)
 
         memcpy (req.gfid, fdctx->gfid, 16);
 
-        gf_log (frame->this->name, GF_LOG_DEBUG,
-                "attempting reopen on %s", local->loc.path);
+        gf_msg_debug (frame->this->name, 0,
+                      "attempting reopen on %s", local->loc.path);
 
         frame->local = local;
 
@@ -869,7 +883,7 @@ protocol_client_reopendir (clnt_fd_ctx_t *fdctx, xlator_t *this)
                                      NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_opendir_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
                         "failed to send the re-opendir request");
         }
 
@@ -920,15 +934,15 @@ protocol_client_reopenfile (clnt_fd_ctx_t *fdctx, xlator_t *this)
         req.flags    = gf_flags_from_flags (fdctx->flags);
         req.flags    = req.flags & (~(O_TRUNC|O_CREAT|O_EXCL));
 
-        gf_log (frame->this->name, GF_LOG_DEBUG,
-                "attempting reopen on %s", local->loc.path);
+        gf_msg_debug (frame->this->name, 0,
+                      "attempting reopen on %s", local->loc.path);
 
         ret = client_submit_request (this, &req, frame, conf->fops,
                                      GFS3_OP_OPEN, client3_3_reopen_cbk, NULL,
                                      NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_open_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DIR_OP_FAILED,
                         "failed to send the re-open request");
         }
 
@@ -1037,9 +1051,9 @@ client_post_handshake (call_frame_t *frame, xlator_t *this)
         /* Delay notifying CHILD_UP to parents
            until all locks are recovered */
         if (count > 0) {
-                gf_log (this->name, GF_LOG_INFO,
-                        "%d fds open - Delaying child_up until they are re-opened",
-                        count);
+                gf_msg (this->name, GF_LOG_INFO, 0,
+                        PC_MSG_CHILD_UP_NOTIFY_DELAY, "%d fds open - Delaying "
+                        "child_up until they are re-opened", count);
                 client_save_number_fds (conf, count);
 
                 list_for_each_entry_safe (fdctx, tmp, &reopen_head, sfd_pos) {
@@ -1048,8 +1062,9 @@ client_post_handshake (call_frame_t *frame, xlator_t *this)
                         protocol_client_reopen (fdctx, this);
                 }
         } else {
-                gf_log (this->name, GF_LOG_DEBUG,
-                        "No fds to open - notifying all parents child up");
+                gf_msg_debug (this->name, 0,
+                              "No fds to open - notifying all parents child "
+                              "up");
                 client_set_lk_version (this);
                 client_notify_parents_child_up (this);
         }
@@ -1079,23 +1094,24 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
         conf  = this->private;
 
         if (-1 == req->rpc_status) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "received RPC status error");
+                gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
+                        PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
                 op_ret = -1;
                 goto out;
         }
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_setvolume_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 op_ret = -1;
                 goto out;
         }
         op_ret   = rsp.op_ret;
         op_errno = gf_error_to_errno (rsp.op_errno);
         if (-1 == rsp.op_ret) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "failed to set the volume (%s)",
+                gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+                        PC_MSG_VOL_SET_FAIL, "failed to set the volume (%s)",
                         (op_errno)? strerror (op_errno) : "--");
         }
 
@@ -1107,26 +1123,29 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
                 ret = dict_unserialize (rsp.dict.dict_val,
                                         rsp.dict.dict_len, &reply);
                 if (ret < 0) {
-                        gf_log (frame->this->name, GF_LOG_WARNING,
-                                "failed to unserialize buffer to dict");
+                        gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+                                PC_MSG_DICT_UNSERIALIZE_FAIL, "failed to "
+                                "unserialize buffer to dict");
                         goto out;
                 }
         }
 
         ret = dict_get_str (reply, "ERROR", &remote_error);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "failed to get ERROR string from reply dict");
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+                        PC_MSG_DICT_GET_FAILED, "failed to get ERROR "
+                        "string from reply dict");
         }
 
         ret = dict_get_str (reply, "process-uuid", &process_uuid);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "failed to get 'process-uuid' from reply dict");
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+                        PC_MSG_DICT_GET_FAILED, "failed to get "
+                        "'process-uuid' from reply dict");
         }
 
         if (op_ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_SETVOLUME_FAIL,
                         "SETVOLUME on remote-host failed: %s",
                         remote_error ? remote_error : strerror (op_errno));
                 errno = op_errno;
@@ -1140,7 +1159,8 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
                                                       GF_EVENT_VOLFILE_MODIFIED,
                                                       NULL);
                         if (ret)
-                                gf_log (this->name, GF_LOG_INFO,
+                                gf_msg (this->name, GF_LOG_INFO, 0,
+                                        PC_MSG_VOLFILE_NOTIFY_FAILED,
                                         "notify of VOLFILE_MODIFIED failed");
                 }
                 goto out;
@@ -1149,20 +1169,21 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
         ret = dict_get_str (this->options, "remote-subvolume",
                             &remote_subvol);
         if (ret || !remote_subvol) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
                         "failed to find key 'remote-subvolume' in the options");
                 goto out;
         }
 
         ret = dict_get_uint32 (reply, "clnt-lk-version", &lk_ver);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_GET_FAILED,
                         "failed to find key 'clnt-lk-version' in the options");
                 goto out;
         }
 
-        gf_log (this->name, GF_LOG_DEBUG, "clnt-lk-version = %d, "
-                "server-lk-version = %d", client_get_lk_ver (conf), lk_ver);
+        gf_msg_debug (this->name, 0, "clnt-lk-version = %d, "
+                      "server-lk-version = %d", client_get_lk_ver (conf),
+                      lk_ver);
         /* TODO: currently setpeer path is broken */
         /*
         if (process_uuid && req->conn &&
@@ -1187,7 +1208,7 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
 
         conf->client_id = glusterfs_leaf_position(this);
 
-        gf_log (this->name, GF_LOG_INFO,
+        gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_REMOTE_VOL_CONNECTED,
                 "Connected to %s, attached to remote volume '%s'.",
                 conf->rpc->conn.name,
                 remote_subvol);
@@ -1199,27 +1220,30 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m
         conf->connected = 1;
 
         if (lk_ver != client_get_lk_ver (conf)) {
-                gf_log (this->name, GF_LOG_INFO, "Server and Client "
-                        "lk-version numbers are not same, reopening the fds");
+                gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_LOCK_MISMATCH,
+                        "Server and Client lk-version numbers are not same, "
+                        "reopening the fds");
                 client_mark_fd_bad (this);
                 client_post_handshake (frame, frame->this);
         } else {
                 /*TODO: Traverse the saved fd list, and send
                   release to the server on fd's that were closed
                   during grace period */
-                gf_log (this->name, GF_LOG_INFO, "Server and Client "
-                        "lk-version numbers are same, no need to "
-                        "reopen the fds");
+                gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_LOCK_MATCH,
+                        "Server and Client lk-version numbers are same, no "
+                        "need to reopen the fds");
                 client_notify_parents_child_up (frame->this);
         }
 
 out:
         if (auth_fail) {
-                gf_log (this->name, GF_LOG_INFO, "sending AUTH_FAILED event");
+                gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_AUTH_FAILED,
+                        "sending AUTH_FAILED event");
                 ret = client_notify_dispatch (this, GF_EVENT_AUTH_FAILED, NULL);
                 if (ret)
-                        gf_log (this->name, GF_LOG_INFO,
-                                "notify of AUTH_FAILED failed");
+                        gf_msg (this->name, GF_LOG_INFO, 0,
+                                PC_MSG_AUTH_FAILED_NOTIFY_FAILED, "notify of "
+                                "AUTH_FAILED failed");
                 conf->connecting = 0;
                 conf->connected = 0;
                 ret = -1;
@@ -1229,11 +1253,14 @@ out:
                  * background, for now, don't hang here,
                  * tell the parents that i am all ok..
                  */
-                gf_log (this->name, GF_LOG_INFO, "sending CHILD_CONNECTING event");
+                gf_msg (this->name, GF_LOG_INFO, 0,
+                        PC_MSG_CHILD_CONNECTING_EVENT, "sending "
+                        "CHILD_CONNECTING event");
                 ret = client_notify_dispatch (this, GF_EVENT_CHILD_CONNECTING,
                                               NULL);
                 if (ret)
-                        gf_log (this->name, GF_LOG_INFO,
+                        gf_msg (this->name, GF_LOG_INFO, 0,
+                                PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED,
                                 "notify of CHILD_CONNECTING failed");
                 conf->connecting= 1;
                 ret = 0;
@@ -1267,8 +1294,9 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
                 ret = dict_set_int32 (options, "fops-version",
                                       conf->fops->prognum);
                 if (ret < 0) {
-                        gf_log (this->name, GF_LOG_ERROR,
-                                "failed to set version-fops(%d) in handshake msg",
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                PC_MSG_DICT_SET_FAILED, "failed to set "
+                                "version-fops(%d) in handshake msg",
                                 conf->fops->prognum);
                         goto fail;
                 }
@@ -1277,8 +1305,9 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
         if (conf->mgmt) {
                 ret = dict_set_int32 (options, "mgmt-version", conf->mgmt->prognum);
                 if (ret < 0) {
-                        gf_log (this->name, GF_LOG_ERROR,
-                                "failed to set version-mgmt(%d) in handshake msg",
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                PC_MSG_DICT_SET_FAILED, "failed to set "
+                                "version-mgmt(%d) in handshake msg",
                                 conf->mgmt->prognum);
                         goto fail;
                 }
@@ -1303,14 +1332,15 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
                            this->ctx->process_uuid, this->name,
                            this->graph->id, counter_str);
         if (-1 == ret) {
-                gf_log (this->name, GF_LOG_ERROR,
-                        "asprintf failed while setting process_uuid");
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        PC_MSG_PROCESS_UUID_SET_FAIL, "asprintf failed while "
+                        "setting process_uuid");
                 goto fail;
         }
 
         ret = dict_set_dynstr (options, "process-uuid", process_uuid_xl);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
                         "failed to set process-uuid(%s) in handshake msg",
                         process_uuid_xl);
                 goto fail;
@@ -1318,7 +1348,7 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
 
         ret = dict_set_str (options, "client-version", PACKAGE_VERSION);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
                         "failed to set client-version(%s) in handshake msg",
                         PACKAGE_VERSION);
         }
@@ -1328,27 +1358,29 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
                         ret = dict_set_str (options, "volfile-key",
                                             this->ctx->cmd_args.volfile_id);
                         if (ret)
-                                gf_log (this->name, GF_LOG_ERROR,
-                                        "failed to set 'volfile-key'");
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
+                                        PC_MSG_DICT_SET_FAILED, "failed to "
+                                        "set 'volfile-key'");
                 }
                 ret = dict_set_uint32 (options, "volfile-checksum",
                                        this->graph->volfile_checksum);
                 if (ret)
-                        gf_log (this->name, GF_LOG_ERROR,
-                                "failed to set 'volfile-checksum'");
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                PC_MSG_DICT_SET_FAILED, "failed to set "
+                                "'volfile-checksum'");
         }
 
         ret = dict_set_int16 (options, "clnt-lk-version",
                               client_get_lk_ver (conf));
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "failed to set clnt-lk-version(%"PRIu32") in handshake msg",
-                        client_get_lk_ver (conf));
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
+                        "failed to set clnt-lk-version(%"PRIu32") in handshake "
+                        "msg", client_get_lk_ver (conf));
         }
 
         ret = dict_serialized_length (options);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_ERROR,
                         "failed to get serialized length of dict");
                 ret = -1;
                 goto fail;
@@ -1358,8 +1390,9 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
                                        gf_client_mt_clnt_req_buf_t);
         ret = dict_serialize (options, req.dict.dict_val);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR,
-                        "failed to serialize dictionary");
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        PC_MSG_DICT_SERIALIZE_FAIL, "failed to serialize "
+                        "dictionary");
                 goto fail;
         }
 
@@ -1386,7 +1419,7 @@ select_server_supported_programs (xlator_t *this, gf_prog_detail *prog)
         int             ret      = -1;
 
         if (!this || !prog) {
-                gf_log (THIS->name, GF_LOG_WARNING,
+                gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
                         "xlator not found OR RPC program not found");
                 goto out;
         }
@@ -1399,16 +1432,16 @@ select_server_supported_programs (xlator_t *this, gf_prog_detail *prog)
                 if ((clnt3_3_fop_prog.prognum == trav->prognum) &&
                     (clnt3_3_fop_prog.progver == trav->progver)) {
                         conf->fops = &clnt3_3_fop_prog;
-                        gf_log (this->name, GF_LOG_INFO,
-                                "Using Program %s, Num (%"PRId64"), "
-                                "Version (%"PRId64")",
+                        gf_msg (this->name, GF_LOG_INFO, 0,
+                                PC_MSG_VERSION_INFO, "Using Program %s, "
+                                "Num (%"PRId64"), Version (%"PRId64")",
                                 trav->progname, trav->prognum, trav->progver);
                         ret = 0;
                 }
                 if (ret) {
-                        gf_log (this->name, GF_LOG_TRACE,
-                                "%s (%"PRId64") not supported", trav->progname,
-                                trav->progver);
+                        gf_msg_trace (this->name, 0,
+                                      "%s (%"PRId64") not supported",
+                                      trav->progname, trav->progver);
                 }
                 trav = trav->next;
         }
@@ -1425,7 +1458,7 @@ server_has_portmap (xlator_t *this, gf_prog_detail *prog)
         int             ret      = -1;
 
         if (!this || !prog) {
-                gf_log (THIS->name, GF_LOG_WARNING,
+                gf_msg (THIS->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
                         "xlator not found OR RPC program not found");
                 goto out;
         }
@@ -1435,8 +1468,8 @@ server_has_portmap (xlator_t *this, gf_prog_detail *prog)
         while (trav) {
                 if ((trav->prognum == GLUSTER_PMAP_PROGRAM) &&
                     (trav->progver == GLUSTER_PMAP_VERSION)) {
-                        gf_log (this->name, GF_LOG_DEBUG,
-                                "detected portmapper on server");
+                        gf_msg_debug (this->name, 0,
+                                      "detected portmapper on server");
                         ret = 0;
                         break;
                 }
@@ -1460,32 +1493,43 @@ client_query_portmap_cbk (struct rpc_req *req, struct iovec *iov, int count, voi
 
         frame = myframe;
         if (!frame || !frame->this || !frame->this->private) {
-                gf_log (THIS->name, GF_LOG_WARNING,
-                        "frame not found with rpc request");
+                gf_msg (THIS->name, GF_LOG_WARNING, EINVAL,
+                        PC_MSG_INVALID_ENTRY, "frame not found with rpc "
+                        "request");
                 goto out;
         }
         this  = frame->this;
         conf  = frame->this->private;
 
         if (-1 == req->rpc_status) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "received RPC status error, try again later");
+                gf_msg (this->name, GF_LOG_WARNING, ENOTCONN,
+                        PC_MSG_RPC_STATUS_ERROR, "received RPC status error, "
+                        "try again later");
                 goto out;
         }
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_pmap_port_by_brick_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 goto out;
         }
 
         if (-1 == rsp.op_ret) {
                 ret = -1;
-                gf_log (this->name, ((!conf->portmap_err_logged) ?
-                                     GF_LOG_ERROR : GF_LOG_DEBUG),
-                        "failed to get the port number for remote subvolume. "
-                        "Please run 'gluster volume status' on server to see "
-                        "if brick process is running.");
+                if (!conf->portmap_err_logged) {
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                PC_MSG_PORT_NUM_ERROR, "failed to get the "
+                                "port number for remote subvolume. Please run "
+                                "'gluster volume status' on server to see if "
+                                "brick process is running.");
+                } else {
+                        gf_msg_debug (this->name, 0,
+                                      "failed to get the port number for "
+                                      "remote subvolume. Please run 'gluster "
+                                      "volume status' on server to see "
+                                      "if brick process is running.");
+                }
                 conf->portmap_err_logged = 1;
                 goto out;
         }
@@ -1529,7 +1573,7 @@ client_query_portmap (xlator_t *this, struct rpc_clnt *rpc)
 
         ret = dict_get_str (options, "remote-subvolume", &remote_subvol);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_VOL_SET_FAIL,
                         "remote-subvolume not set in volfile");
                 goto fail;
         }
@@ -1576,19 +1620,21 @@ client_dump_version_cbk (struct rpc_req *req, struct iovec *iov, int count,
         conf  = frame->this->private;
 
         if (-1 == req->rpc_status) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "received RPC status error");
+                gf_msg (frame->this->name, GF_LOG_WARNING, ENOTCONN,
+                        PC_MSG_RPC_STATUS_ERROR, "received RPC status error");
                 goto out;
         }
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_dump_rsp);
         if (ret < 0) {
-                gf_log (frame->this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (frame->this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 goto out;
         }
         if (-1 == rsp.op_ret) {
-                gf_log (frame->this->name, GF_LOG_WARNING,
-                        "failed to get the 'versions' from server");
+                gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+                        PC_MSG_VERSION_ERROR, "failed to get the 'versions' "
+                        "from server");
                 goto out;
         }
 
@@ -1601,8 +1647,9 @@ client_dump_version_cbk (struct rpc_req *req, struct iovec *iov, int count,
         /* Reply in "Name:Program-Number:Program-Version,..." format */
         ret = select_server_supported_programs (frame->this, rsp.prog);
         if (ret) {
-                gf_log (frame->this->name, GF_LOG_ERROR,
-                        "server doesn't support the version");
+                gf_msg (frame->this->name, GF_LOG_ERROR, 0,
+                        PC_MSG_VERSION_ERROR, "server doesn't support the "
+                        "version");
                 goto out;
         }
 
@@ -1638,7 +1685,8 @@ client_handshake (xlator_t *this, struct rpc_clnt *rpc)
 
         conf = this->private;
         if (!conf->handshake) {
-                gf_log (this->name, GF_LOG_WARNING, "handshake program not found");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_PGM_NOT_FOUND,
+                        "handshake program not found");
                 goto out;
         }
 
diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c
index be5e7b5..62fbc6c 100644
--- a/xlators/protocol/client/src/client-helpers.c
+++ b/xlators/protocol/client/src/client-helpers.c
@@ -15,6 +15,7 @@
 
 #include "client.h"
 #include "fd.h"
+#include "client-messages.h"
 
 int
 client_fd_lk_list_empty (fd_lk_ctx_t *lk_ctx, gf_boolean_t try_lock)
@@ -94,22 +95,26 @@ this_fd_set_ctx (fd_t *file, xlator_t *this, loc_t *loc, clnt_fd_ctx_t *ctx)
         ret = fd_ctx_get (file, this, &oldaddr);
         if (ret >= 0) {
                 if (loc)
-                        gf_log (this->name, GF_LOG_INFO,
+                        gf_msg (this->name, GF_LOG_INFO, 0,
+                                PC_MSG_FD_DUPLICATE_TRY,
                                 "%s (%s): trying duplicate remote fd set. ",
                                 loc->path, uuid_utoa (loc->inode->gfid));
                 else
-                        gf_log (this->name, GF_LOG_INFO,
+                        gf_msg (this->name, GF_LOG_INFO, 0,
+                                PC_MSG_FD_DUPLICATE_TRY,
                                 "%p: trying duplicate remote fd set. ", file);
         }
 
         ret = fd_ctx_set (file, this, (uint64_t)(unsigned long)ctx);
         if (ret < 0) {
                 if (loc)
-                        gf_log (this->name, GF_LOG_WARNING,
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
+                                PC_MSG_FD_SET_FAIL,
                                 "%s (%s): failed to set remote fd",
                                 loc->path, uuid_utoa (loc->inode->gfid));
                 else
-                        gf_log (this->name, GF_LOG_WARNING,
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
+                                PC_MSG_FD_SET_FAIL,
                                 "%p: failed to set remote fd", file);
         }
 out:
@@ -225,9 +230,9 @@ unserialize_rsp_direntp (xlator_t *this, fd_t *fd,
                         ret = dict_unserialize (buf, trav->dict.dict_len,
                                                 &entry->dict);
                         if (ret < 0) {
-                                gf_log (THIS->name, GF_LOG_WARNING,
+                                gf_msg (THIS->name, GF_LOG_WARNING, EINVAL,
+                                        PC_MSG_DICT_UNSERIALIZE_FAIL,
                                         "failed to unserialize xattr dict");
-                                errno = EINVAL;
                                 goto out;
                         }
                         entry->dict->extra_free = buf;
diff --git a/xlators/protocol/client/src/client-lk.c b/xlators/protocol/client/src/client-lk.c
index b3c36a4..0cf2be3 100644
--- a/xlators/protocol/client/src/client-lk.c
+++ b/xlators/protocol/client/src/client-lk.c
@@ -12,6 +12,7 @@
 #include "xlator.h"
 #include "client.h"
 #include "lkowner.h"
+#include "client-messages.h"
 
 static void
 __insert_and_merge (clnt_fd_ctx_t *fdctx, client_posix_lock_t *lock);
@@ -23,7 +24,7 @@ __dump_client_lock (client_posix_lock_t *lock)
 
         this = THIS;
 
-        gf_log (this->name, GF_LOG_INFO,
+        gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_CLIENT_LOCK_INFO,
                 "{fd=%p}"
                 "{%s lk-owner:%s %"PRId64" - %"PRId64"}"
                 "{start=%"PRId64" end=%"PRId64"}",
@@ -225,7 +226,8 @@ subtract_locks (client_posix_lock_t *big, client_posix_lock_t *small)
 	}
         else {
                 /* LOG-TODO : decide what more info is required here*/
-                gf_log ("client-protocol", GF_LOG_CRITICAL,
+                gf_msg ("client-protocol", GF_LOG_CRITICAL, 0,
+                        PC_MSG_LOCK_ERROR,
                         "Unexpected case in subtract_locks. Please send "
                         "a bug report to gluster-devel@gluster.org");
         }
@@ -363,8 +365,8 @@ delete_granted_locks_owner (fd_t *fd, gf_lkowner_t *owner)
         this = THIS;
         fdctx = this_fd_get_ctx (fd, this);
         if (!fdctx) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "fdctx not valid");
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+                        PC_MSG_FD_CTX_INVALID, "fdctx not valid");
                 ret = -1;
                 goto out;
         }
@@ -387,8 +389,8 @@ delete_granted_locks_owner (fd_t *fd, gf_lkowner_t *owner)
         }
 
         /* FIXME: Need to actually print the locks instead of count */
-        gf_log (this->name, GF_LOG_TRACE,
-                "Number of locks cleared=%d", count);
+        gf_msg_trace (this->name, 0,
+                      "Number of locks cleared=%d", count);
 
 out:
         return ret;
@@ -421,8 +423,8 @@ delete_granted_locks_fd (clnt_fd_ctx_t *fdctx)
         }
 
         /* FIXME: Need to actually print the locks instead of count */
-        gf_log (this->name, GF_LOG_TRACE,
-                "Number of locks cleared=%d", count);
+        gf_msg_trace (this->name, 0,
+                      "Number of locks cleared=%d", count);
 
         return  ret;
 }
@@ -516,7 +518,7 @@ client_add_lock_for_recovery (fd_t *fd, struct gf_flock *flock,
         pthread_mutex_unlock (&conf->lock);
 
         if (!fdctx) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FD_GET_FAIL,
                         "failed to get fd context. sending EBADFD");
                 ret = -EBADFD;
                 goto out;
@@ -551,7 +553,8 @@ client_dump_locks (char *name, inode_t *inode,
 
         ret = dict_set_dynstr(new_dict, CLIENT_DUMP_LOCKS, dict_string);
         if (ret) {
-                gf_log (THIS->name, GF_LOG_WARNING,
+                gf_msg (THIS->name, GF_LOG_WARNING, 0,
+                        PC_MSG_DICT_SET_FAILED,
                         "could not set dict with %s", CLIENT_DUMP_LOCKS);
                 goto out;
         }
diff --git a/xlators/protocol/client/src/client-messages.h b/xlators/protocol/client/src/client-messages.h
new file mode 100644
index 0000000..9239176
--- /dev/null
+++ b/xlators/protocol/client/src/client-messages.h
@@ -0,0 +1,624 @@
+/*
+  Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+  This file is part of GlusterFS.
+
+  This file is licensed to you under your choice of the GNU Lesser
+  General Public License, version 3 or any later version (LGPLv3 or
+  later), or the GNU General Public License, version 2 (GPLv2), in all
+  cases as published by the Free Software Foundation.
+*/
+
+#ifndef _PC_MESSAGES_H__
+#define _PC_MESSAGES_H_
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#include "glfs-message-id.h"
+
+/*! \file client-messages.h
+ *  \brief Protocol client log-message IDs and their descriptions
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ *    if the message format is the same. Reasoning is that, if the message
+ *    format needs to change in one instance, the other instances are not
+ *    impacted or the new change does not change the ID of the instance being
+ *    modified.
+ * 2) Addition of a message,
+ *       - Should increment the GLFS_NUM_MESSAGES
+ *       - Append to the list of messages defined, towards the end
+ *       - Retain macro naming as glfs_msg_X (for readability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ *    anywhere. If reused then then the modifications should ensure correctness
+ *    everywhere, or needs a new message ID as (1) above was not adhered to. If
+ *    not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ *    anywhere, then can be deleted, but will leave a hole by design, as
+ *    addition rules specify modification to the end of the list and not filling
+ *    holes.
+ */
+
+#define GLFS_PC_BASE                GLFS_MSGID_COMP_PC
+#define GLFS_PC_NUM_MESSAGES        63
+#define GLFS_PC_MSGID_END           (GLFS_PC_BASE + GLFS_NUM_MESSAGES + 1)
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_PC_BASE, "Invalid: Start of messages"
+/*------------*/
+
+#define PC_MSG_TIMER_EXPIRED                    (GLFS_PC_BASE + 1)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_DIR_OP_FAILED                    (GLFS_PC_BASE + 2)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_FILE_OP_FAILED                   (GLFS_PC_BASE + 3)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_TIMER_REG                        (GLFS_PC_BASE + 4)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_GRACE_TIMER_CANCELLED            (GLFS_PC_BASE + 5)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_DICT_SET_FAILED                  (GLFS_PC_BASE + 6)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_DICT_GET_FAILED                  (GLFS_PC_BASE + 7)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_NO_MEMORY                        (GLFS_PC_BASE + 8)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_RPC_CBK_FAILED                   (GLFS_PC_BASE + 9)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_FUNCTION_CALL_ERROR              (GLFS_PC_BASE + 10)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_RPC_INITED_ALREADY               (GLFS_PC_BASE + 11)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_RPC_INIT                         (GLFS_PC_BASE + 12)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_RPC_DESTROY                      (GLFS_PC_BASE + 13)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_RPC_INVALID_CALL                 (GLFS_PC_BASE + 14)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_INVALID_ENTRY                    (GLFS_PC_BASE + 15)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_HANDSHAKE_RETURN                 (GLFS_PC_BASE + 16)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_CHILD_UP_NOTIFY_FAILED           (GLFS_PC_BASE + 17)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_CLIENT_DISCONNECTED              (GLFS_PC_BASE + 18)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_CHILD_DOWN_NOTIFY_FAILED         (GLFS_PC_BASE + 19)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_PARENT_UP                        (GLFS_PC_BASE + 20)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_PARENT_DOWN                      (GLFS_PC_BASE + 21)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_RPC_INIT_FAILED                  (GLFS_PC_BASE + 22)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_RPC_NOTIFY_FAILED                (GLFS_PC_BASE + 23)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_FD_DUPLICATE_TRY                 (GLFS_PC_BASE + 24)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_FD_SET_FAIL                      (GLFS_PC_BASE + 25)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_DICT_UNSERIALIZE_FAIL            (GLFS_PC_BASE + 26)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_FD_GET_FAIL                      (GLFS_PC_BASE + 27)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_FD_CTX_INVALID                   (GLFS_PC_BASE + 28)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_FOP_SEND_FAILED                  (GLFS_PC_BASE + 29)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_XDR_DECODING_FAILED              (GLFS_PC_BASE + 30)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_REMOTE_OP_FAILED                 (GLFS_PC_BASE + 31)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_RPC_STATUS_ERROR                 (GLFS_PC_BASE + 32)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_VOL_FILE_NOT_FOUND               (GLFS_PC_BASE + 33)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_SEND_REQ_FAIL                    (GLFS_PC_BASE + 34)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_LOCK_VERSION_SERVER              (GLFS_PC_BASE + 35)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_SET_LK_VERSION_ERROR             (GLFS_PC_BASE + 36)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_LOCK_REQ_FAIL                    (GLFS_PC_BASE + 37)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_CLIENT_REQ_FAIL                  (GLFS_PC_BASE + 38)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_LOCK_ERROR                       (GLFS_PC_BASE + 39)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_LOCK_REACQUIRE                   (GLFS_PC_BASE + 40)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_CHILD_UP_NOTIFY                  (GLFS_PC_BASE + 41)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_CHILD_UP_NOTIFY_DELAY            (GLFS_PC_BASE + 42)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_VOL_SET_FAIL                     (GLFS_PC_BASE + 43)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_SETVOLUME_FAIL                   (GLFS_PC_BASE + 44)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_VOLFILE_NOTIFY_FAILED            (GLFS_PC_BASE + 45)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_REMOTE_VOL_CONNECTED             (GLFS_PC_BASE + 46)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_LOCK_MISMATCH                    (GLFS_PC_BASE + 47)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_LOCK_MATCH                       (GLFS_PC_BASE + 48)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_AUTH_FAILED                      (GLFS_PC_BASE + 49)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_AUTH_FAILED_NOTIFY_FAILED        (GLFS_PC_BASE + 50)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_CHILD_CONNECTING_EVENT           (GLFS_PC_BASE + 51)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_CHILD_CONNECTING_NOTIFY_FAILED   (GLFS_PC_BASE + 52)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_PROCESS_UUID_SET_FAIL            (GLFS_PC_BASE + 53)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_DICT_ERROR                       (GLFS_PC_BASE + 54)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_DICT_SERIALIZE_FAIL              (GLFS_PC_BASE + 55)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_PGM_NOT_FOUND                    (GLFS_PC_BASE + 56)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_VERSION_INFO                     (GLFS_PC_BASE + 57)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_PORT_NUM_ERROR                   (GLFS_PC_BASE + 58)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_VERSION_ERROR                    (GLFS_PC_BASE + 59)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_DIR_OP_SUCCESS                   (GLFS_PC_BASE + 60)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_BAD_FD                           (GLFS_PC_BASE + 61)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_CLIENT_LOCK_INFO                 (GLFS_PC_BASE + 62)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PC_MSG_CACHE_INVALIDATION_FAIL          (GLFS_PC_BASE + 63)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+#endif /* !_PC_MESSAGES_H_ */
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index e8e3cdf..223a60d 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -18,6 +18,7 @@
 #include "glusterfs3-xdr.h"
 #include "glusterfs3.h"
 #include "compat-errno.h"
+#include "client-messages.h"
 
 int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data);
 rpc_clnt_prog_t clnt3_3_fop_prog;
@@ -56,16 +57,18 @@ client_submit_vec_request (xlator_t  *this, void *req, call_frame_t  *frame,
                 if (iobref != NULL) {
                         ret = iobref_merge (new_iobref, iobref);
                         if (ret != 0) {
-                                gf_log (this->name, GF_LOG_WARNING,
-                                        "cannot merge iobref passed from caller "
-                                        "into new_iobref");
+                                gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
+                                        PC_MSG_NO_MEMORY, "cannot merge "
+                                        "iobref passed from caller into "
+                                        "new_iobref");
                         }
                 }
 
                 ret = iobref_add (new_iobref, iobuf);
                 if (ret != 0) {
-                        gf_log (this->name, GF_LOG_WARNING,
-                                "cannot add iobuf into iobref");
+                        gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
+                                PC_MSG_NO_MEMORY, "cannot add iobuf into "
+                                "iobref");
                         goto unwind;
                 }
 
@@ -89,7 +92,7 @@ client_submit_vec_request (xlator_t  *this, void *req, call_frame_t  *frame,
                                payload, payloadcnt, new_iobref, frame, NULL, 0,
                                NULL, 0, NULL);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_DEBUG, "rpc_clnt_submit failed");
+                gf_msg_debug (this->name, 0, "rpc_clnt_submit failed");
         }
 
         if (new_iobref)
@@ -144,7 +147,8 @@ client3_3_symlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_symlink_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -167,7 +171,8 @@ out:
                         /* no need to print the gfid, because it will be null,
                          * since symlink operation failed.
                          */
-                        gf_log (this->name, GF_LOG_WARNING,
+                        gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                                PC_MSG_REMOTE_OP_FAILED,
                                 "remote operation failed: %s. Path: (%s to %s)",
                                 strerror (gf_error_to_errno (rsp.op_errno)),
                                 local->loc.path, local->loc2.path);
@@ -217,7 +222,8 @@ client3_3_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_mknod_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -237,8 +243,9 @@ client3_3_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count,
 out:
         if (rsp.op_ret == -1 &&
             GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
-                gf_log (this->name, fop_log_level (GF_FOP_MKNOD,
+                gf_msg (this->name, fop_log_level (GF_FOP_MKNOD,
                         gf_error_to_errno (rsp.op_errno)),
+                        rsp.op_errno, PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s. Path: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)),
                         local->loc.path);
@@ -285,7 +292,8 @@ client3_3_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_mkdir_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -305,8 +313,9 @@ client3_3_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
 out:
         if (rsp.op_ret == -1 &&
             GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
-                gf_log (this->name, fop_log_level (GF_FOP_MKDIR,
-                        gf_error_to_errno (rsp.op_errno)),
+                gf_msg (this->name, fop_log_level (GF_FOP_MKDIR,
+                        gf_error_to_errno (rsp.op_errno)), rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s. Path: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)),
                         local->loc.path);
@@ -426,7 +435,8 @@ client3_3_open_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -448,8 +458,9 @@ client3_3_open_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, fop_log_level (GF_FOP_OPEN,
-                                        gf_error_to_errno (rsp.op_errno)),
+                gf_msg (this->name, fop_log_level (GF_FOP_OPEN,
+                        gf_error_to_errno (rsp.op_errno)),
+                        rsp.op_errno, PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s. Path: %s (%s)",
                         strerror (gf_error_to_errno (rsp.op_errno)),
                         local->loc.path, loc_gfid_utoa (&local->loc));
@@ -489,7 +500,8 @@ client3_3_stat_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_stat_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -507,10 +519,17 @@ out:
         if (rsp.op_ret == -1) {
                 /* stale filehandles are possible during normal operations, no
                  * need to spam the logs with these */
-                gf_log (this->name,
-                        rsp.op_errno == ESTALE ? GF_LOG_DEBUG : GF_LOG_WARNING,
-                        "remote operation failed: %s",
-                        strerror (gf_error_to_errno (rsp.op_errno)));
+                if (rsp.op_errno == ESTALE) {
+                        gf_msg_debug (this->name, 0,
+                                      "remote operation failed: %s",
+                                      strerror (gf_error_to_errno
+                                                (rsp.op_errno)));
+                } else {
+                        gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                                PC_MSG_REMOTE_OP_FAILED,
+                                "remote operation failed: %s",
+                                strerror (gf_error_to_errno (rsp.op_errno)));
+                }
         }
 
         CLIENT_STACK_UNWIND (stat, frame, rsp.op_ret,
@@ -547,7 +566,8 @@ client3_3_readlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readlink_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -563,9 +583,16 @@ client3_3_readlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, (gf_error_to_errno(rsp.op_errno) == ENOENT)?
-                        GF_LOG_DEBUG:GF_LOG_WARNING, "remote operation failed:"
-                        " %s", strerror (gf_error_to_errno (rsp.op_errno)));
+                if (gf_error_to_errno(rsp.op_errno) == ENOENT) {
+                        gf_msg_debug (this->name, 0, "remote operation failed:"
+                                      " %s", strerror
+                                          (gf_error_to_errno (rsp.op_errno)));
+                } else {
+                        gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                                PC_MSG_REMOTE_OP_FAILED, "remote operation "
+                                "failed: %s", strerror
+                                           (gf_error_to_errno (rsp.op_errno)));
+                }
         }
 
         CLIENT_STACK_UNWIND (readlink, frame, rsp.op_ret,
@@ -608,7 +635,8 @@ client3_3_unlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_unlink_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -625,11 +653,17 @@ client3_3_unlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name,
-                        ((gf_error_to_errno (rsp.op_errno) == ENOENT)
-                        ? GF_LOG_DEBUG : GF_LOG_WARNING),
-                        "remote operation failed: %s",
-                        strerror (gf_error_to_errno (rsp.op_errno)));
+                if (gf_error_to_errno(rsp.op_errno) == ENOENT) {
+                        gf_msg_debug (this->name, 0, "remote operation failed:"
+                                      " %s", strerror
+                                      (gf_error_to_errno (rsp.op_errno)));
+                } else {
+                        gf_msg (this->name, GF_LOG_WARNING,
+                                rsp.op_errno,
+                                PC_MSG_REMOTE_OP_FAILED, "remote operation "
+                                "failed: %s", strerror
+                                (gf_error_to_errno (rsp.op_errno)));
+                }
         }
 
         CLIENT_STACK_UNWIND (unlink, frame, rsp.op_ret,
@@ -668,7 +702,8 @@ client3_3_rmdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rmdir_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -685,7 +720,8 @@ client3_3_rmdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED, "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (rmdir, frame, rsp.op_ret,
@@ -725,7 +761,8 @@ client3_3_truncate_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_truncate_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -742,7 +779,9 @@ client3_3_truncate_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (truncate, frame, rsp.op_ret,
@@ -781,7 +820,8 @@ client3_3_statfs_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_statfs_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -797,7 +837,9 @@ client3_3_statfs_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (statfs, frame, rsp.op_ret,
@@ -839,7 +881,8 @@ client3_3_writev_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_write_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -856,7 +899,9 @@ client3_3_writev_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         } else if (rsp.op_ret >= 0) {
                 if (local->attempt_reopen)
@@ -897,7 +942,8 @@ client3_3_flush_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -906,9 +952,9 @@ client3_3_flush_cbk (struct rpc_req *req, struct iovec *iov, int count,
         if (rsp.op_ret >= 0 && !fd_is_anonymous (local->fd)) {
                 /* Delete all saved locks of the owner issuing flush */
                 ret = delete_granted_locks_owner (local->fd, &local->owner);
-                gf_log (this->name, GF_LOG_TRACE,
-                        "deleting locks of owner (%s) returned %d",
-                        lkowner_utoa (&local->owner), ret);
+                gf_msg_trace (this->name, 0,
+                              "deleting locks of owner (%s) returned %d",
+                              lkowner_utoa (&local->owner), ret);
         }
 
         GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
@@ -917,8 +963,10 @@ client3_3_flush_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, fop_log_level (GF_FOP_FLUSH,
-                                        gf_error_to_errno (rsp.op_errno)),
+                gf_msg (this->name, fop_log_level (GF_FOP_FLUSH,
+                        gf_error_to_errno (rsp.op_errno)),
+                        rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
@@ -958,7 +1006,8 @@ client3_3_fsync_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fsync_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -975,7 +1024,9 @@ client3_3_fsync_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (fsync, frame, rsp.op_ret,
@@ -1013,7 +1064,8 @@ client3_3_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1026,11 +1078,16 @@ client3_3_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 out:
         op_errno = gf_error_to_errno (rsp.op_errno);
         if (rsp.op_ret == -1) {
-                gf_log (this->name, ((op_errno == ENOTSUP) ?
-                                     GF_LOG_DEBUG : GF_LOG_WARNING),
-                        "remote operation failed: %s",
-                        strerror (op_errno));
+                if (op_errno == ENOTSUP) {
+                        gf_msg_debug (this->name, 0, "remote operation failed:"
+                                      " %s", strerror (op_errno));
+                } else {
+                        gf_msg (this->name, GF_LOG_WARNING, op_errno,
+                                PC_MSG_REMOTE_OP_FAILED, "remote operation "
+                                "failed: %s", strerror (op_errno));
+                }
         }
+
         CLIENT_STACK_UNWIND (setxattr, frame, rsp.op_ret, op_errno, xdata);
 
         free (rsp.xdata.xdata_val);
@@ -1068,7 +1125,8 @@ client3_3_getxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_getxattr_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret = -1;
                 op_errno = EINVAL;
                 goto out;
@@ -1088,15 +1146,22 @@ client3_3_getxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, (((op_errno == ENOTSUP) ||
-                                      (op_errno == ENODATA) ||
-                                      (op_errno == ESTALE) ||
-                                      (op_errno == ENOENT)) ?
-                                     GF_LOG_DEBUG : GF_LOG_WARNING),
-                        "remote operation failed: %s. Path: %s (%s). Key: %s",
-                        strerror (op_errno),
-                        local->loc.path, loc_gfid_utoa (&local->loc),
-                        (local->name) ? local->name : "(null)");
+                if ((op_errno == ENOTSUP) || (op_errno == ENODATA) ||
+                     (op_errno == ESTALE) || (op_errno == ENOENT)) {
+                        gf_msg_debug (this->name, 0,
+                                      "remote operation failed: %s. Path: %s "
+                                      "(%s). Key: %s", strerror (op_errno),
+                                      local->loc.path,
+                                      loc_gfid_utoa (&local->loc),
+                                      (local->name) ? local->name : "(null)");
+                } else {
+                        gf_msg (this->name, GF_LOG_WARNING, op_errno,
+                                PC_MSG_REMOTE_OP_FAILED, "remote operation "
+                                "failed: %s. Path: %s (%s). Key: %s",
+                                strerror (op_errno), local->loc.path,
+                                loc_gfid_utoa (&local->loc),
+                                (local->name) ? local->name : "(null)");
+                }
         }
 
         CLIENT_STACK_UNWIND (getxattr, frame, rsp.op_ret, op_errno, dict, xdata);
@@ -1141,7 +1206,8 @@ client3_3_fgetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fgetxattr_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret = -1;
                 op_errno = EINVAL;
                 goto out;
@@ -1160,13 +1226,16 @@ client3_3_fgetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, (((op_errno == ENOTSUP) ||
-                                      (op_errno == ERANGE)  ||
-                                      (op_errno == ENODATA) ||
-                                      (op_errno == ENOENT)) ?
-                                      GF_LOG_DEBUG : GF_LOG_WARNING),
+                if ((op_errno == ENOTSUP) || (op_errno == ERANGE) ||
+                     (op_errno == ENODATA) || (op_errno == ENOENT)) {
+                        gf_msg_debug (this->name, 0,
                                       "remote operation failed: %s",
                                       strerror (op_errno));
+                } else {
+                        gf_msg (this->name, GF_LOG_WARNING, op_errno,
+                                PC_MSG_REMOTE_OP_FAILED, "remote operation "
+                                "failed: %s", strerror (op_errno));
+                }
         }
 
         CLIENT_STACK_UNWIND (fgetxattr, frame, rsp.op_ret, op_errno, dict, xdata);
@@ -1207,7 +1276,8 @@ client3_3_removexattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1220,11 +1290,13 @@ client3_3_removexattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 out:
         if (rsp.op_ret == -1) {
                 if ((ENODATA == rsp.op_errno) || (ENOATTR == rsp.op_errno))
-                        loglevel = GF_LOG_DEBUG;
+                        loglevel = 0;
                 else
                         loglevel = GF_LOG_WARNING;
 
-                gf_log (this->name, loglevel, "remote operation failed: %s",
+                gf_msg (this->name, loglevel, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
 
@@ -1262,7 +1334,8 @@ client3_3_fremovexattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1274,7 +1347,9 @@ client3_3_fremovexattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (fremovexattr, frame, rsp.op_ret,
@@ -1310,7 +1385,8 @@ client3_3_fsyncdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1322,7 +1398,9 @@ client3_3_fsyncdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (fsyncdir, frame, rsp.op_ret,
@@ -1358,7 +1436,8 @@ client3_3_access_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1370,7 +1449,9 @@ client3_3_access_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (access, frame, rsp.op_ret,
@@ -1409,7 +1490,8 @@ client3_3_ftruncate_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_ftruncate_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1426,7 +1508,9 @@ client3_3_ftruncate_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (ftruncate, frame, rsp.op_ret,
@@ -1464,7 +1548,8 @@ client3_3_fstat_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fstat_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1480,7 +1565,9 @@ client3_3_fstat_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (fstat, frame, rsp.op_ret,
@@ -1517,7 +1604,8 @@ client3_3_inodelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1529,10 +1617,10 @@ client3_3_inodelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, fop_log_level (GF_FOP_INODELK,
-                                        gf_error_to_errno (rsp.op_errno)),
-                        "remote operation failed: %s",
-                        strerror (gf_error_to_errno (rsp.op_errno)));
+                gf_msg (this->name, fop_log_level (GF_FOP_INODELK,
+                        gf_error_to_errno (rsp.op_errno)), rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED, "remote operation failed: "
+                        "%s", strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (inodelk, frame, rsp.op_ret,
                              gf_error_to_errno (rsp.op_errno), xdata);
@@ -1568,7 +1656,8 @@ client3_3_finodelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1580,10 +1669,10 @@ client3_3_finodelk_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, fop_log_level (GF_FOP_FINODELK,
-                                        gf_error_to_errno (rsp.op_errno)),
-                        "remote operation failed: %s",
-                        strerror (gf_error_to_errno (rsp.op_errno)));
+                gf_msg (this->name, fop_log_level (GF_FOP_FINODELK,
+                        gf_error_to_errno (rsp.op_errno)), rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED, "remote operation failed: "
+                        "%s", strerror (gf_error_to_errno (rsp.op_errno)));
         } else if (rsp.op_ret == 0) {
                 if (local->attempt_reopen)
                         client_attempt_reopen (local->fd, this);
@@ -1621,7 +1710,8 @@ client3_3_entrylk_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1633,10 +1723,10 @@ client3_3_entrylk_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, fop_log_level (GF_FOP_ENTRYLK,
-                                        gf_error_to_errno (rsp.op_errno)),
-                        "remote operation failed: %s",
-                        strerror (gf_error_to_errno (rsp.op_errno)));
+                gf_msg (this->name, fop_log_level (GF_FOP_ENTRYLK,
+                        gf_error_to_errno (rsp.op_errno)), rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED, "remote operation failed: "
+                        "%s", strerror (gf_error_to_errno (rsp.op_errno)));
         }
 
         CLIENT_STACK_UNWIND (entrylk, frame, rsp.op_ret,
@@ -1672,7 +1762,8 @@ client3_3_fentrylk_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1685,7 +1776,9 @@ client3_3_fentrylk_cbk (struct rpc_req *req, struct iovec *iov, int count,
 out:
         if ((rsp.op_ret == -1) &&
             (EAGAIN != gf_error_to_errno (rsp.op_errno))) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
 
@@ -1726,7 +1819,8 @@ client3_3_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_xattrop_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret = -1;
                 op_errno = EINVAL;
                 goto out;
@@ -1746,8 +1840,9 @@ client3_3_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "remote operation failed: %s. Path: %s (%s)",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED, "remote operation failed: "
+                        "%s. Path: %s (%s)",
                         strerror (gf_error_to_errno (rsp.op_errno)),
                         local->loc.path, loc_gfid_utoa (&local->loc));
         }
@@ -1796,7 +1891,8 @@ client3_3_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
         if (ret < 0) {
                 rsp.op_ret = -1;
                 op_errno = EINVAL;
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 goto out;
         }
         op_errno = rsp.op_errno;
@@ -1814,7 +1910,8 @@ client3_3_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count,
 out:
 
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s",
                         strerror (gf_error_to_errno (op_errno)));
         } else if (rsp.op_ret == 0) {
@@ -1859,7 +1956,8 @@ client3_3_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1872,10 +1970,14 @@ client3_3_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 out:
         op_errno = gf_error_to_errno (rsp.op_errno);
         if (rsp.op_ret == -1) {
-                gf_log (this->name, ((op_errno == ENOTSUP) ?
-                                     GF_LOG_DEBUG : GF_LOG_WARNING),
-                        "remote operation failed: %s",
-                        strerror (op_errno));
+                if (op_errno == ENOTSUP) {
+                        gf_msg_debug (this->name, 0, "remote operation failed:"
+                                      " %s", strerror (op_errno));
+                } else {
+                        gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                                PC_MSG_REMOTE_OP_FAILED, "remote operation "
+                                "failed: %s", strerror (op_errno));
+                }
         }
 
         CLIENT_STACK_UNWIND (fsetxattr, frame, rsp.op_ret, op_errno, xdata);
@@ -1912,7 +2014,8 @@ client3_3_fsetattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fsetattr_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1929,7 +2032,9 @@ client3_3_fsetattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (fsetattr, frame, rsp.op_ret,
@@ -1968,7 +2073,8 @@ client3_3_fallocate_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fallocate_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -1985,7 +2091,9 @@ client3_3_fallocate_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (fallocate, frame, rsp.op_ret,
@@ -2023,7 +2131,8 @@ client3_3_discard_cbk(struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_discard_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2040,7 +2149,9 @@ client3_3_discard_cbk(struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (discard, frame, rsp.op_ret,
@@ -2078,7 +2189,8 @@ client3_3_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_zerofill_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2095,7 +2207,8 @@ client3_3_zerofill_cbk(struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
@@ -2132,7 +2245,8 @@ client3_3_ipc_cbk (struct rpc_req *req, struct iovec *iov, int count,
         }
         ret = xdr_to_generic(*iov, &rsp, (xdrproc_t) xdr_gfs3_ipc_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2144,7 +2258,8 @@ client3_3_ipc_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
@@ -2185,7 +2300,8 @@ client3_3_setattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_setattr_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2202,7 +2318,9 @@ client3_3_setattr_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (setattr, frame, rsp.op_ret,
@@ -2248,7 +2366,8 @@ client3_3_create_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_create_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2275,7 +2394,8 @@ client3_3_create_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s. Path: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)),
                         local->loc.path);
@@ -2317,7 +2437,8 @@ client3_3_rchecksum_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rchecksum_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2329,7 +2450,9 @@ client3_3_rchecksum_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (rchecksum, frame, rsp.op_ret,
@@ -2377,7 +2500,8 @@ client3_3_lk_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lk_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2408,7 +2532,8 @@ client3_3_lk_cbk (struct rpc_req *req, struct iovec *iov, int count,
 out:
         if ((rsp.op_ret == -1) &&
             (EAGAIN != gf_error_to_errno (rsp.op_errno))) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
@@ -2451,7 +2576,8 @@ client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readdir_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2469,7 +2595,8 @@ client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s remote_fd = %d",
                         strerror (gf_error_to_errno (rsp.op_errno)),
                                   local->cmd);
@@ -2517,7 +2644,8 @@ client3_3_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readdirp_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2534,7 +2662,8 @@ client3_3_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
@@ -2582,7 +2711,8 @@ client3_3_rename_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rename_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2604,7 +2734,9 @@ client3_3_rename_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
+                        "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         }
         CLIENT_STACK_UNWIND (rename, frame, rsp.op_ret,
@@ -2651,7 +2783,8 @@ client3_3_link_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_link_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2671,7 +2804,8 @@ client3_3_link_cbk (struct rpc_req *req, struct iovec *iov, int count,
 out:
         if (rsp.op_ret == -1) {
                 if (GF_IGNORE_IF_GSYNCD_SAFE_ERROR(frame, rsp.op_errno)) {
-                        gf_log (this->name, GF_LOG_WARNING,
+                        gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                                PC_MSG_REMOTE_OP_FAILED,
                                 "remote operation failed: %s (%s -> %s)",
                                 strerror (gf_error_to_errno (rsp.op_errno)),
                                 local->loc.path, local->loc2.path);
@@ -2720,7 +2854,8 @@ client3_3_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2742,9 +2877,10 @@ client3_3_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, fop_log_level (GF_FOP_OPENDIR,
-                                        gf_error_to_errno (rsp.op_errno)),
-                        "remote operation failed: %s. Path: %s (%s)",
+                gf_msg (this->name, fop_log_level (GF_FOP_OPENDIR,
+                        gf_error_to_errno (rsp.op_errno)), rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED, "remote operation failed: "
+                        "%s. Path: %s (%s)",
                         strerror (gf_error_to_errno (rsp.op_errno)),
                         local->loc.path, loc_gfid_utoa (&local->loc));
         }
@@ -2789,7 +2925,8 @@ client3_3_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lookup_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 op_errno = EINVAL;
                 goto out;
@@ -2810,8 +2947,8 @@ client3_3_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         if ((!gf_uuid_is_null (inode->gfid))
             && (gf_uuid_compare (stbuf.ia_gfid, inode->gfid) != 0)) {
-                gf_log (frame->this->name, GF_LOG_DEBUG,
-                        "gfid changed for %s", local->loc.path);
+                gf_msg_debug (frame->this->name, 0,
+                              "gfid changed for %s", local->loc.path);
 
                 rsp.op_ret = -1;
                 op_errno = ESTALE;
@@ -2829,12 +2966,14 @@ out:
                 /* any error other than ENOENT */
                 if (!(local->loc.name && rsp.op_errno == ENOENT) &&
 		    !(rsp.op_errno == ESTALE))
-                        gf_log (this->name, GF_LOG_WARNING,
-                                "remote operation failed: %s. Path: %s (%s)",
+                        gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                                PC_MSG_REMOTE_OP_FAILED, "remote operation "
+                                "failed: %s. Path: %s (%s)",
                                 strerror (rsp.op_errno), local->loc.path,
                                 loc_gfid_utoa (&local->loc));
                 else
-                        gf_log (this->name, GF_LOG_TRACE, "not found on remote node");
+                        gf_msg_trace (this->name, 0, "not found on remote "
+                                      "node");
 
         }
 
@@ -2878,7 +3017,8 @@ client3_3_readv_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
         ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_read_rsp);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_XDR_DECODING_FAILED, "XDR decoding failed");
                 rsp.op_ret   = -1;
                 rsp.op_errno = EINVAL;
                 goto out;
@@ -2903,7 +3043,8 @@ client3_3_readv_cbk (struct rpc_req *req, struct iovec *iov, int count,
 
 out:
         if (rsp.op_ret == -1) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, rsp.op_errno,
+                        PC_MSG_REMOTE_OP_FAILED,
                         "remote operation failed: %s",
                         strerror (gf_error_to_errno (rsp.op_errno)));
         } else if (rsp.op_ret >= 0) {
@@ -2958,7 +3099,7 @@ client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx)
         conf = (clnt_conf_t *) this->private;
 
         if (fdctx->remote_fd == -1) {
-                gf_log (this->name, GF_LOG_DEBUG, "not a valid fd");
+                gf_msg_debug (this->name, 0, "not a valid fd");
                 goto out;
         }
 
@@ -2988,7 +3129,7 @@ client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx)
         if (fdctx->is_dir) {
                 gfs3_releasedir_req  req = {{0,},};
                 req.fd = fdctx->remote_fd;
-                gf_log (this->name, GF_LOG_TRACE, "sending releasedir on fd");
+                gf_msg_trace (this->name, 0, "sending releasedir on fd");
                 client_submit_request (this, &req, fr, &clnt3_3_fop_prog,
                                        GFS3_OP_RELEASEDIR,
                                        client3_3_releasedir_cbk,
@@ -2997,7 +3138,7 @@ client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx)
         } else {
                 gfs3_release_req  req = {{0,},};
                 req.fd = fdctx->remote_fd;
-                gf_log (this->name, GF_LOG_TRACE, "sending release on fd");
+                gf_msg_trace (this->name, 0, "sending release on fd");
                 client_submit_request (this, &req, fr, &clnt3_3_fop_prog,
                                        GFS3_OP_RELEASE,
                                        client3_3_release_cbk, NULL,
@@ -3194,7 +3335,8 @@ client3_3_lookup (call_frame_t *frame, xlator_t *this,
                                      (xdrproc_t)xdr_gfs3_lookup_req);
 
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -3251,7 +3393,8 @@ client3_3_stat (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_stat_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -3305,7 +3448,8 @@ client3_3_truncate (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_truncate_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -3353,7 +3497,8 @@ client3_3_ftruncate (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_ftruncate_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -3407,7 +3552,8 @@ client3_3_access (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_access_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -3493,7 +3639,8 @@ client3_3_readlink (call_frame_t *frame, xlator_t *this,
                                      local->iobref,
                                      (xdrproc_t)xdr_gfs3_readlink_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -3552,7 +3699,8 @@ client3_3_unlink (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_unlink_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -3605,7 +3753,8 @@ client3_3_rmdir (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_rmdir_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
         GF_FREE (req.xdata.xdata_val);
 
@@ -3671,7 +3820,8 @@ client3_3_symlink (call_frame_t *frame, xlator_t *this,
                                      NULL,  NULL, 0, NULL,
                                      0, NULL, (xdrproc_t)xdr_gfs3_symlink_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -3736,7 +3886,8 @@ client3_3_rename (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_rename_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -3812,7 +3963,8 @@ client3_3_link (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_link_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -3879,7 +4031,8 @@ client3_3_mknod (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_mknod_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
         GF_FREE (req.xdata.xdata_val);
 
@@ -3947,7 +4100,8 @@ client3_3_mkdir (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_mkdir_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
         GF_FREE (req.xdata.xdata_val);
 
@@ -4017,7 +4171,8 @@ client3_3_create (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_create_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -4085,7 +4240,8 @@ client3_3_open (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_open_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -4159,7 +4315,7 @@ client3_3_readv (call_frame_t *frame, xlator_t *this,
         rsp_iobuf = NULL;
 
         if (args->size > rsp_vec.iov_len) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, ENOMEM, PC_MSG_NO_MEMORY,
                         "read-size (%lu) is bigger than iobuf size (%lu)",
                         (unsigned long)args->size,
                         (unsigned long)rsp_vec.iov_len);
@@ -4180,7 +4336,8 @@ client3_3_readv (call_frame_t *frame, xlator_t *this,
                                      (xdrproc_t)xdr_gfs3_read_req);
         if (ret) {
                 //unwind is done in the cbk
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -4253,7 +4410,8 @@ client3_3_writev (call_frame_t *frame, xlator_t *this, void *data)
                  * do the unwind for us (see rpc_clnt_submit), so don't unwind
                  * here in such cases.
                  */
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -4312,7 +4470,8 @@ client3_3_flush (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_flush_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -4361,7 +4520,8 @@ client3_3_fsync (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_fsync_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
 
         }
 
@@ -4409,7 +4569,8 @@ client3_3_fstat (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_fstat_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -4474,7 +4635,8 @@ client3_3_opendir (call_frame_t *frame, xlator_t *this,
                                      NULL, NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_opendir_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -4525,7 +4687,8 @@ client3_3_fsyncdir (call_frame_t *frame, xlator_t *this, void *data)
                                      NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_fsyncdir_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -4581,7 +4744,8 @@ client3_3_statfs (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_statfs_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -4642,7 +4806,8 @@ client3_3_setxattr (call_frame_t *frame, xlator_t *this,
                                      NULL, NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_setxattr_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
         GF_FREE (req.dict.dict_val);
 
@@ -4699,7 +4864,8 @@ client3_3_fsetxattr (call_frame_t *frame, xlator_t *this,
                                      NULL, NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_fsetxattr_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.dict.dict_val);
@@ -4795,7 +4961,8 @@ client3_3_fgetxattr (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, local->iobref,
                                      (xdrproc_t)xdr_gfs3_fgetxattr_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -4908,8 +5075,9 @@ client3_3_getxattr (call_frame_t *frame, xlator_t *this,
                                                  args->loc->inode,
                                                  dict);
                         if (ret) {
-                                gf_log (this->name, GF_LOG_WARNING,
-                                        "Client dump locks failed");
+                                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+                                        PC_MSG_INVALID_ENTRY, "Client dump "
+                                        "locks failed");
                                 op_errno = EINVAL;
                         }
 
@@ -4930,7 +5098,8 @@ client3_3_getxattr (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, local->iobref,
                                      (xdrproc_t)xdr_gfs3_getxattr_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5038,7 +5207,8 @@ client3_3_xattrop (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, local->iobref,
                                      (xdrproc_t)xdr_gfs3_xattrop_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.dict.dict_val);
@@ -5141,7 +5311,8 @@ client3_3_fxattrop (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, local->iobref,
                                      (xdrproc_t)xdr_gfs3_fxattrop_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.dict.dict_val);
@@ -5205,7 +5376,8 @@ client3_3_removexattr (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_removexattr_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5255,7 +5427,8 @@ client3_3_fremovexattr (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_fremovexattr_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5300,8 +5473,8 @@ client3_3_lk (call_frame_t *frame, xlator_t *this,
         ret = client_cmd_to_gf_cmd (args->cmd, &gf_cmd);
         if (ret) {
                 op_errno = EINVAL;
-                gf_log (this->name, GF_LOG_WARNING,
-                        "Unknown cmd (%d)!", gf_cmd);
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+                        PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
                 goto unwind;
         }
 
@@ -5336,7 +5509,8 @@ client3_3_lk (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0, NULL,
                                      (xdrproc_t)xdr_gfs3_lk_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5384,8 +5558,8 @@ client3_3_inodelk (call_frame_t *frame, xlator_t *this,
         else if (args->cmd == F_SETLKW || args->cmd == F_SETLKW64)
                 gf_cmd = GF_LK_SETLKW;
         else {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "Unknown cmd (%d)!", gf_cmd);
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+                        PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
                 op_errno = EINVAL;
                 goto unwind;
         }
@@ -5418,7 +5592,8 @@ client3_3_inodelk (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_inodelk_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5466,8 +5641,8 @@ client3_3_finodelk (call_frame_t *frame, xlator_t *this,
         else if (args->cmd == F_SETLKW || args->cmd == F_SETLKW64)
                 gf_cmd = GF_LK_SETLKW;
         else {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "Unknown cmd (%d)!", gf_cmd);
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+                        PC_MSG_INVALID_ENTRY, "Unknown cmd (%d)!", gf_cmd);
                 goto unwind;
         }
 
@@ -5499,7 +5674,8 @@ client3_3_finodelk (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_finodelk_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5558,7 +5734,8 @@ client3_3_entrylk (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_entrylk_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5613,7 +5790,8 @@ client3_3_fentrylk (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_fentrylk_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5661,7 +5839,8 @@ client3_3_rchecksum (call_frame_t *frame, xlator_t *this,
                                      0, NULL,
                                      (xdrproc_t)xdr_gfs3_rchecksum_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5759,7 +5938,8 @@ client3_3_readdir (call_frame_t *frame, xlator_t *this,
                                      (xdrproc_t)xdr_gfs3_readdir_req);
 
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5864,7 +6044,8 @@ client3_3_readdirp (call_frame_t *frame, xlator_t *this,
                                      0, rsp_iobref,
                                      (xdrproc_t)xdr_gfs3_readdirp_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.dict.dict_val);
@@ -5924,7 +6105,8 @@ client3_3_setattr (call_frame_t *frame, xlator_t *this,
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_setattr_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -5969,7 +6151,8 @@ client3_3_fsetattr (call_frame_t *frame, xlator_t *this, void *data)
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_fsetattr_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -6016,7 +6199,8 @@ client3_3_fallocate(call_frame_t *frame, xlator_t *this, void *data)
                                      NULL, 0, NULL, 0,
                                      NULL, (xdrproc_t)xdr_gfs3_fallocate_req);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
         }
 
         GF_FREE (req.xdata.xdata_val);
@@ -6061,7 +6245,8 @@ client3_3_discard(call_frame_t *frame, xlator_t *this, void *data)
 				    NULL, NULL, 0, NULL, 0, NULL,
                                     (xdrproc_t) xdr_gfs3_discard_req);
         if (ret)
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
 
         GF_FREE (req.xdata.xdata_val);
 
@@ -6107,7 +6292,8 @@ client3_3_zerofill(call_frame_t *frame, xlator_t *this, void *data)
                                     NULL, NULL, 0, NULL, 0, NULL,
                                     (xdrproc_t) xdr_gfs3_zerofill_req);
         if (ret)
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
 
         GF_FREE (req.xdata.xdata_val);
 
@@ -6146,7 +6332,8 @@ client3_3_ipc (call_frame_t *frame, xlator_t *this, void *data)
                                     NULL, NULL, 0, NULL, 0, NULL,
                                     (xdrproc_t) xdr_gfs3_ipc_req);
         if (ret)
-                gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FOP_SEND_FAILED,
+                        "failed to send the fop");
 
         GF_FREE (req.xdata.xdata_val);
 
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 5745de0..fb45128 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -25,6 +25,7 @@
 #include "xdr-rpc.h"
 #include "glusterfs3.h"
 #include "gf-dirent.h"
+#include "client-messages.h"
 
 extern rpc_clnt_prog_t clnt_handshake_prog;
 extern rpc_clnt_prog_t clnt_dump_prog;
@@ -168,7 +169,7 @@ client_grace_timeout (void *data)
         }
         pthread_mutex_unlock (&conf->lock);
 
-        gf_log (this->name, GF_LOG_WARNING,
+        gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_TIMER_EXPIRED,
                 "client grace timer expired, updating "
                 "the lk-version to %d", ver);
 
@@ -188,12 +189,12 @@ client_register_grace_timer (xlator_t *this, clnt_conf_t *conf)
         pthread_mutex_lock (&conf->lock);
         {
                 if (conf->grace_timer || !conf->grace_timer_needed) {
-                        gf_log (this->name, GF_LOG_TRACE,
-				"Client grace timer is already set "
-				"or a grace-timer has already time out, "
-				"not registering a new timer");
+                        gf_msg_trace (this->name, 0,
+				      "Client grace timer is already set "
+				      "or a grace-timer has already time "
+				      "out, not registering a new timer");
                 } else {
-                        gf_log (this->name, GF_LOG_INFO,
+                        gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_TIMER_REG,
                                 "Registering a grace timer");
 
                         conf->grace_timer_needed = _gf_false;
@@ -247,8 +248,8 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame,
                 (procnum == GF_HNDSK_SETVOLUME))))) {
                 /* This particular error captured/logged in
                    functions calling this */
-                gf_log (this->name, GF_LOG_DEBUG,
-                        "connection in disconnected state");
+                gf_msg_debug (this->name, 0,
+                              "connection in disconnected state");
                 goto out;
        }
 
@@ -267,16 +268,18 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame,
                 if (iobref != NULL) {
                         ret = iobref_merge (new_iobref, iobref);
                         if (ret != 0) {
-                                gf_log (this->name, GF_LOG_WARNING,
-                                        "cannot merge iobref passed from caller "
-                                        "into new_iobref");
+                                gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
+                                        PC_MSG_NO_MEMORY, "cannot merge "
+                                        "iobref passed from caller into "
+                                        "new_iobref");
                         }
                 }
 
                 ret = iobref_add (new_iobref, iobuf);
                 if (ret != 0) {
-                        gf_log (this->name, GF_LOG_WARNING,
-                                "cannot add iobuf into iobref");
+                        gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
+                                PC_MSG_NO_MEMORY, "cannot add iobuf into "
+                                "iobref");
                         goto out;
                 }
 
@@ -314,7 +317,7 @@ client_submit_request (xlator_t *this, void *req, call_frame_t *frame,
                                rsp_payload, rsp_payload_count, rsp_iobref);
 
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_DEBUG, "rpc_clnt_submit failed");
+                gf_msg_debug (this->name, 0, "rpc_clnt_submit failed");
         }
 
         if (!conf->send_gids) {
@@ -371,14 +374,13 @@ client_releasedir (xlator_t *this, fd_t *fd)
         args.fd = fd;
 
         proc = &conf->fops->proctable[GF_FOP_RELEASEDIR];
-
         if (proc->fn) {
                 ret = proc->fn (NULL, this, &args);
         }
 out:
         if (ret)
-                gf_log (this->name, GF_LOG_WARNING,
-                        "releasedir fop failed");
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        PC_MSG_DIR_OP_FAILED, "releasedir fop failed");
 	return 0;
 }
 
@@ -396,13 +398,12 @@ client_release (xlator_t *this, fd_t *fd)
 
         args.fd = fd;
         proc = &conf->fops->proctable[GF_FOP_RELEASE];
-
         if (proc->fn) {
                 ret = proc->fn (NULL, this, &args);
         }
 out:
         if (ret)
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_FILE_OP_FAILED,
                         "release fop failed");
 	return 0;
 }
@@ -425,7 +426,6 @@ client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_LOOKUP];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -454,7 +454,6 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_STAT];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -483,7 +482,6 @@ client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_TRUNCATE];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -513,7 +511,6 @@ client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FTRUNCATE];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -543,7 +540,6 @@ client_access (call_frame_t *frame, xlator_t *this, loc_t *loc,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_ACCESS];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -574,7 +570,6 @@ client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_READLINK];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -605,7 +600,6 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_MKNOD];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -636,7 +630,6 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_MKDIR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -667,7 +660,6 @@ client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc,
         args.flags = xflag;
 
         proc = &conf->fops->proctable[GF_FOP_UNLINK];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -696,7 +688,6 @@ client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_RMDIR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -728,7 +719,6 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath,
         args.xdata    = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_SYMLINK];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -759,7 +749,6 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
         args.xdata  = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_RENAME];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -790,7 +779,6 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_LINK];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -828,7 +816,6 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc,  int32_t flags,
                 args.flags = (flags & ~O_DIRECT);
 
         proc = &conf->fops->proctable[GF_FOP_CREATE];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -864,7 +851,6 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc,
                 args.flags = (flags & ~O_DIRECT);
 
         proc = &conf->fops->proctable[GF_FOP_OPEN];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 
@@ -897,7 +883,6 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_READ];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 
@@ -936,7 +921,6 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_WRITE];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -963,7 +947,6 @@ client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FLUSH];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -993,7 +976,6 @@ client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FSYNC];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1021,7 +1003,6 @@ client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FSTAT];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1051,7 +1032,6 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_OPENDIR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1080,7 +1060,6 @@ client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, d
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FSYNCDIR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1108,7 +1087,6 @@ client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_STATFS];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1126,13 +1104,13 @@ is_client_rpc_init_command (dict_t *dict, xlator_t *this,
         int          dict_ret = -1;
 
         if (!strstr (this->name, "replace-brick")) {
-                gf_log (this->name, GF_LOG_TRACE, "name is !replace-brick");
+                gf_msg_trace (this->name, 0, "name is !replace-brick");
                 goto out;
         }
         dict_ret = dict_get_str (dict, CLIENT_CMD_CONNECT, value);
         if (dict_ret) {
-                gf_log (this->name, GF_LOG_TRACE, "key %s not present",
-                        CLIENT_CMD_CONNECT);
+                gf_msg_trace (this->name, 0, "key %s not present",
+                              CLIENT_CMD_CONNECT);
                 goto out;
         }
 
@@ -1151,14 +1129,14 @@ is_client_rpc_destroy_command (dict_t *dict, xlator_t *this)
         char        *dummy    = NULL;
 
         if (strncmp (this->name, "replace-brick", 13)) {
-                gf_log (this->name, GF_LOG_TRACE, "name is !replace-brick");
+                gf_msg_trace (this->name, 0, "name is !replace-brick");
                 goto out;
         }
 
         dict_ret = dict_get_str (dict, CLIENT_CMD_DISCONNECT, &dummy);
         if (dict_ret) {
-                gf_log (this->name, GF_LOG_TRACE, "key %s not present",
-                        CLIENT_CMD_DISCONNECT);
+                gf_msg_trace (this->name, 0, "key %s not present",
+                              CLIENT_CMD_DISCONNECT);
                 goto out;
         }
 
@@ -1188,8 +1166,9 @@ client_set_remote_options (char *value, xlator_t *this)
         remote_port_str = strtok_r (NULL, ":", &tmp);
 
         if (!subvol) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "proper value not passed as subvolume");
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+                        PC_MSG_INVALID_ENTRY, "proper value not passed as "
+                        "subvolume");
                 goto out;
         }
 
@@ -1200,7 +1179,7 @@ client_set_remote_options (char *value, xlator_t *this)
 
         ret = dict_set_dynstr (this->options, "remote-host", host_dup);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
                         "failed to set remote-host with %s", host);
                 goto out;
         }
@@ -1212,7 +1191,7 @@ client_set_remote_options (char *value, xlator_t *this)
 
         ret = dict_set_dynstr (this->options, "remote-subvolume", subvol_dup);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
                         "failed to set remote-host with %s", host);
                 goto out;
         }
@@ -1223,7 +1202,7 @@ client_set_remote_options (char *value, xlator_t *this)
         ret = dict_set_int32 (this->options, "remote-port",
                               remote_port);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_DICT_SET_FAILED,
                         "failed to set remote-port to %d", remote_port);
                 goto out;
         }
@@ -1252,7 +1231,8 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
 
         if (is_client_rpc_init_command (dict, this, &value) == _gf_true) {
                 GF_ASSERT (value);
-                gf_log (this->name, GF_LOG_INFO, "client rpc init command");
+                gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_RPC_INIT,
+                        "client rpc init command");
                 ret = client_set_remote_options (value, this);
                 if (ret) {
                         (void) client_destroy_rpc (this);
@@ -1268,7 +1248,8 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
         }
 
         if (is_client_rpc_destroy_command (dict, this) == _gf_true) {
-                gf_log (this->name, GF_LOG_INFO, "client rpc destroy command");
+                gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_RPC_DESTROY,
+                        "client rpc destroy command");
                 ret = client_destroy_rpc (this);
                 if (ret) {
                         op_ret      = 0;
@@ -1291,7 +1272,6 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_SETXATTR];
-
         if (proc->fn) {
                 ret = proc->fn (frame, this, &args);
                 if (ret) {
@@ -1326,7 +1306,6 @@ client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FSETXATTR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1357,7 +1336,6 @@ client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FGETXATTR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1387,7 +1365,6 @@ client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_GETXATTR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1418,7 +1395,6 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_XATTROP];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1449,7 +1425,6 @@ client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FXATTROP];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1479,7 +1454,6 @@ client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_REMOVEXATTR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1507,7 +1481,6 @@ client_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FREMOVEXATTR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1536,7 +1509,6 @@ client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_LK];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1567,7 +1539,6 @@ client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_INODELK];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1599,7 +1570,6 @@ client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FINODELK];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1632,7 +1602,6 @@ client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_ENTRYLK];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1666,7 +1635,6 @@ client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FENTRYLK];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1696,7 +1664,6 @@ client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_RCHECKSUM];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1728,7 +1695,6 @@ client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_READDIR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1761,7 +1727,6 @@ client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd,
         args.xdata = dict;
 
         proc = &conf->fops->proctable[GF_FOP_READDIRP];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1791,7 +1756,6 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_SETATTR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1820,7 +1784,6 @@ client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FSETATTR];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1850,7 +1813,6 @@ client_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_FALLOCATE];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1879,7 +1841,6 @@ client_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_DISCARD];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1908,7 +1869,6 @@ client_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_ZEROFILL];
-
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1936,12 +1896,6 @@ client_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)
         args.xdata = xdata;
 
         proc = &conf->fops->proctable[GF_FOP_IPC];
-        if (!proc) {
-                gf_log (this->name, GF_LOG_ERROR,
-                        "rpc procedure not found for %s",
-                        gf_fop_list[GF_FOP_IPC]);
-                goto out;
-        }
         if (proc->fn)
                 ret = proc->fn (frame, this, &args);
 out:
@@ -1970,7 +1924,6 @@ client_getspec (call_frame_t *frame, xlator_t *this, const char *key,
 
         /* For all other xlators, getspec is an fop, hence its in fops table */
         proc = &conf->fops->proctable[GF_FOP_GETSPEC];
-
         if (proc->fn) {
                 /* But at protocol level, this is handshake */
                 ret = proc->fn (frame, this, &args);
@@ -2015,7 +1968,7 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
 
         this = mydata;
         if (!this || !this->private) {
-                gf_log ("client", GF_LOG_ERROR,
+                gf_msg ("client", GF_LOG_ERROR, EINVAL, PC_MSG_INVALID_ENTRY,
                         (this != NULL) ?
                         "private structure of the xlator is NULL":
                         "xlator is NULL");
@@ -2032,20 +1985,22 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
                 ret = dict_get_str (this->options, "disable-handshake",
                                     &handshake);
 
-                gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_CONNECT");
+                gf_msg_debug (this->name, 0, "got RPC_CLNT_CONNECT");
 
                 if ((ret < 0) || (strcasecmp (handshake, "on"))) {
                         ret = client_handshake (this, rpc);
                         if (ret)
-                                gf_log (this->name, GF_LOG_WARNING,
-                                        "handshake msg returned %d", ret);
+                                gf_msg (this->name, GF_LOG_WARNING, 0,
+                                        PC_MSG_HANDSHAKE_RETURN, "handshake "
+                                        "msg returned %d", ret);
                 } else {
                         //conf->rpc->connected = 1;
                         ret = client_notify_dispatch_uniq (this,
                                                            GF_EVENT_CHILD_UP,
                                                            NULL);
                         if (ret)
-                                gf_log (this->name, GF_LOG_INFO,
+                                gf_msg (this->name, GF_LOG_INFO, 0,
+                                        PC_MSG_CHILD_UP_NOTIFY_FAILED,
                                         "CHILD_UP notify failed");
                 }
 
@@ -2055,7 +2010,8 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
                         conf->grace_timer_needed = _gf_true;
 
                         if (conf->grace_timer) {
-                                gf_log (this->name, GF_LOG_WARNING,
+                                gf_msg (this->name, GF_LOG_WARNING, 0,
+                                        PC_MSG_GRACE_TIMER_CANCELLED,
                                         "Cancelling the grace timer");
 
                                 gf_timer_call_cancel (this->ctx,
@@ -2076,19 +2032,26 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
 
                 if (!conf->skip_notify) {
                         if (conf->connected) {
-                               gf_log (this->name,
-                                        ((!conf->disconnect_err_logged)
-                                        ? GF_LOG_INFO : GF_LOG_DEBUG),
-                                        "disconnected from %s. Client process "
-                                        "will keep trying to connect to "
-                                        "glusterd until brick's port is "
-                                        "available",
-                                  conf->rpc->conn.name);
-
+                                if (!conf->disconnect_err_logged) {
+                                        gf_msg (this->name, GF_LOG_INFO, 0,
+                                                PC_MSG_CLIENT_DISCONNECTED,
+                                                "disconnected from %s. Client "
+                                                "process will keep trying to "
+                                                "connect to glusterd until "
+                                                "brick's port is available",
+                                                conf->rpc->conn.name);
+                                } else {
+                                       gf_msg_debug (this->name, 0,
+                                                     "disconnected from %s. "
+                                                     "Client process will keep"
+                                                     " trying to connect to "
+                                                     "glusterd until brick's "
+                                                     "port is available",
+                                                     conf->rpc->conn.name);
+                                }
                                 if (conf->portmap_err_logged)
                                         conf->disconnect_err_logged = 1;
                         }
-
                         /* If the CHILD_DOWN event goes to parent xlator
                            multiple times, the logic of parent xlator notify
                            may get screwed up.. (eg. CHILD_MODIFIED event in
@@ -2098,13 +2061,14 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
                                                            GF_EVENT_CHILD_DOWN,
                                                            NULL);
                         if (ret)
-                                gf_log (this->name, GF_LOG_INFO,
+                                gf_msg (this->name, GF_LOG_INFO, 0,
+                                        PC_MSG_CHILD_DOWN_NOTIFY_FAILED,
                                         "CHILD_DOWN notify failed");
 
                 } else {
                         if (conf->connected)
-                                gf_log (this->name, GF_LOG_DEBUG,
-                                        "disconnected (skipped notify)");
+                                gf_msg_debug (this->name, 0,
+                                              "disconnected (skipped notify)");
                 }
 
                 conf->connected = 0;
@@ -2126,8 +2090,8 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
                 break;
 
         default:
-                gf_log (this->name, GF_LOG_TRACE,
-                        "got some other RPC event %d", event);
+                gf_msg_trace (this->name, 0,
+                              "got some other RPC event %d", event);
 
                 break;
         }
@@ -2149,7 +2113,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
         switch (event) {
         case GF_EVENT_PARENT_UP:
         {
-                gf_log (this->name, GF_LOG_INFO,
+                gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_UP,
                         "parent translators are ready, attempting connect "
                         "on transport");
 
@@ -2158,7 +2122,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
         }
 
         case GF_EVENT_PARENT_DOWN:
-                gf_log (this->name, GF_LOG_INFO,
+                gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_PARENT_DOWN,
                         "current graph is no longer active, destroying "
                         "rpc_client ");
 
@@ -2172,8 +2136,8 @@ notify (xlator_t *this, int32_t event, void *data, ...)
                 break;
 
         default:
-                gf_log (this->name, GF_LOG_DEBUG,
-                        "got %d, calling default_notify ()", event);
+                gf_msg_debug (this->name, 0,
+                              "got %d, calling default_notify ()", event);
 
                 default_notify (this, event, data);
                 conf->last_sent_event = event;
@@ -2191,20 +2155,23 @@ client_check_remote_host (xlator_t *this, dict_t *options)
 
         ret = dict_get_str (options, "remote-host", &remote_host);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_INFO, "Remote host is not set. "
-                        "Assuming the volfile server as remote host.");
+                gf_msg (this->name, GF_LOG_INFO, EINVAL,
+                        PC_MSG_DICT_GET_FAILED, "Remote host is not set. "
+                        "Assuming the volfile server as remote host");
 
                 if (!this->ctx->cmd_args.volfile_server) {
-                        gf_log (this->name, GF_LOG_ERROR,
-                                                 "No remote host to connect.");
+                        gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                                PC_MSG_DICT_GET_FAILED, "No remote host to "
+                                "connect.");
                         goto out;
                 }
 
                 ret = dict_set_str (options, "remote-host",
                                     this->ctx->cmd_args.volfile_server);
                 if (ret == -1) {
-                        gf_log (this->name, GF_LOG_ERROR,
-                                "Failed to set the remote host");
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                PC_MSG_DICT_GET_FAILED, "Failed to set the "
+                                "remote host");
                         goto out;
                 }
         }
@@ -2234,7 +2201,8 @@ build_client_config (xlator_t *this, clnt_conf_t *conf)
         GF_OPTION_INIT ("remote-subvolume", conf->opt.remote_subvolume,
                         path, out);
         if (!conf->opt.remote_subvolume)
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+                        PC_MSG_INVALID_ENTRY,
                         "option 'remote-subvolume' not given");
 
         GF_OPTION_INIT ("filter-O_DIRECT", conf->filter_o_direct,
@@ -2265,8 +2233,8 @@ mem_acct_init (xlator_t *this)
         ret = xlator_mem_acct_init (this, gf_client_mt_end + 1);
 
         if (ret != 0) {
-                gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
-                        "failed");
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY,
+                        "Memory accounting init failed");
                 return ret;
         }
 
@@ -2289,12 +2257,12 @@ client_destroy_rpc (xlator_t *this)
 
                 conf->rpc = rpc_clnt_unref (conf->rpc);
                 ret = 0;
-                gf_log (this->name, GF_LOG_DEBUG,
-                        "Client rpc conn destroyed");
+                gf_msg_debug (this->name, 0,
+                              "Client rpc conn destroyed");
                 goto out;
         }
 
-        gf_log (this->name, GF_LOG_WARNING,
+        gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_RPC_INVALID_CALL,
                 "RPC destroy called on already destroyed "
                 "connection");
 
@@ -2311,21 +2279,24 @@ client_init_rpc (xlator_t *this)
         conf = this->private;
 
         if (conf->rpc) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "client rpc already init'ed");
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        PC_MSG_RPC_INITED_ALREADY, "client rpc already "
+                        "init'ed");
                 ret = -1;
                 goto out;
         }
 
         conf->rpc = rpc_clnt_new (this->options, this->ctx, this->name, 0);
         if (!conf->rpc) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to initialize RPC");
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_INIT_FAILED,
+                        "failed to initialize RPC");
                 goto out;
         }
 
         ret = rpc_clnt_register_notify (conf->rpc, client_rpc_notify, this);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to register notify");
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_NOTIFY_FAILED,
+                        "failed to register notify");
                 goto out;
         }
 
@@ -2335,14 +2306,14 @@ client_init_rpc (xlator_t *this)
         ret = rpcclnt_cbk_program_register (conf->rpc, &gluster_cbk_prog,
                                             this);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, PC_MSG_RPC_CBK_FAILED,
                         "failed to register callback program");
                 goto out;
         }
 
         ret = 0;
 
-        gf_log (this->name, GF_LOG_DEBUG, "client init successful");
+        gf_msg_debug (this->name, 0, "client init successful");
 out:
         return ret;
 }
@@ -2367,8 +2338,8 @@ client_init_grace_timer (xlator_t *this, dict_t *options,
         if (!ret)
                 gf_string2boolean (lk_heal, &conf->lk_heal);
 
-        gf_log (this->name, GF_LOG_DEBUG, "lk-heal = %s",
-                (conf->lk_heal) ? "on" : "off");
+        gf_msg_debug (this->name, 0, "lk-heal = %s",
+                      (conf->lk_heal) ? "on" : "off");
 
         ret = dict_get_int32 (options, "grace-timeout", &grace_timeout);
         if (!ret)
@@ -2380,8 +2351,8 @@ client_init_grace_timer (xlator_t *this, dict_t *options,
 
         gf_time_fmt (timestr, sizeof timestr, conf->grace_ts.tv_sec,
                      gf_timefmt_s);
-        gf_log (this->name, GF_LOG_DEBUG, "Client grace timeout value = %s",
-                timestr);
+        gf_msg_debug (this->name, 0, "Client grace timeout value = %s",
+                      timestr);
 
         ret = 0;
 out:
@@ -2482,15 +2453,15 @@ init (xlator_t *this)
         clnt_conf_t *conf = NULL;
 
         if (this->children) {
-                gf_log (this->name, GF_LOG_ERROR,
-                        "FATAL: client protocol translator cannot have any "
-                        "subvolumes");
+                gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+                        PC_MSG_INVALID_ENTRY, "FATAL: client protocol "
+                        "translator cannot have any subvolumes");
                 goto out;
         }
 
         if (!this->parents) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "Volume is dangling. ");
+                gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+                        PC_MSG_INVALID_ENTRY, "Volume is dangling. ");
         }
 
         conf = GF_CALLOC (1, sizeof (*conf), gf_client_mt_clnt_conf_t);
@@ -2540,7 +2511,7 @@ init (xlator_t *this)
         this->local_pool = mem_pool_new (clnt_local_t, 64);
         if (!this->local_pool) {
                 ret = -1;
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PC_MSG_NO_MEMORY,
                         "failed to create local_t's memory pool");
                 goto out;
         }
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 40200b6..38f34d5 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -48,7 +48,8 @@ typedef enum {
                         goto label;                                     \
                 }                                                       \
                 if (remote_fd == -1) {                                  \
-                        gf_log (xl->name, GF_LOG_WARNING, " (%s) "      \
+                        gf_msg (xl->name, GF_LOG_WARNING, EBADFD,       \
+                                PC_MSG_BAD_FD, " (%s) "                 \
                                 "remote_fd is -1. EBADFD",              \
                                 uuid_utoa (fd->inode->gfid));           \
                         op_errno = EBADFD;                              \
-- 
1.7.1