Blob Blame History Raw
From 721e99e499ae3b2ac1903282eeef6fdd2676678d Mon Sep 17 00:00:00 2001
From: Mohamed Ashiq <ashiq333@gmail.com>
Date: Fri, 17 Apr 2015 17:33:49 +0530
Subject: [PATCH 157/190] bit-rot : New logging framework for bit-rot log message

    Backport of http://review.gluster.org/10297

Change-Id: I83c494f2bb60d29495cd643659774d430325af0a
BUG: 1231796
Signed-off-by: Mohamed Ashiq <ashiq333@gmail.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/51559
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Tested-by: Raghavendra Bhat <raghavendra@redhat.com>
---
 libglusterfs/src/glfs-message-id.h                 |   12 +-
 xlators/features/bit-rot/src/bitd/Makefile.am      |    2 +-
 .../bit-rot/src/bitd/bit-rot-bitd-messages.h       |  391 ++++++++++++++++++++
 xlators/features/bit-rot/src/bitd/bit-rot-scrub.c  |  101 +++---
 xlators/features/bit-rot/src/bitd/bit-rot.c        |  239 +++++++-----
 xlators/features/bit-rot/src/stub/Makefile.am      |    2 +-
 .../bit-rot/src/stub/bit-rot-stub-messages.h       |  158 ++++++++
 xlators/features/bit-rot/src/stub/bit-rot-stub.c   |  116 ++++---
 xlators/features/bit-rot/src/stub/bit-rot-stub.h   |    7 +-
 9 files changed, 821 insertions(+), 207 deletions(-)
 create mode 100644 xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h
 create mode 100644 xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h

diff --git a/libglusterfs/src/glfs-message-id.h b/libglusterfs/src/glfs-message-id.h
index 242e487..099ae2c 100644
--- a/libglusterfs/src/glfs-message-id.h
+++ b/libglusterfs/src/glfs-message-id.h
@@ -93,19 +93,19 @@
 #define GLFS_MSGID_COMP_PS_END             (GLFS_MSGID_COMP_PS +\
                                            GLFS_MSGID_SEGMENT)
 
-#define GLFS_MSGID_COMP_PERF               GLFS_MSGID_COMP_PS_END
-#define GLFS_MSGID_COMP_PERF_END           (GLFS_MSGID_COMP_PERF +\
+#define GLFS_MSGID_COMP_BITROT_STUB        GLFS_MSGID_COMP_PS_END
+#define GLFS_MSGID_COMP_BITROT_STUB_END    (GLFS_MSGID_COMP_BITROT_STUB +\
                                            GLFS_MSGID_SEGMENT)
 
-#define GLFS_MSGID_COMP_CHANGELOG          GLFS_MSGID_COMP_PERF_END
+#define GLFS_MSGID_COMP_CHANGELOG          GLFS_MSGID_COMP_BITROT_STUB_END
 #define GLFS_MSGID_COMP_CHANGELOG_END      (GLFS_MSGID_COMP_CHANGELOG +\
                                            GLFS_MSGID_SEGMENT)
 
-#define GLFS_MSGID_COMP_BITROT             GLFS_MSGID_COMP_CHANGELOG_END
-#define GLFS_MSGID_COMP_BITROT_END         (GLFS_MSGID_COMP_BITROT +\
+#define GLFS_MSGID_COMP_BITROT_BITD        GLFS_MSGID_COMP_CHANGELOG_END
+#define GLFS_MSGID_COMP_BITROT_BITD_END    (GLFS_MSGID_COMP_BITROT_BITD +\
                                            GLFS_MSGID_SEGMENT)
 
-#define GLFS_MSGID_COMP_RPC_TRANS_SOCKET        GLFS_MSGID_COMP_BITROT_END
+#define GLFS_MSGID_COMP_RPC_TRANS_SOCKET        GLFS_MSGID_COMP_BITROT_BITD_END
 #define GLFS_MSGID_COMP_RPC_TRANS_SOCKET_END    (GLFS_MSGID_COMP_RPC_TRANS_SOCKET + \
                                                 GLFS_MSGID_SEGMENT)
 
diff --git a/xlators/features/bit-rot/src/bitd/Makefile.am b/xlators/features/bit-rot/src/bitd/Makefile.am
index f67fa1a..fd42ebe 100644
--- a/xlators/features/bit-rot/src/bitd/Makefile.am
+++ b/xlators/features/bit-rot/src/bitd/Makefile.am
@@ -13,7 +13,7 @@ bit_rot_la_SOURCES = bit-rot.c bit-rot-scrub.c bit-rot-tbf.c
 bit_rot_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
                     $(top_builddir)/xlators/features/changelog/lib/src/libgfchangelog.la
 
-noinst_HEADERS = bit-rot.h bit-rot-scrub.h bit-rot-tbf.h
+noinst_HEADERS = bit-rot.h bit-rot-scrub.h bit-rot-tbf.h bit-rot-bitd-messages.h
 
 AM_CFLAGS = -Wall $(GF_CFLAGS)
 
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h b/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h
new file mode 100644
index 0000000..af3a74f
--- /dev/null
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-bitd-messages.h
@@ -0,0 +1,391 @@
+/*
+ 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 _BITROT_BITD_MESSAGES_H_
+#define _BITROT_BITD_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/* file bit-rot-bitd-messages.h
+ * brief BIT-ROT 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 redability 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_BITROT_BITD_BASE                   GLFS_MSGID_COMP_BITROT_BITD
+#define GLFS_BITROT_BITD_NUM_MESSAGES           48
+#define GLFS_MSGID_END                          (GLFS_BITROT_BITD_BASE + \
+                                           GLFS_BITROT_BITD_NUM_MESSAGES + 1)
+/* Messaged with message IDs */
+#define glfs_msg_start_x  GLFS_BITROT_BITD_BASE, "Invalid: Start of messages"
+/*------------*/
+
+
+#define BRB_MSG_FD_CREATE_FAILED               (GLFS_BITROT_BITD_BASE + 1)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define BRB_MSG_READV_FAILED                (GLFS_BITROT_BITD_BASE + 2)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define BRB_MSG_BLOCK_READ_FAILED           (GLFS_BITROT_BITD_BASE + 3)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_CALC_CHECKSUM_FAILED        (GLFS_BITROT_BITD_BASE + 4)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_NO_MEMORY                   (GLFS_BITROT_BITD_BASE + 5)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_GET_SIGN_FAILED             (GLFS_BITROT_BITD_BASE + 6)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SET_SIGN_FAILED             (GLFS_BITROT_BITD_BASE + 7)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_OP_FAILED                   (GLFS_BITROT_BITD_BASE + 8)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_READ_AND_SIGN_FAILED        (GLFS_BITROT_BITD_BASE + 9)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SIGN_FAILED                 (GLFS_BITROT_BITD_BASE + 10)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_GET_SUBVOL_FAILED           (GLFS_BITROT_BITD_BASE + 11)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SET_TIMER_FAILED            (GLFS_BITROT_BITD_BASE + 12)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_GET_INFO_FAILED             (GLFS_BITROT_BITD_BASE + 13)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_PATH_FAILED                 (GLFS_BITROT_BITD_BASE + 14)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_MARK_BAD_FILE               (GLFS_BITROT_BITD_BASE + 15)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_TRIGGER_SIGN                (GLFS_BITROT_BITD_BASE + 16)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_REGISTER_FAILED             (GLFS_BITROT_BITD_BASE + 17)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_CRAWLING_START              (GLFS_BITROT_BITD_BASE + 18)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SPAWN_FAILED                (GLFS_BITROT_BITD_BASE + 19)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_INVALID_SUBVOL_CHILD        (GLFS_BITROT_BITD_BASE + 20)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SKIP_OBJECT                 (GLFS_BITROT_BITD_BASE + 21)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_NO_CHILD                    (GLFS_BITROT_BITD_BASE + 22)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_CHECKSUM_MISMATCH           (GLFS_BITROT_BITD_BASE + 23)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_MARK_CORRUPTED              (GLFS_BITROT_BITD_BASE + 24)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_CRAWLING_FINISH               (GLFS_BITROT_BITD_BASE + 25)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_CALC_ERROR                  (GLFS_BITROT_BITD_BASE + 26)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_LOOKUP_FAILED               (GLFS_BITROT_BITD_BASE + 27)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_PARTIAL_VERSION_PRESENCE    (GLFS_BITROT_BITD_BASE + 28)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_MEM_ACNT_FAILED             (GLFS_BITROT_BITD_BASE + 29)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_TIMER_WHEEL_UNAVAILABLE     (GLFS_BITROT_BITD_BASE + 30)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_BITROT_LOADED               (GLFS_BITROT_BITD_BASE + 31)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SCALE_DOWN_FAILED           (GLFS_BITROT_BITD_BASE + 32)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SCALE_UP_FAILED             (GLFS_BITROT_BITD_BASE + 33)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SCALE_DOWN_SCRUBBER         (GLFS_BITROT_BITD_BASE + 34)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SCALING_UP_SCRUBBER         (GLFS_BITROT_BITD_BASE + 35)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ */
+#define BRB_MSG_UNKNOWN_THROTTLE            (GLFS_BITROT_BITD_BASE + 36)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_RATE_LIMIT_INFO             (GLFS_BITROT_BITD_BASE + 37)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SCRUB_INFO                  (GLFS_BITROT_BITD_BASE + 38)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_CONNECTED_TO_BRICK          (GLFS_BITROT_BITD_BASE + 39)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_BRICK_INFO                  (GLFS_BITROT_BITD_BASE + 40)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SUBVOL_CONNECT_FAILED       (GLFS_BITROT_BITD_BASE + 41)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_INVALID_SUBVOL              (GLFS_BITROT_BITD_BASE + 42)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_RESCHEDULE_SCRUBBER_FAILED  (GLFS_BITROT_BITD_BASE + 43)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define BRB_MSG_SCRUB_START                 (GLFS_BITROT_BITD_BASE + 44)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SCRUB_FINISH                (GLFS_BITROT_BITD_BASE + 45)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SCRUB_RUNNING               (GLFS_BITROT_BITD_BASE + 46)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SCRUB_RESCHEDULED           (GLFS_BITROT_BITD_BASE + 47)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRB_MSG_SCRUB_TUNABLE              (GLFS_BITROT_BITD_BASE + 48)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+#endif /* !_BITROT_BITD_MESSAGES_H_ */
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
index 2da4530..45499de 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
@@ -23,6 +23,7 @@
 
 #include "bit-rot-scrub.h"
 #include <pthread.h>
