diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2014-02-07 11:02:10 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-04-30 23:52:28 -0700 |
commit | 630d46d714a233919664c035f2c5c48c028777e8 (patch) | |
tree | e7e79b240e23fde447989a4e1adc625b1858d17d /libglusterfs/src/logging.h | |
parent | f63fbca7540a4c9ce090e1ed5941ed8777ff6316 (diff) |
logging: Introduce suppression of repetitive log messages
Change-Id: I8efa08cc9832ad509fba65a88bb0cddbaf056404
BUG: 1075611
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/7475
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs/src/logging.h')
-rw-r--r-- | libglusterfs/src/logging.h | 72 |
1 files changed, 57 insertions, 15 deletions
diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h index 0c5c3b4c41c..f19fe9e1002 100644 --- a/libglusterfs/src/logging.h +++ b/libglusterfs/src/logging.h @@ -16,10 +16,12 @@ #include "config.h" #endif +#include <sys/time.h> #include <stdint.h> #include <stdio.h> #include <stdarg.h> #include <pthread.h> +#include "list.h" #ifdef GF_DARWIN_HOST_OS #define GF_PRI_FSBLK "u" @@ -96,23 +98,46 @@ typedef enum { #define DEFAULT_LOG_LEVEL GF_LOG_INFO typedef struct gf_log_handle_ { - pthread_mutex_t logfile_mutex; - uint8_t logrotate; - gf_loglevel_t loglevel; - int gf_log_syslog; - gf_loglevel_t sys_log_level; - char gf_log_xl_log_set; - char *filename; - FILE *logfile; - FILE *gf_log_logfile; - char *cmd_log_filename; - FILE *cmdlogfile; - gf_log_logger_t logger; - gf_log_format_t logformat; - char *ident; - int log_control_file_found; + pthread_mutex_t logfile_mutex; + uint8_t logrotate; + gf_loglevel_t loglevel; + int gf_log_syslog; + gf_loglevel_t sys_log_level; + char gf_log_xl_log_set; + char *filename; + FILE *logfile; + FILE *gf_log_logfile; + char *cmd_log_filename; + FILE *cmdlogfile; + gf_log_logger_t logger; + gf_log_format_t logformat; + char *ident; + int log_control_file_found; + struct list_head lru_queue; + uint32_t lru_size; + uint32_t lru_cur_size; + uint32_t timeout; + pthread_mutex_t log_buf_lock; + struct _gf_timer *log_flush_timer; } gf_log_handle_t; + +typedef struct log_buf_ { + char *msg; + uint64_t msg_id; + int errnum; + struct timeval oldest; + struct timeval latest; + char *domain; + char *file; + char *function; + int32_t line; + gf_loglevel_t level; + int refcount; + int graph_id; + struct list_head msg_list; +} log_buf_t; + void gf_log_globals_init (void *ctx); int gf_log_init (void *data, const char *filename, const char *ident); @@ -277,6 +302,23 @@ gf_log_set_logger (gf_log_logger_t logger); void gf_log_set_logformat (gf_log_format_t format); +void +gf_log_set_log_buf_size (uint32_t buf_size); + +void +gf_log_set_log_flush_timeout (uint32_t timeout); + +struct _glusterfs_ctx; + +void +gf_log_flush_msgs (struct _glusterfs_ctx *ctx); + +int +gf_log_inject_timer_event (struct _glusterfs_ctx *ctx); + +void +gf_log_disable_suppression_before_exit (struct _glusterfs_ctx *ctx); + #define GF_DEBUG(xl, format, args...) \ gf_log ((xl)->name, GF_LOG_DEBUG, format, ##args) #define GF_INFO(xl, format, args...) \ |