summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2014-05-22 16:35:48 +0200
committerNiels de Vos <ndevos@redhat.com>2014-05-24 08:26:08 -0700
commitd74024b470fdd0e1d0b14aeb7e914d4d64aa2a24 (patch)
tree32df18b6aecf37cda4d4d8af878b69970668fa2f /libglusterfs
parentcebc9cafa2ee8d4ccfa459dcddb00c6388d7bd86 (diff)
logging: remove unused message-id scriptsv3.5.1beta
The current unused implementation for message-ids in the logs depends on automatically generated files. The generated files are not included in the distributed tarball. This causes issues when distributions build packages, they need to re-run ./autogen.sh to create the needed files. I thought of including the generated files in the distribution tarball. However, the contents of these files are not actively used, so it seems to make more sense to drop it all together. These functions were the only users of libintl and gettext too, so dropped the requirement checking from configure.ac. A replacement for the message-id logging framework is in progress. Any changes that this patch makes, can be reverted in the submission of patches for the new framework. Cherry picked from commit cec37c9b66b8711b213f114875d215f56b8120aa: > Reference: http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/6212 > Change-Id: Iea82dd3910944a5c6be3ee393806eccabd575e11 > BUG: 1038391 > Signed-off-by: Niels de Vos <ndevos@redhat.com> > Reviewed-on: http://review.gluster.org/7714 > Tested-by: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Vijay Bellur <vbellur@redhat.com> Change-Id: Iea82dd3910944a5c6be3ee393806eccabd575e11 BUG: 1089054 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/7851 Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/Makefile.am2
-rw-r--r--libglusterfs/src/logging.c61
2 files changed, 10 insertions, 53 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am
index 907399ae601..e7cbcbe8467 100644
--- a/libglusterfs/src/Makefile.am
+++ b/libglusterfs/src/Makefile.am
@@ -28,7 +28,7 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \
$(CONTRIBDIR)/stdlib/gf_mkostemp.c
-nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c gf-error-codes.h
+nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c
BUILT_SOURCES = graph.lex.c
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index 0058233a7cf..4a905a24def 100644
--- a/libglusterfs/src/logging.c
+++ b/libglusterfs/src/logging.c
@@ -23,14 +23,10 @@
#include <stdlib.h>
#ifdef GF_USE_SYSLOG
-#include <libintl.h>
#include <syslog.h>
#include <sys/stat.h>
-#include "gf-error-codes.h"
#define GF_JSON_MSG_LENGTH 8192
-#define GF_SYSLOG_CEE_FORMAT \
- "@cee: {\"msg\": \"%s\", \"gf_code\": \"%u\", \"gf_message\": \"%s\"}"
#define GF_LOG_CONTROL_FILE "/etc/glusterfs/logger.conf"
#endif /* GF_USE_SYSLOG */
@@ -148,18 +144,6 @@ gf_log_fini (void *data)
}
#ifdef GF_USE_SYSLOG
-/**
- * gf_get_error_message -function to get error message for given error code
- * @error_code: error code defined by log book
- *
- * @return: success: string
- * failure: NULL
- */
-const char *
-gf_get_error_message (int error_code) {
- return _gf_get_message (error_code);
-}
-
/**
* gf_openlog -function to open syslog specific to gluster based on
@@ -186,8 +170,6 @@ gf_openlog (const char *ident, int option, int facility)
}
setlocale(LC_ALL, "");
- bindtextdomain("gluster", "/usr/share/locale");
- textdomain("gluster");
openlog(ident, _option, _facility);
}
@@ -300,50 +282,28 @@ _json_escape(const char *str, char *buf, size_t len)
/**
* gf_syslog -function to submit message to syslog specific to gluster
- * @error_code: error code defined by log book
* @facility_priority: facility_priority of syslog()
* @format: optional format string to syslog()
*
* @return: void
*/
void
-gf_syslog (int error_code, int facility_priority, char *format, ...)
+gf_syslog (int facility_priority, char *format, ...)
{
char *msg = NULL;
char json_msg[GF_JSON_MSG_LENGTH];
GF_UNUSED char *p = NULL;
- const char *error_message = NULL;
- char json_error_message[GF_JSON_MSG_LENGTH];
va_list ap;
- error_message = gf_get_error_message (error_code);
+ GF_ASSERT (format);
va_start (ap, format);
- if (format) {
- vasprintf (&msg, format, ap);
+ if (vasprintf (&msg, format, ap) != -1) {
p = _json_escape (msg, json_msg, GF_JSON_MSG_LENGTH);
- if (error_message) {
- p = _json_escape (error_message, json_error_message,
- GF_JSON_MSG_LENGTH);
- syslog (facility_priority, GF_SYSLOG_CEE_FORMAT,
- json_msg, error_code, json_error_message);
- } else {
- /* ignore the error code because no error message for it
- and use normal syslog */
- syslog (facility_priority, "%s", msg);
- }
+ syslog (facility_priority, "%s", msg);
free (msg);
- } else {
- if (error_message) {
- /* no user message: treat error_message as msg */
- syslog (facility_priority, GF_SYSLOG_CEE_FORMAT,
- json_error_message, error_code,
- json_error_message);
- } else {
- /* cannot produce log as neither error_message nor
- msg available */
- }
- }
+ } else
+ syslog (GF_LOG_CRITICAL, "vasprintf() failed, out of memory?");
va_end (ap);
}
#endif /* GF_USE_SYSLOG */
@@ -528,8 +488,7 @@ _gf_log_nomem (const char *domain, const char *file,
} else {
priority = level - 1;
}
- gf_syslog (GF_ERR_DEV, priority,
- "[%s:%d:%s] %s %s: no memory "
+ gf_syslog (priority, "[%s:%d:%s] %s %s: no memory "
"available for size (%"GF_PRI_SIZET")",
basename, line, function, callstr, domain,
size);
@@ -668,8 +627,7 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function,
vasprintf (&str2, fmt, ap);
va_end (ap);
- gf_syslog (GF_ERR_DEV, priority,
- "[%s:%d:%s] %s %d-%s: %s",
+ gf_syslog (priority, "[%s:%d:%s] %s %d-%s: %s",
basename, line, function,
callstr,
((this->graph) ? this->graph->id:0), domain,
@@ -805,8 +763,7 @@ _gf_log (const char *domain, const char *file, const char *function, int line,
vasprintf (&str2, fmt, ap);
va_end (ap);
- gf_syslog (GF_ERR_DEV, priority,
- "[%s:%d:%s] %d-%s: %s",
+ gf_syslog (priority, "[%s:%d:%s] %d-%s: %s",
basename, line, function,
((this->graph) ? this->graph->id:0), domain, str2);
goto err;