+#include "bit-rot-bitd-messages.h"
 
 struct br_scrubbers {
         pthread_t scrubthread;
@@ -63,7 +64,7 @@ bitd_fetch_signature (xlator_t *this, br_child_t *child,
         ret = dict_get_ptr
                 (*xattr, GLUSTERFS_GET_OBJECT_SIGNATURE, (void **) sign);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_GET_SIGN_FAILED,
                         "failed to extract signature info [GFID: %s]",
                         uuid_utoa (fd->inode->gfid));
                 goto unref_dict;
@@ -111,12 +112,12 @@ bitd_scrub_post_compute_check (xlator_t *this,
          * The log entry looks pretty ugly, but helps in debugging..
          */
         if (signptr->stale || (signptr->version != version)) {
-                gf_log (this->name, GF_LOG_DEBUG,
-                        "<STAGE: POST> Object [GFID: %s] either has a stale "
-                        "signature OR underwent signing during checksumming "
-                        "{Stale: %d | Version: %lu,%lu}",
-                        uuid_utoa (fd->inode->gfid), (signptr->stale) ? 1 : 0,
-                        version, signptr->version);
+                gf_msg_debug (this->name, 0, "<STAGE: POST> Object [GFID: %s] "
+                              "either has a stale signature OR underwent "
+                              "signing during checksumming {Stale: %d | "
+                              "Version: %lu,%lu}", uuid_utoa (fd->inode->gfid),
+                              (signptr->stale) ? 1 : 0, version,
+                              signptr->version);
                 ret = -1;
                 goto unref_dict;
         }
@@ -177,7 +178,7 @@ bitd_scrub_pre_compute_check (xlator_t *this, br_child_t *child,
         int32_t ret   = -1;
 
         if (bitd_is_bad_file (this, child, NULL, fd)) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_SKIP_OBJECT,
                         "Object [GFID: %s] is marked corrupted, skipping..",
                         uuid_utoa (fd->inode->gfid));
                 goto out;
@@ -185,9 +186,9 @@ bitd_scrub_pre_compute_check (xlator_t *this, br_child_t *child,
 
         ret = bitd_signature_staleness (this, child, fd, &stale, version);
         if (!ret && stale) {
-                gf_log (this->name, GF_LOG_DEBUG,
-                        "<STAGE: PRE> Object [GFID: %s] has stale signature",
-                        uuid_utoa (fd->inode->gfid));
+                gf_msg_debug (this->name, 0, "<STAGE: PRE> Object [GFID: %s] "
+                              "has stale signature",
+                              uuid_utoa (fd->inode->gfid));
                 ret = -1;
         }
 
@@ -215,13 +216,14 @@ bitd_compare_ckum (xlator_t *this,
 
         if (strncmp
             (sign->signature, (char *) md, strlen (sign->signature)) == 0) {
-                gf_log (this->name, GF_LOG_DEBUG, "%s [GFID: %s | Brick: %s] "
-                        "matches calculated checksum", loc->path,
-                        uuid_utoa (linked_inode->gfid), child->brick_path);
+                gf_msg_debug (this->name, 0, "%s [GFID: %s | Brick: %s] "
+                              "matches calculated checksum", loc->path,
+                              uuid_utoa (linked_inode->gfid),
+                              child->brick_path);
                 return 0;
         }
 
-        gf_log (this->name, GF_LOG_ALERT,
+        gf_msg (this->name, GF_LOG_ALERT, 0, BRB_MSG_CHECKSUM_MISMATCH,
                 "Object checksum mismatch: %s [GFID: %s | Brick: %s]",
                 loc->path, uuid_utoa (linked_inode->gfid), child->brick_path);
 
@@ -234,19 +236,19 @@ bitd_compare_ckum (xlator_t *this,
 
         ret = dict_set_int32 (xattr, BITROT_OBJECT_BAD_KEY, _gf_true);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_MARK_BAD_FILE,
                         "Error setting bad-file marker for %s [GFID: %s | "
                         "Brick: %s]", loc->path, uuid_utoa (linked_inode->gfid),
                         child->brick_path);
                 goto dictfree;
         }
 
-        gf_log (this->name, GF_LOG_INFO, "Marking %s [GFID: %s | Brick: %s] "
-                "as corrupted..", loc->path, uuid_utoa (linked_inode->gfid),
-                child->brick_path);
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_MARK_CORRUPTED, "Marking %s"
+                " [GFID: %s | Brick: %s] as corrupted..", loc->path,
+                uuid_utoa (linked_inode->gfid), child->brick_path);
         ret = syncop_fsetxattr (child->xl, fd, xattr, 0, NULL, NULL);
         if (ret)
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_MARK_BAD_FILE,
                         "Error marking object %s [GFID: %s] as corrupted",
                         loc->path, uuid_utoa (linked_inode->gfid));
 
@@ -308,12 +310,12 @@ br_scrubber_scrub_begin (xlator_t *this, struct br_fsscan_entry *fsentry)
         if (linked_inode)
                 inode_lookup (linked_inode);
 
-        gf_log (this->name, GF_LOG_DEBUG, "Scrubbing object %s [GFID: %s]",
-                entry->d_name, uuid_utoa (linked_inode->gfid));
+        gf_msg_debug (this->name, 0, "Scrubbing object %s [GFID: %s]",
+                      entry->d_name, uuid_utoa (linked_inode->gfid));
 
         if (iatt.ia_type != IA_IFREG) {
-                gf_log (this->name, GF_LOG_DEBUG, "%s is not a regular "
-                        "file", entry->d_name);
+                gf_msg_debug (this->name, 0, "%s is not a regular file",
+                              entry->d_name);
                 ret = 0;
                 goto unref_inode;
         }
@@ -323,8 +325,9 @@ br_scrubber_scrub_begin (xlator_t *this, struct br_fsscan_entry *fsentry)
          */
         fd = fd_create (linked_inode, 0);
         if (!fd) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to create fd for "
-                        "inode %s", uuid_utoa (linked_inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_FD_CREATE_FAILED,
+                        "failed to create fd for inode %s",
+                        uuid_utoa (linked_inode->gfid));
                 goto unref_inode;
         }
 
@@ -355,8 +358,9 @@ br_scrubber_scrub_begin (xlator_t *this, struct br_fsscan_entry *fsentry)
 
         ret = br_calculate_obj_checksum (md, child, fd, &iatt);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR, "error calculating hash "
-                        "for object [GFID: %s]", uuid_utoa (fd->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_CALC_ERROR,
+                        "error calculating hash for object [GFID: %s]",
+                        uuid_utoa (fd->inode->gfid));
                 ret = -1;
                 goto free_md;
         }
