diff options
author | Niels de Vos <ndevos@redhat.com> | 2014-05-08 12:30:23 -0300 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-05-22 02:48:58 -0700 |
commit | cec37c9b66b8711b213f114875d215f56b8120aa (patch) | |
tree | 3dc24701727ba90847d6b291e30d09d60a226f49 /libglusterfs/src | |
parent | 2e7ed9e196a04d19a78e2880af21b959ca1f578b (diff) |
logging: remove unused message-id scripts
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.
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>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/Makefile.am | 2 | ||||
-rw-r--r-- | libglusterfs/src/logging.c | 64 |
2 files changed, 10 insertions, 56 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am index 569d69be330..ccac1a1e825 100644 --- a/libglusterfs/src/Makefile.am +++ b/libglusterfs/src/Makefile.am @@ -29,7 +29,7 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \ $(CONTRIBDIR)/stdlib/gf_mkostemp.c strfd.c \ $(CONTRIBDIR)/mount/mntent.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 2a8335eb052..505580d1e81 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -23,16 +23,11 @@ #include <stdlib.h> #include <syslog.h> -#ifdef HAVE_LIBINTL_H -#include <libintl.h> -#endif - #ifdef HAVE_BACKTRACE #include <execinfo.h> #endif #include <sys/stat.h> -#include "gf-error-codes.h" #define GF_JSON_MSG_LENGTH 8192 #define GF_SYSLOG_CEE_FORMAT \ @@ -477,18 +472,6 @@ gf_log_fini (void *data) return ret; } -/** - * 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 @@ -516,10 +499,6 @@ gf_openlog (const char *ident, int option, int facility) /* TODO: Should check for errors here and return appropriately */ setlocale(LC_ALL, ""); -#ifdef HAVE_LIBINTL_H - bindtextdomain("gluster", "/usr/share/locale"); - textdomain("gluster"); -#endif /* close the previous syslog if open as we are changing settings */ closelog (); openlog(ident, _option, _facility); @@ -633,50 +612,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); } @@ -898,8 +855,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, @@ -1376,8 +1332,7 @@ gf_log_syslog (glusterfs_ctx_t *ctx, const char *domain, const char *file, break; case gf_logformat_cee: /* TODO: Enhance CEE with additional parameters */ - gf_syslog (GF_ERR_DEV, priority, - "[%s:%d:%s] %d-%s: %s", + gf_syslog (priority, "[%s:%d:%s] %d-%s: %s", file, line, function, graph_id, domain, *appmsgstr); break; @@ -2180,8 +2135,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; |