支持MESA_handle_log2

支持minidump
This commit is contained in:
fengweihao
2020-09-27 18:38:49 +08:00
parent 43e88b2a34
commit a36312c122
9 changed files with 48 additions and 19 deletions

View File

@@ -77,12 +77,12 @@ release_build_release:
BUILD_TYPE: RelWithDebInfo
PACKAGE: 1
UPLOAD: 1
SYMBOL_TARGET: certstore-install
SYMBOL_TARGET: certstore
PULP3_REPO_NAME: tsg-stable-x86_64.el7
PULP3_DIST_NAME: tsg-stable-x86_64.el7
extends: .build_by_travis
artifacts:
name: "certstore-install-$CI_COMMIT_REF_NAME-debug"
name: "certstore-$CI_COMMIT_REF_NAME-debug"
paths:
- build/*.rpm
only:
@@ -95,12 +95,12 @@ release_build_release_devel:
ENABLE_DEVEL_SWITCH: "ON"
PACKAGE: 1
UPLOAD: 1
SYMBOL_TARGET: certstore-install
SYMBOL_TARGET: certstore
PULP3_REPO_NAME: tsg-stable-x86_64.el7
PULP3_DIST_NAME: tsg-stable-x86_64.el7
extends: .build_by_travis
artifacts:
name: "certstore-install-$CI_COMMIT_REF_NAME-release"
name: "certstore-$CI_COMMIT_REF_NAME-release"
paths:
- build/*.rpm
only:

View File

@@ -34,7 +34,7 @@ env | sort
# Install dependency from YUM
yum install -y libcjson-devel libmaatframe-devel libMESA_field_stat2-devel libMESA_handle_logger-devel
yum install -y libcjson-devel libmaatframe-devel libMESA_field_stat2-devel libMESA_handle_logger-devel libbreakpad_mini-devel.x86_64
yum install -y libMESA_htable-devel libMESA_prof_load-devel librulescan-devel libwiredcfg-devel libWiredLB-devel sapp-devel
mkdir build || true

View File

@@ -5,4 +5,4 @@ add_library(common syslogd/src/logging.cpp json/src/arraylist.c json/src/debug.c
rt/src/rt_file.cpp rt/src/rt_stdlib.cpp rt/src/rt_string.cpp rt/src/rt_tmr.cpp rt/src/rt_time.cpp)
target_include_directories(common PUBLIC syslogd/include json/include rt/include)
target_link_libraries(common PUBLIC rt MESA_handle_logger)
target_link_libraries(common PUBLIC rt MESA_handle_logger breakpad_mini)

View File

@@ -19,6 +19,7 @@
#include "rt_time.h"
#include "rt_string.h"
#include "logging.h"
#include <MESA/breakpad_mini.h>
#include <MESA/MESA_prof_load.h>
#include <MESA/MESA_handle_logger.h>
@@ -32,24 +33,34 @@ void mesa_logging_print(int log_level, const char *module, const char *msg)
void cert_syslog_init(const char *config)
{
char run_log_path[256] = {0};
struct breakpad_instance *breakpad;
MESA_load_profile_int_def(config, (const char *)"SYSTEM",(const char *)"DEBUG_SWITCH",
&logging_sc_lid.debug_switch, 1);
MESA_load_profile_int_def(config, (const char *)"SYSTEM",(const char *)"RUN_LOG_LEVEL",
&logging_sc_lid.run_log_level, 10);
MESA_load_profile_string_def(config, (const char *)"SYSTEM",(const char *)"RUN_LOG_PATH",
logging_sc_lid.run_log_path, 128, NULL);
logging_sc_lid.run_log_path, 128, "conf/zlog.conf");
snprintf(run_log_path, 255, "%s/%s", logging_sc_lid.run_log_path, "certstore.log");
if (0 != MESA_handle_runtime_log_creation(logging_sc_lid.run_log_path))
{
fprintf(stderr, "Create log runtime_log_handle error, init failed\n");
goto finish;
}
logging_sc_lid.run_log_handle = MESA_create_runtime_log_handle(run_log_path, logging_sc_lid.run_log_level);
if(logging_sc_lid.run_log_handle == NULL){
logging_sc_lid.run_log_handle = MESA_create_runtime_log_handle("./logs", RLOG_LV_DEBUG);
if(logging_sc_lid.run_log_handle == NULL)
{
mesa_runtime_log(RLOG_LV_FATAL, MODULE_NAME, "Create log runtime_log_handle error, init failed!");
goto finish;
}else{
}else
{
mesa_runtime_log(RLOG_LV_INFO, MODULE_NAME, "Log module initialization");
}
breakpad = breakpad_init(config, "breakpad", logging_sc_lid.run_log_handle);
if(breakpad == NULL)
{
mesa_runtime_log(RLOG_LV_FATAL, MODULE_NAME, "Failed at starting breakpad.");
}
finish:
return;
}

View File

@@ -19,5 +19,4 @@ target_link_libraries(certstore dl common
MESA_handle_logger
hiredis-static
MESA_field_stat
gperftools-static
${SYSTEMD_LIBRARIES})

View File

@@ -2137,7 +2137,7 @@ static int mesa_fiel_stat_init()
FS_set_para(fs, APP_NAME, pname, strlen(pname)+1);
value=0;
FS_set_para(fs, FLUSH_BY_DATE, &value, sizeof(value));
snprintf(stat_path, 128, "%s/fs2_%s.status", logging_sc_lid.run_log_path, pname);
snprintf(stat_path, 128, "%s/fs2_%s.status", "./logs", pname);
FS_set_para(fs, OUTPUT_DEVICE, stat_path, strlen(stat_path)+1);
value=1;
FS_set_para(fs, PRINT_MODE, &value, sizeof(value));

View File

@@ -1,9 +1,14 @@
[SYSTEM]
#1:print on screen, 0:don't
DEBUG_SWITCH = 1
#10:DEBUG, 20:INFO, 30:FATAL
RUN_LOG_LEVEL = 10
RUN_LOG_PATH = ./logs
RUN_LOG_PATH = "conf/zlog.conf"
[breakpad]
disable_coredump=0
enable_breakpad=1
breakpad_minidump_dir=/tmp/certstore/crashreport
enable_breakpad_upload=0
breakpad_upload_url=http://127.0.0.1/
[CONFIG]
#Number of running threads

11
resource/conf/zlog.conf Normal file
View File

@@ -0,0 +1,11 @@
[global]
default format = "%d(%c), %V, %F, %U, %m%n"
[levels]
DEBUG=10
INFO=20
FATAL=30
[rules]
*.fatal "./logs/error.log.%d(%F)";
*.debug "./logs/certstore.log.%d(%F)"
!*.info "./logs/certstore.log.%d(%F)"

View File

@@ -151,6 +151,9 @@ add_library(MESA_field_stat SHARED IMPORTED GLOBAL)
set_property(TARGET MESA_field_stat PROPERTY IMPORTED_LOCATION ${MESA_FRAMEWORK_LIB_DIR}/libMESA_field_stat2.so)
set_property(TARGET MESA_field_stat PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MESA_FRAMEWORK_INCLUDE_DIR})
add_library(breakpad_mini SHARED IMPORTED GLOBAL)
set_property(TARGET breakpad_mini PROPERTY IMPORTED_LOCATION ${MESA_FRAMEWORK_LIB_DIR}/lib/libbreakpad_mini.so)
set_property(TARGET breakpad_mini PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MESA_FRAMEWORK_INCLUDE_DIR})