@@ -517,8 +521,15 @@ br_fsscanner_log_time (xlator_t *this, br_child_t *child, const char *sfx)
         gettimeofday (&tv, NULL);
         gf_time_fmt (timestr, sizeof (timestr), tv.tv_sec, gf_timefmt_FT);
 
-        gf_log (this->name, GF_LOG_INFO,
-                "Scrubbing \"%s\" %s at %s", child->brick_path, sfx, timestr);
+        if (strcasecmp (sfx, "started") == 0) {
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_START,
+                        "Scrubbing \"%s\" %s at %s", child->brick_path, sfx,
+                        timestr);
+        } else {
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_FINISH,
+                        "Scrubbing \"%s\" %s at %s", child->brick_path, sfx,
+                        timestr);
+        }
 }
 
 static void
@@ -675,8 +686,8 @@ br_fsscan_schedule (xlator_t *this, br_child_t *child,
 
         gf_time_fmt (timestr, sizeof (timestr),
                      (fsscan->boot + timo), gf_timefmt_FT);
-        gf_log (this->name, GF_LOG_INFO, "Scrubbing for %s scheduled to "
-                "run at %s", child->brick_path, timestr);
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_INFO, "Scrubbing for "
+                "%s scheduled to run at %s", child->brick_path, timestr);
 
         return 0;
 
@@ -711,11 +722,12 @@ br_fsscan_reschedule (xlator_t *this,
                 ret = gf_tw_mod_timer (priv->timer_wheel, fsscan->timer, timo);
 
         if (!ret && pendingcheck)
-                gf_log (this->name, GF_LOG_INFO,
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_RUNNING,
                         "Scrubber for %s is currently running and would be "
                         "rescheduled after completion", child->brick_path);
         else
-                gf_log (this->name, GF_LOG_INFO, "Scrubbing for %s rescheduled "
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_RESCHEDULED,
+                        "Scrubbing for %s rescheduled "
                         "to run at %s", child->brick_path, timestr);
 
         return 0;
@@ -758,7 +770,7 @@ br_scrubber_calc_scale (xlator_t *this,
                               pow (M_E, BR_SCRUB_THREAD_SCALE_AGGRESSIVE);
                 break;
         default:
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_UNKNOWN_THROTTLE,
                         "Unknown throttle %d", throttle);
         }
 
@@ -933,7 +945,7 @@ br_scrubber_scale_up (xlator_t *this,
 
         diff = (int)(v2 - v1);
 
-        gf_log (this->name, GF_LOG_INFO,
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCALING_UP_SCRUBBER,
                 "Scaling up scrubbers [%d => %d]", v1, v2);
 
         for (i = 0; i < diff; i++) {
@@ -956,7 +968,7 @@ br_scrubber_scale_up (xlator_t *this,
                 goto error_return;
 
         if (i != diff) /* degraded scaling.. */
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_SCALE_UP_FAILED,
                         "Could not fully scale up to %d scrubber(s). Spawned "
                         "%d/%d [total scrubber(s): %d]", v2, i, diff, (v1 + i));
 
@@ -978,7 +990,7 @@ br_scrubber_scale_down (xlator_t *this,
 
         diff = (int)(v1 - v2);
 
-        gf_log (this->name, GF_LOG_INFO,
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCALE_DOWN_SCRUBBER,
                 "Scaling down scrubbers [%d => %d]", v1, v2);
 
         for (i = 0 ; i < diff; i++) {
@@ -995,10 +1007,10 @@ br_scrubber_scale_down (xlator_t *this,
         }
 
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING,
-                        "Could not fully scale down to %d scrubber(s). "
-                        "Terminated %d/%d [total scrubber(s): %d]",
-                        v1, i, diff, (v2 - i));
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        BRB_MSG_SCALE_DOWN_FAILED, "Could not fully scale down "
+                        "to %d scrubber(s). Terminated %d/%d [total "
+                        "scrubber(s): %d]", v1, i, diff, (v2 - i));
                 ret = 0;
         }
 
@@ -1162,8 +1174,9 @@ static void br_scrubber_log_option (xlator_t *this,
         if (scrubstall)
                 return; /* logged as pause */
 
-        gf_log (this->name, GF_LOG_INFO, "SCRUB TUNABLES:: [Frequency: %s, "
-                "Throttle: %s]", scrub_freq_str[fsscrub->frequency],
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_TUNABLE, "SCRUB "
+                "TUNABLES:: [Frequency: %s, Throttle: %s]",
+                scrub_freq_str[fsscrub->frequency],
                 scrub_throttle_str[fsscrub->throttle]);
 }
 
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
index 228cf34..c06a5c1 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
@@ -24,6 +24,7 @@
 #include "bit-rot.h"
 #include "bit-rot-scrub.h"
 #include <pthread.h>
+#include "bit-rot-bitd-messages.h"
 
 #include "tw.h"
 
@@ -179,8 +180,8 @@ bitd_is_bad_file (xlator_t *this, br_child_t *child, loc_t *loc, fd_t *fd)
                                        NULL);
 
         if (!ret) {
-                gf_log (this->name, GF_LOG_DEBUG, "[GFID: %s] is marked "
-                        "corrupted", uuid_utoa (inode->gfid));
+                gf_msg_debug (this->name, 0, "[GFID: %s] is marked corrupted",
+                              uuid_utoa (inode->gfid));
                 bad_file = _gf_true;
         }
 
@@ -257,8 +258,9 @@ br_object_open (xlator_t *this,
         ret = -EINVAL;
         fd = fd_create (inode, 0);
         if (!fd) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to create fd for the "
-                        "inode %s", uuid_utoa (inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_FD_CREATE_FAILED,
+                        "failed to create fd for the inode %s",
+                        uuid_utoa (inode->gfid));
                 goto out;
         }
 
@@ -313,8 +315,8 @@ br_object_read_block_and_sign (xlator_t *this, fd_t *fd, br_child_t *child,
                             NULL);
 
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "readv on %s failed (%s)",
-                        uuid_utoa (fd->inode->gfid), strerror (errno));
+                gf_msg (this->name, GF_LOG_ERROR, errno, BRB_MSG_READV_FAILED,
+                        "readv on %s failed", uuid_utoa (fd->inode->gfid));
                 ret = -1;
                 goto out;
         }
@@ -364,7 +366,8 @@ br_calculate_obj_checksum (unsigned char *md,
                 ret = br_object_read_block_and_sign (this, fd, child,
                                                      offset, block, &sha256);
                 if (ret < 0) {
-                        gf_log (this->name, GF_LOG_ERROR, "reading block with "
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                BRB_MSG_BLOCK_READ_FAILED, "reading block with "
                                 "offset %lu of object %s failed", offset,
                                 uuid_utoa (fd->inode->gfid));
                         break;
@@ -408,24 +411,27 @@ br_object_read_sign (inode_t *linked_inode, fd_t *fd, br_object_t *object,
 
         md = GF_CALLOC (SHA256_DIGEST_LENGTH, sizeof (*md), gf_common_mt_char);
         if (!md) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate memory "
-                        "for saving hash of the object %s",
-                        uuid_utoa (fd->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRB_MSG_NO_MEMORY,
+                        "failed to allocate memory for saving hash of the "
+                        "object %s", uuid_utoa (fd->inode->gfid));
                 goto out;
         }
 
         ret = br_object_checksum (md, object, fd, iatt);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR, "calculating checksum for "
-                        "the object %s failed", uuid_utoa (linked_inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        BRB_MSG_CALC_CHECKSUM_FAILED, "calculating checksum "
+                        "for the object %s failed",
+                        uuid_utoa (linked_inode->gfid));
                 goto free_signature;
         }
 
         sign = br_prepare_signature (md, SHA256_DIGEST_LENGTH,
                                      BR_SIGNATURE_TYPE_SHA256, object);
         if (!sign) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to get the signature "
-                        "for the object %s", uuid_utoa (fd->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_GET_SIGN_FAILED,
+                        "failed to get the signature for the object %s",
+                        uuid_utoa (fd->inode->gfid));
                 goto free_signature;
         }
 
@@ -434,16 +440,17 @@ br_object_read_sign (inode_t *linked_inode, fd_t *fd, br_object_t *object,
                  (void *)sign, signature_size (SHA256_DIGEST_LENGTH));
 
         if (!xattr) {
-                gf_log (this->name, GF_LOG_ERROR, "dict allocation for signing"
-                        " failed for the object %s",
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_SET_SIGN_FAILED,
+                        "dict allocation for signing failed for the object %s",
                         uuid_utoa (fd->inode->gfid));
                 goto free_isign;
         }
 
         ret = syncop_fsetxattr (object->child->xl, fd, xattr, 0, NULL, NULL);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR, "fsetxattr of signature to "
-                        "the object %s failed", uuid_utoa (fd->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_SET_SIGN_FAILED,
+                        "fsetxattr of signature to the object %s failed",
+                        uuid_utoa (fd->inode->gfid));
                 goto unref_dict;
         }
 
@@ -469,9 +476,14 @@ void
 br_log_object (xlator_t *this, char *op, uuid_t gfid, int32_t op_errno)
 {
         int softerror = br_object_sign_softerror (op_errno);
-        gf_log (this->name, (softerror) ? GF_LOG_DEBUG : GF_LOG_ERROR,
-                "%s() failed on object %s [reason: %s]",
-                op, uuid_utoa (gfid), strerror (op_errno));
+        if (softerror) {
+                gf_msg_debug (this->name, 0, "%s() failed on object %s "
+                              "[reason: %s]", op, uuid_utoa (gfid),
+                              strerror (op_errno));
+        } else {
+                gf_msg (this->name, GF_LOG_ERROR, op_errno, BRB_MSG_OP_FAILED,
+                        "%s() failed on object %s", op, uuid_utoa (gfid));
+        }
 }
 
 void
@@ -479,9 +491,13 @@ br_log_object_path (xlator_t *this, char *op,
                     const char *path, int32_t op_errno)
 {
         int softerror = br_object_sign_softerror (op_errno);
-        gf_log (this->name, (softerror) ? GF_LOG_DEBUG : GF_LOG_ERROR,
-                "%s() failed on object %s [reason: %s]",
-                op, path, strerror (op_errno));
+        if (softerror) {
+                gf_msg_debug (this->name, 0, "%s() failed on object %s "
+                              "[reason: %s]", op, path, strerror (op_errno));
+        } else {
+                gf_msg (this->name, GF_LOG_ERROR, op_errno, BRB_MSG_OP_FAILED,
+                        "%s() failed on object %s", op, path);
+        }
 }
 
 static void
@@ -509,8 +525,9 @@ br_trigger_sign (xlator_t *this, br_child_t *child,
         ret = -1;
         fd = fd_create (linked_inode, 0);
         if (!fd) {
-                gf_log (this->name, GF_LOG_ERROR, "Failed to create fd "
-                        "[GFID %s]", uuid_utoa (linked_inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_FD_CREATE_FAILED,
+                        "Failed to create fd [GFID %s]",
+                        uuid_utoa (linked_inode->gfid));
                 goto cleanup_dict;
         }
 
@@ -534,7 +551,7 @@ br_trigger_sign (xlator_t *this, br_child_t *child,
         dict_unref (dict);
  out:
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_TRIGGER_SIGN,
                         "Could not trigger signingd for %s (reopen hint: %d)",
                         uuid_utoa (linked_inode->gfid), val);
         }
@@ -610,13 +627,14 @@ static inline int32_t br_sign_object (br_object_t *object)
          * we have an open file descriptor on the object. from here on,
          * do not be generous to file operation errors.
          */
-        gf_log (this->name, GF_LOG_DEBUG,
-                "Signing object [%s]", uuid_utoa (linked_inode->gfid));
+        gf_msg_debug (this->name, 0, "Signing object [%s]",
+                      uuid_utoa (linked_inode->gfid));
 
         ret = br_object_read_sign (linked_inode, fd, object, &iatt);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR, "reading and signing of the "
-                        "object %s failed", uuid_utoa (linked_inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        BRB_MSG_READ_AND_SIGN_FAILED, "reading and signing of "
+                        "the object %s failed", uuid_utoa (linked_inode->gfid));
                 goto unref_fd;
         }
 
@@ -670,8 +688,8 @@ br_process_object (void *arg)
 
                 ret = br_sign_object (object);
                 if (ret && !br_object_sign_softerror (-ret))
-                        gf_log (this->name, GF_LOG_ERROR,
-                                "SIGNING FAILURE [%s]",
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                BRB_MSG_SIGN_FAILED, "SIGNING FAILURE [%s]",
                                 uuid_utoa (object->gfid));
                 GF_FREE (object);
         }
@@ -795,32 +813,34 @@ br_brick_callback (void *xl, char *brick,
 
         gf_uuid_copy (gfid, ev->u.releasebr.gfid);
 
-        gf_log (this->name, GF_LOG_DEBUG,
-                "RELEASE EVENT [GFID %s]", uuid_utoa (gfid));
+        gf_msg_debug (this->name, 0, "RELEASE EVENT [GFID %s]",
+                      uuid_utoa (gfid));
 
         child = br_get_child_from_brick_path (this, brick);
         if (!child) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to get the subvolume "
-                        "for the brick %s", brick);
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_GET_SUBVOL_FAILED,
+                        "failed to get the subvolume for the brick %s", brick);
                 goto out;
         }
 
         object = br_initialize_object (this, child, ev);
         if (!object) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate "
-                        "object memory [GFID: %s]", uuid_utoa (gfid));
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRB_MSG_NO_MEMORY,
+                        "failed to allocate object memory [GFID: %s]",
+                        uuid_utoa (gfid));
                 goto out;
         }
 
         timer = br_initialize_timer (this, object, child, ev);
         if (!timer) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate "
-                        "object expiry timer [GFID: %s]", uuid_utoa (gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_SET_TIMER_FAILED,
+                        "failed to allocate object expiry timer [GFID: %s]",
+                        uuid_utoa (gfid));
                 goto free_object;
         }
 
-        gf_log (this->name, GF_LOG_DEBUG, "->callback: brick [%s], type [%d]\n",
-                brick, ev->ev_type);
+        gf_msg_debug (this->name, 0, "->callback: brick [%s], type [%d]\n",
+                      brick, ev->ev_type);
 
         return;
 
@@ -867,7 +887,7 @@ br_check_object_need_sign (xlator_t *this, dict_t *xattr, br_child_t *child)
         ret = dict_get_ptr (xattr, GLUSTERFS_GET_OBJECT_SIGNATURE,
                             (void **)&sign);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_GET_SIGN_FAILED,
                         "failed to get object signature info");
                 goto out;
         }
@@ -895,8 +915,8 @@ br_prepare_loc (xlator_t *this, br_child_t *child, loc_t *parent,
         else {
                 loc->inode = inode;
                 if (loc->inode->ia_type != IA_IFREG) {
-                        gf_log (this->name, GF_LOG_DEBUG, "%s is not a regular "
-                                "file", entry->d_name);
+                        gf_msg_debug (this->name, 0, "%s is not a regular "
+                                      "file", entry->d_name);
                         ret = 0;
                         goto out;
                 }
@@ -907,8 +927,8 @@ br_prepare_loc (xlator_t *this, br_child_t *child, loc_t *parent,
 
         ret = inode_path (parent->inode, entry->d_name, (char **)&loc->path);
         if (ret < 0 || !loc->path) {
-                gf_log (this->name, GF_LOG_ERROR, "inode_path on %s "
-                        "(parent: %s) failed", entry->d_name,
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_PATH_FAILED,
+                        "inode_path on %s (parent: %s) failed", entry->d_name,
                         uuid_utoa (parent->inode->gfid));
                 goto out;
         }
@@ -969,8 +989,8 @@ bitd_oneshot_crawl (xlator_t *subvol,
                 inode_lookup (linked_inode);
 
         if (iatt.ia_type != IA_IFREG) {
-                gf_log (this->name, GF_LOG_DEBUG,
-                        "%s is not a regular file, skipping..", entry->d_name);
+                gf_msg_debug (this->name, 0,  "%s is not a regular file, "
+                              "skipping..", entry->d_name);
                 ret = 0;
                 goto unref_inode;
         }
@@ -992,7 +1012,7 @@ bitd_oneshot_crawl (xlator_t *subvol,
          */
 
         if (bitd_is_bad_file (this, child, &loc, NULL)) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_SKIP_OBJECT,
                         "Entry [%s] is marked corrupted.. skipping.", loc.path);
                 goto unref_inode;
         }
@@ -1010,9 +1030,10 @@ bitd_oneshot_crawl (xlator_t *subvol,
                 if (op_errno == ENODATA && (iatt.ia_size != 0))
                         need_signing = _gf_true;
                 if (op_errno == EINVAL)
-                        gf_log (this->name, GF_LOG_WARNING, "Partial version "
-                                "xattr presence detected, ignoring [GFID: %s]",
-                                uuid_utoa (linked_inode->gfid));
+                        gf_msg (this->name, GF_LOG_WARNING, 0,
+                                BRB_MSG_PARTIAL_VERSION_PRESENCE, "Partial "
+                                "version xattr presence detected, ignoring "
+                                "[GFID: %s]", uuid_utoa (linked_inode->gfid));
         } else {
                 need_signing = br_check_object_need_sign (this, xattr, child);
         }
@@ -1020,7 +1041,7 @@ bitd_oneshot_crawl (xlator_t *subvol,
         if (!need_signing)
                 goto unref_dict;
 
-        gf_log (this->name, GF_LOG_INFO,
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_TRIGGER_SIGN,
                 "Triggering signing for %s [GFID: %s | Brick: %s]",
                 loc.path, uuid_utoa (linked_inode->gfid), child->brick_path);
         br_trigger_sign (this, child, linked_inode, &loc, _gf_true);
@@ -1053,8 +1074,9 @@ br_oneshot_signer (void *arg)
 
         THIS = this;
 
-        gf_log (this->name, GF_LOG_INFO, "Crawling brick [%s], scanning "
-                "for unsigned objects", child->brick_path);
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_CRAWLING_START,
+                "Crawling brick [%s], scanning for unsigned objects",
+                child->brick_path);
 
         loc.inode = child->table->root;
         (void) syncop_ftw_throttle
@@ -1062,7 +1084,7 @@ br_oneshot_signer (void *arg)
                          GF_CLIENT_PID_BITD, child, bitd_oneshot_crawl,
                          BR_CRAWL_THROTTLE_COUNT, BR_CRAWL_THROTTLE_ZZZ);
 
-        gf_log (this->name, GF_LOG_INFO,
+        gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_CRAWLING_FINISH,
                 "Completed crawling brick [%s]", child->brick_path);
 
         return NULL;
@@ -1097,15 +1119,16 @@ br_enact_signer (xlator_t *this, br_child_t *child, br_stub_init_t *stub)
         ret = gf_changelog_register_generic
                          (brick, 1, 1, this->ctx->cmd_args.log_file, -1, this);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR, "Register to changelog failed"
-                        " [Reason: %s]", strerror (errno));
+                gf_msg (this->name, GF_LOG_ERROR, errno,
+                        BRB_MSG_REGISTER_FAILED, "Register to changelog "
+                        "failed");
                 goto dealloc;
         }
 
         child->threadrunning = 0;
         ret = gf_thread_create (&child->thread, NULL, br_oneshot_signer, child);
         if (ret)
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_SPAWN_FAILED,
                         "failed to spawn FS crawler thread");
         else
                 child->threadrunning = 1;
@@ -1148,8 +1171,9 @@ br_enact_scrubber (xlator_t *this, br_child_t *child)
 
         ret = gf_thread_create (&child->thread, NULL, br_fsscanner, child);
         if (ret != 0) {
-                gf_log (this->name, GF_LOG_ALERT, "failed to spawn bitrot "
-                        "scrubber daemon [Brick: %s]", child->brick_path);
+                gf_msg (this->name, GF_LOG_ALERT, 0, BRB_MSG_SPAWN_FAILED,
+                        "failed to spawn bitrot scrubber daemon [Brick: %s]",
+                        child->brick_path);
                 goto error_return;
         }
 
@@ -1211,8 +1235,8 @@ br_brick_connect (xlator_t *this, br_child_t *child)
         if (ret) {
                 op_errno = -ret;
                 ret = -1;
-                gf_log (this->name, GF_LOG_ERROR, "lookup on root failed "
-                        "[Reason: %s]", strerror (op_errno));
+                gf_msg (this->name, GF_LOG_ERROR, op_errno,
+                        BRB_MSG_LOOKUP_FAILED, "lookup on root failed");
                 goto wipeloc;
         }
 
@@ -1221,15 +1245,15 @@ br_brick_connect (xlator_t *this, br_child_t *child)
         if (ret) {
                 op_errno = -ret;
                 ret = -1;
-                gf_log (this->name, GF_LOG_ERROR, "failed to get stub info "
-                        "[Reason: %s]", strerror (op_errno));
+                gf_msg (this->name, GF_LOG_ERROR, op_errno,
+                        BRB_MSG_GET_INFO_FAILED, "failed to get stub info");
                 goto wipeloc;
         }
 
         ret = dict_get_ptr (xattr, GLUSTERFS_GET_BR_STUB_INIT_TIME,
                             (void **)&stub);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_GET_INFO_FAILED,
                         "failed to extract stub information");
                 goto free_dict;
         }
@@ -1244,7 +1268,7 @@ br_brick_connect (xlator_t *this, br_child_t *child)
                 ret = br_enact_signer (this, child, stub);
 
         if (!ret)
-                gf_log (this->name, GF_LOG_INFO,
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_CONNECTED_TO_BRICK,
                         "Connected to brick %s..", child->brick_path);
 
  free_dict:
@@ -1293,8 +1317,9 @@ br_handle_events (void *arg)
 
                 ret = br_brick_connect (this, child);
                 if (ret)
-                        gf_log (this->name, GF_LOG_ERROR, "failed to connect "
-                                "to subvolume %s", child->xl->name);
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                BRB_MSG_SUBVOL_CONNECT_FAILED, "failed to "
+                                "connect to subvolume %s", child->xl->name);
         }
 
         return NULL;
@@ -1311,8 +1336,8 @@ mem_acct_init (xlator_t *this)
         ret = xlator_mem_acct_init (this, gf_br_stub_mt_end + 1);
 
         if (ret != 0) {
-                gf_log (this->name, GF_LOG_WARNING, "Memory accounting"
-                        " init failed");
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_MEM_ACNT_FAILED,
+                        "Memory accounting init failed");
                 return ret;
         }
 
@@ -1330,15 +1355,16 @@ notify (xlator_t *this, int32_t event, void *data, ...)
         subvol = (xlator_t *)data;
         priv = this->private;
 
-        gf_log (this->name, GF_LOG_TRACE, "Notification received: %d", event);
+        gf_msg_trace (this->name, 0, "Notification received: %d", event);
 
         idx = br_find_child_index (this, subvol);
 
         switch (event) {
         case GF_EVENT_CHILD_UP:
                 if (idx < 0) {
-                        gf_log (this->name, GF_LOG_ERROR,
-                                "Got event %d from invalid subvolume", event);
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                BRB_MSG_INVALID_SUBVOL, "Got event %d from "
+                                "invalid subvolume", event);
                         goto out;
                 }
 
@@ -1366,7 +1392,8 @@ notify (xlator_t *this, int32_t event, void *data, ...)
 
         case GF_EVENT_CHILD_DOWN:
                 if (idx < 0) {
-                        gf_log (this->name, GF_LOG_ERROR,
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                BRB_MSG_INVALID_SUBVOL_CHILD,
                                 "Got event %d from invalid subvolume", event);
                         goto out;
                 }
@@ -1430,8 +1457,9 @@ br_init_signer (xlator_t *this, br_private_t *priv)
                 ret = gf_thread_create (&priv->obj_queue->workers[i], NULL,
                                         br_process_object, this);
                 if (ret != 0) {
-                        gf_log (this->name, GF_LOG_ERROR,
-                                "thread creation failed (%s)", strerror (-ret));
+                        gf_msg (this->name, GF_LOG_ERROR, -ret,
+                                BRB_MSG_SPAWN_FAILED, "thread creation"
+                                " failed");
                         ret = -1;
                         goto cleanup_threads;
                 }
@@ -1482,10 +1510,10 @@ br_rate_limit_signer (xlator_t *this, int child_count, int numbricks)
 #endif
 
         if (!spec.rate)
-                gf_log (this->name,
-                GF_LOG_INFO, "[Rate Limit Info] \"FULL THROTTLE\"");
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_RATE_LIMIT_INFO,
+                        "[Rate Limit Info] \"FULL THROTTLE\"");
         else
-                gf_log (this->name, GF_LOG_INFO,
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_RATE_LIMIT_INFO,
                         "[Rate Limit Info] \"tokens/sec (rate): %lu, "
                         "maxlimit: %lu\"", spec.rate, spec.maxlimit);
 
@@ -1540,17 +1568,18 @@ init (xlator_t *this)
 {
         int            i    = 0;
         int32_t        ret  = -1;
-	br_private_t  *priv = NULL;
+        br_private_t  *priv = NULL;
         xlator_list_t *trav = NULL;
 
-	if (!this->children) {
-		gf_log (this->name, GF_LOG_ERROR, "FATAL: no children");
-		goto out;
-	}
+        if (!this->children) {
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRB_MSG_NO_CHILD,
+                        "FATAL: no children");
+                goto out;
+        }
 
         priv = GF_CALLOC (1, sizeof (*priv), gf_br_mt_br_private_t);
         if (!priv) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRB_MSG_NO_MEMORY,
                         "failed to allocate memory (->priv)");
                 goto out;
         }
@@ -1571,8 +1600,9 @@ init (xlator_t *this)
                 priv->children[i].timer_pool =
                                   mem_pool_new (struct gf_tw_timer_list,  4096);
                 if (!priv->children[i].timer_pool) {
-                        gf_log (this->name, GF_LOG_ERROR,
-                                "failed to allocate mem-pool for timer");
+                        gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+                                BRB_MSG_NO_MEMORY, "failed to allocate mem-pool"
+                                " for timer");
                         errno = ENOMEM;
                         goto free_children;
                 }
@@ -1591,7 +1621,8 @@ init (xlator_t *this)
 
         priv->timer_wheel = glusterfs_global_timer_wheel (this);
         if (!priv->timer_wheel) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        BRB_MSG_TIMER_WHEEL_UNAVAILABLE,
                         "global timer wheel unavailable");
                 goto cleanup_mutex;
         }
@@ -1613,13 +1644,13 @@ init (xlator_t *this)
 
         ret = gf_thread_create (&priv->thread, NULL, br_handle_events, this);
         if (ret != 0) {
-                gf_log (this->name, GF_LOG_ERROR,
-                        "thread creation failed (%s)", strerror (-ret));
+                gf_msg (this->name, GF_LOG_ERROR, -ret,
+                        BRB_MSG_SPAWN_FAILED, "thread creation failed");
                 ret = -1;
         }
 
         if (!ret) {
-                gf_log (this->name, GF_LOG_INFO,
+                gf_msg (this->name, GF_LOG_INFO, 0, BRB_MSG_BITROT_LOADED,
                         "bit-rot xlator loaded in \"%s\" mode",
                         (priv->iamscrubber) ? "SCRUBBER" : "SIGNER");
                 return 0;
@@ -1691,11 +1722,11 @@ reconfigure (xlator_t *this, dict_t *options)
                 for (; i < priv->child_count; i++) {
                         child = &priv->children[i];
                         if (!child->child_up) {
-                                gf_log (this->name, GF_LOG_INFO,
-                                        "Brick %s is offline, skipping "
-                                        "rescheduling (scrub would auto- "
-                                        "schedule when brick is back online).",
-                                        child->brick_path);
+                                gf_msg (this->name, GF_LOG_INFO, 0,
+                                        BRB_MSG_BRICK_INFO, "Brick %s is "
+                                        "offline, skipping rescheduling (scrub"
+                                        " would auto- schedule when brick is "
+                                        "back online).", child->brick_path);
                                 continue;
                         }
 
@@ -1703,10 +1734,12 @@ reconfigure (xlator_t *this, dict_t *options)
                         ret = br_fsscan_reschedule (this, child,
                                                     fsscan, fsscrub, _gf_true);
                         if (ret) {
-                                gf_log (this->name, GF_LOG_ERROR, "Could not "
-                                        "reschedule scrubber for brick: %s. "
-                                        "Scubbing will continue according to "
-                                        "old frequency.", child->brick_path);
+                                gf_msg (this->name, GF_LOG_ERROR, 0,
+                                        BRB_MSG_RESCHEDULE_SCRUBBER_FAILED,
+                                        "Could not reschedule scrubber for "
+                                        "brick: %s. Scubbing will continue "
+                                        "according to old frequency.",
+                                        child->brick_path);
                         }
                 }
         }
diff --git a/xlators/features/bit-rot/src/stub/Makefile.am b/xlators/features/bit-rot/src/stub/Makefile.am
index 579dd1c..30e7ca7 100644
--- a/xlators/features/bit-rot/src/stub/Makefile.am
+++ b/xlators/features/bit-rot/src/stub/Makefile.am
@@ -7,7 +7,7 @@ bitrot_stub_la_SOURCES = bit-rot-stub.c
 bitrot_stub_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
 
 noinst_HEADERS = bit-rot-stub.h bit-rot-common.h bit-rot-stub-mem-types.h \
-                 bit-rot-object-version.h
+                 bit-rot-object-version.h bit-rot-stub-messages.h
 
 AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src
 
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h b/xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h
new file mode 100644
index 0000000..d940b65
--- /dev/null
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub-messages.h
@@ -0,0 +1,158 @@
+/*
+ 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 _BITROT_STUB_MESSAGES_H_
+#define _BITROT_STUB_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/* file bit-rot-stub-messages.h
+ * brief BIT-ROT 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 redability 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_BITROT_STUB_BASE                   GLFS_MSGID_COMP_BITROT_STUB
+#define GLFS_BITROT_STUB_NUM_MESSAGES           15
+#define GLFS_MSGID_END         (GLFS_BITROT_STUB_BASE + \
+                                GLFS_BITROT_STUB_NUM_MESSAGES + 1)
+/* Messaged with message IDs */
+#define glfs_msg_start_x   GLFS_BITROT_STUB_BASE, "Invalid: Start of messages"
+/*------------*/
+
+
+#define BRS_MSG_NO_MEMORY                   (GLFS_BITROT_STUB_BASE + 1)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_SET_EVENT_FAILED            (GLFS_BITROT_STUB_BASE + 2)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_MEM_ACNT_FAILED             (GLFS_BITROT_STUB_BASE + 3)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_CREATE_FRAME_FAILED         (GLFS_BITROT_STUB_BASE + 4)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_SET_CONTEXT_FAILED          (GLFS_BITROT_STUB_BASE + 5)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_CHANGE_VERSION_FAILED       (GLFS_BITROT_STUB_BASE + 6)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_ADD_FD_TO_LIST_FAILED       (GLFS_BITROT_STUB_BASE + 7)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_SET_FD_CONTEXT_FAILED       (GLFS_BITROT_STUB_BASE + 8)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_CREATE_ANONYMOUS_FD_FAILED  (GLFS_BITROT_STUB_BASE + 9)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_NO_CHILD                    (GLFS_BITROT_STUB_BASE + 10)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_STUB_ALLOC_FAILED           (GLFS_BITROT_STUB_BASE + 11)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_GET_INODE_CONTEXT_FAILED    (GLFS_BITROT_STUB_BASE + 12)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_CANCEL_SIGN_THREAD_FAILED   (GLFS_BITROT_STUB_BASE + 13)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_ADD_FD_TO_INODE             (GLFS_BITROT_STUB_BASE + 14)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+#define BRS_MSG_SIGN_VERSION_ERROR          (GLFS_BITROT_STUB_BASE + 15)
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+#endif /* !_BITROT_STUB_MESSAGES_H_ */
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
index d4aecdc..600eb80 100644
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
@@ -25,7 +25,7 @@
 
 #include "bit-rot-stub.h"
 #include "bit-rot-stub-mem-types.h"
-
+#include "bit-rot-stub-messages.h"
 #include "bit-rot-common.h"
 
 #define BR_STUB_REQUEST_COOKIE  0x1
@@ -51,8 +51,8 @@ mem_acct_init (xlator_t *this)
         ret = xlator_mem_acct_init (this, gf_br_stub_mt_end + 1);
 
         if (ret != 0) {
-                gf_log (this->name, GF_LOG_WARNING, "Memory accounting"
-                        " init failed");
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRS_MSG_MEM_ACNT_FAILED,
+                        "Memory accounting init failed");
                 return ret;
         }
 
@@ -65,12 +65,13 @@ init (xlator_t *this)
         int32_t ret = 0;
         char *tmp = NULL;
         struct timeval tv = {0,};
-	br_stub_private_t *priv = NULL;
+        br_stub_private_t *priv = NULL;
 
-	if (!this->children) {
-		gf_log (this->name, GF_LOG_ERROR, "FATAL: no children");
-		goto error_return;
-	}
+        if (!this->children) {
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_NO_CHILD,
+                        "FATAL: no children");
+                goto error_return;
+        }
 
         priv = GF_CALLOC (1, sizeof (*priv), gf_br_stub_mt_private_t);
         if (!priv)
@@ -99,7 +100,7 @@ init (xlator_t *this)
         if (ret != 0)
                 goto cleanup_lock;
 
-        gf_log (this->name, GF_LOG_DEBUG, "bit-rot stub loaded");
+        gf_msg_debug (this->name, 0, "bit-rot stub loaded");
 	this->private = priv;
 
         return 0;
@@ -127,7 +128,8 @@ fini (xlator_t *this)
 
         ret = gf_thread_cleanup_xint (priv->signth);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        BRS_MSG_CANCEL_SIGN_THREAD_FAILED,
                         "Could not cancel sign serializer thread");
                 goto out;
         }
@@ -340,8 +342,9 @@ br_stub_need_versioning (xlator_t *this,
 
         ret = br_stub_get_inode_ctx (this, fd->inode, &ctx_addr);
         if (ret < 0) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to get the inode "
-                        "context for the inode %s",
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        BRS_MSG_GET_INODE_CONTEXT_FAILED, "failed to get the "
+                        "inode context for the inode %s",
                         uuid_utoa (fd->inode->gfid));
                 goto error_return;
         }
@@ -375,8 +378,9 @@ br_stub_anon_fd_ctx (xlator_t *this, fd_t *fd, br_stub_inode_ctx_t *ctx)
         if (!br_stub_fd) {
                 ret = br_stub_add_fd_to_inode (this, fd, ctx);
                 if (ret) {
-                        gf_log (this->name, GF_LOG_ERROR, "failed to "
-                                "add fd to the inode (gfid: %s)",
+                        gf_msg (this->name, GF_LOG_ERROR, 0,
+                                BRS_MSG_ADD_FD_TO_INODE, "failed to add fd to "
+                                "the inode (gfid: %s)",
                                 uuid_utoa (fd->inode->gfid));
                         goto out;
                 }
@@ -397,8 +401,9 @@ br_stub_versioning_prep (call_frame_t *frame,
 
         local = br_stub_alloc_local (this);
         if (!local) {
-                gf_log (this->name, GF_LOG_ERROR, "local allocation failed "
-                        "(gfid: %s)", uuid_utoa (fd->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, ENOMEM, BRS_MSG_NO_MEMORY,
+                        "local allocation failed (gfid: %s)",
+                        uuid_utoa (fd->inode->gfid));
                 goto error_return;
         }
 
@@ -693,9 +698,10 @@ br_stub_compare_sign_version (xlator_t *this,
                 if (ctx->currentversion < sbuf->signedversion) {
                         invalid = _gf_true;
                 } else if (ctx->currentversion > sbuf->signedversion) {
-                        gf_log (this->name, GF_LOG_DEBUG, "\"Signing version\" "
-                                "(%lu) lower than \"Current version \" (%lu)",
-                                ctx->currentversion, sbuf->signedversion);
+                        gf_msg_debug (this->name, 0, "\"Signing version\" "
+                                      "(%lu) lower than \"Current version \" "
+                                      "(%lu)", ctx->currentversion,
+                                      sbuf->signedversion);
                         *fakesuccess = 1;
                 }
         }
@@ -703,9 +709,10 @@ br_stub_compare_sign_version (xlator_t *this,
 
         if (invalid) {
                 ret = -1;
-                gf_log (this->name, GF_LOG_WARNING,
-                        "Signing version exceeds current version [%lu > %lu]",
-                        sbuf->signedversion, ctx->currentversion);
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        BRS_MSG_SIGN_VERSION_ERROR, "Signing version exceeds "
+                        "current version [%lu > %lu]", sbuf->signedversion,
+                        ctx->currentversion);
         }
 
  out:
@@ -875,9 +882,9 @@ br_stub_handle_object_reopen (call_frame_t *frame,
         stub = fop_fsetxattr_cbk_stub (frame, br_stub_fsetxattr_resume,
                                        0, 0, NULL);
         if (!stub) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate stub for "
-                        "fsetxattr fop (gfid: %s), unwinding",
-                        uuid_utoa (fd->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_STUB_ALLOC_FAILED,
+                        "failed to allocate stub for fsetxattr fop (gfid: %s),"
+                        " unwinding", uuid_utoa (fd->inode->gfid));
                 goto cleanup_local;
         }
 
@@ -1003,8 +1010,9 @@ br_stub_is_object_stale (xlator_t *this, call_frame_t *frame, inode_t *inode,
 
         ret = br_stub_get_inode_ctx (this, inode, &ctx_addr);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to get the inode "
-                        "context for %s", uuid_utoa (inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        BRS_MSG_GET_INODE_CONTEXT_FAILED, "failed to get the "
+                        "inode context for %s", uuid_utoa (inode->gfid));
                 goto out;
         }
 
@@ -1389,9 +1397,9 @@ br_stub_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
                                 offset, flags, iobref, xdata);
 
         if (!stub) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate stub for "
-                        "write fop (gfid: %s), unwinding",
-                        uuid_utoa (fd->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_STUB_ALLOC_FAILED,
+                        "failed to allocate stub for write fop (gfid: %s), "
+                        "unwinding", uuid_utoa (fd->inode->gfid));
                 goto cleanup_local;
         }
 
@@ -1496,9 +1504,9 @@ br_stub_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd,
         stub = fop_ftruncate_stub (frame, br_stub_ftruncate_resume, fd, offset,
                                    xdata);
         if (!stub) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate stub for "
-                        "ftruncate fop (gfid: %s), unwinding",
-                        uuid_utoa (fd->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_STUB_ALLOC_FAILED,
+                        "failed to allocate stub for ftruncate fop (gfid: %s),"
+                        " unwinding", uuid_utoa (fd->inode->gfid));
                 goto cleanup_local;
         }
 
@@ -1597,8 +1605,10 @@ br_stub_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
 
         fd = fd_anonymous (loc->inode);
         if (!fd) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to create anonymous "
-                        "fd for the inode %s", uuid_utoa (loc->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        BRS_MSG_CREATE_ANONYMOUS_FD_FAILED, "failed to create "
+                        "anonymous fd for the inode %s",
+                        uuid_utoa (loc->inode->gfid));
                 goto unwind;
         }
 
@@ -1624,9 +1634,9 @@ br_stub_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc,
         stub = fop_truncate_stub (frame, br_stub_truncate_resume, loc, offset,
                                   xdata);
         if (!stub) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to allocate stub for "
-                        "truncate fop (gfid: %s), unwinding",
-                        uuid_utoa (fd->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0, BRS_MSG_STUB_ALLOC_FAILED,
+                        "failed to allocate stub for truncate fop (gfid: %s), "
+                        "unwinding", uuid_utoa (fd->inode->gfid));
                 goto cleanup_local;
         }
 
@@ -1690,8 +1700,9 @@ br_stub_open (call_frame_t *frame, xlator_t *this,
 
         ret = br_stub_get_inode_ctx (this, fd->inode, &ctx_addr);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to get the inode "
-                        "context for the file %s (gfid: %s)", loc->path,
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        BRS_MSG_GET_INODE_CONTEXT_FAILED, "failed to get the "
+                        "inode context for the file %s (gfid: %s)", loc->path,
                         uuid_utoa (fd->inode->gfid));
                 goto unwind;
         }
@@ -1702,8 +1713,10 @@ br_stub_open (call_frame_t *frame, xlator_t *this,
 
         ret = br_stub_add_fd_to_inode (this, fd, ctx);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR, "failed add fd to the list "
-                        "(gfid: %s)", uuid_utoa (fd->inode->gfid));
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        BRS_MSG_ADD_FD_TO_LIST_FAILED,
+                        "failed add fd to the list (gfid: %s)",
+                        uuid_utoa (fd->inode->gfid));
                 goto unwind;
         }
 
@@ -1735,7 +1748,8 @@ br_stub_add_fd_to_inode (xlator_t *this, fd_t *fd, br_stub_inode_ctx_t *ctx)
 
         ret = br_stub_require_release_call (this, fd, &br_stub_fd);
         if (ret) {
-                gf_log (this->name, GF_LOG_ERROR, "failed to set the fd "
+                gf_msg (this->name, GF_LOG_ERROR, 0,
+                        BRS_MSG_SET_FD_CONTEXT_FAILED, "failed to set the fd "
                         "context for the file (gfid: %s)",
                         uuid_utoa (fd->inode->gfid));
                 goto out;
@@ -2123,7 +2137,7 @@ br_stub_send_ipc_fop (xlator_t *this, fd_t *fd, unsigned long releaseversion,
 
         xdata = dict_new ();
         if (!xdata) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, ENOMEM, BRS_MSG_NO_MEMORY,
                         "dict allocation failed: cannot send IPC FOP "
                         "to changelog");
                 goto out;
@@ -2132,14 +2146,16 @@ br_stub_send_ipc_fop (xlator_t *this, fd_t *fd, unsigned long releaseversion,
         ret = dict_set_static_bin (xdata,
                                    "RELEASE-EVENT", &ev, CHANGELOG_EV_SIZE);
         if (ret) {
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0, BRS_MSG_SET_EVENT_FAILED,
                         "cannot set release event in dict");
                 goto dealloc_dict;
         }
 
         frame = create_frame (this, this->ctx->pool);
         if (!frame) {
-                gf_log (this->name, GF_LOG_WARNING, "create_frame() failure");
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        BRS_MSG_CREATE_FRAME_FAILED,
+                        "create_frame() failure");
                 goto dealloc_dict;
         }
 
@@ -2245,10 +2261,10 @@ br_stub_release (xlator_t *this, fd_t *fd)
         UNLOCK (&inode->lock);
 
         if (ret) {
-                gf_log (this->name, GF_LOG_DEBUG,
-                        "releaseversion: %lu | flags: %d | signinfo: %d",
-                        (unsigned long) ntohl (releaseversion),
-                        flags, ntohl(signinfo));
+                gf_msg_debug (this->name, 0, "releaseversion: %lu | flags: %d "
+                              "| signinfo: %d",
+                              (unsigned long) ntohl (releaseversion), flags,
+                              ntohl(signinfo));
                 br_stub_send_ipc_fop (this, fd, releaseversion, signinfo);
         }
 
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.h b/xlators/features/bit-rot/src/stub/bit-rot-stub.h
index 9304ef8..48c7a37 100644
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub.h
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.h
@@ -24,6 +24,7 @@
 #include "bit-rot-stub-mem-types.h"
 
 #include "bit-rot-common.h"
+#include "bit-rot-stub-messages.h"
 
 typedef int (br_stub_version_cbk) (call_frame_t *, void *,
                                    xlator_t *, int32_t, int32_t, dict_t *);
@@ -223,7 +224,8 @@ br_stub_require_release_call (xlator_t *this, fd_t *fd, br_stub_fd_t **fd_ctx)
 
         ret = br_stub_fd_ctx_set (this, fd, br_stub_fd);
         if (ret)
-                gf_log (this->name, GF_LOG_WARNING,
+                gf_msg (this->name, GF_LOG_WARNING, 0,
+                        BRS_MSG_SET_CONTEXT_FAILED,
                         "could not set fd context (for release callback");
         else
                 *fd_ctx = br_stub_fd;
@@ -277,7 +279,8 @@ __br_stub_set_ongoing_version (br_stub_inode_ctx_t *ctx, unsigned long version)
         if (ctx->currentversion < version)
                 ctx->currentversion = version;
         else
-                gf_log ("bit-rot-stub", GF_LOG_WARNING, "current version: %lu"
+                gf_msg ("bit-rot-stub", GF_LOG_WARNING, 0,
+                        BRS_MSG_CHANGE_VERSION_FAILED, "current version: %lu"
                         "new version: %lu", ctx->currentversion, version);
 }
 
-- 
1.7.1