tfe 支持 zlog

This commit is contained in:
luwenpeng
2020-09-24 17:47:35 +08:00
parent 9d15d655ed
commit 95ec503762
13 changed files with 42 additions and 68 deletions

View File

@@ -239,7 +239,10 @@ static void __signal_handler_cb(evutil_socket_t fd, short what, void * arg)
{
case SIGTERM:
case SIGQUIT:
case SIGHUP: break;
case SIGHUP:
TFE_LOG_ERROR(ctx->logger, "recv SIGHUP, reload zlog.conf");
MESA_handle_runtime_log_reconstruction(NULL);
break;
case SIGUSR1: break;
case SIGPIPE:
TFE_PROXY_STAT_INCREASE(STAT_SIGPIPE, 1);
@@ -724,6 +727,7 @@ int main(int argc, char * argv[])
{
const char * main_profile = "./conf/tfe/tfe.conf";
const char * future_profile= "./conf/tfe/future.conf";
const char * zlog_profile = "./conf/tfe/zlog.conf";
int ret = 0;
int opt = 0;
@@ -749,22 +753,23 @@ int main(int argc, char * argv[])
fprintf(stderr, "Tango Frontend Engine, Version: %s", __tfe_version);
if (0 != MESA_handle_runtime_log_creation(zlog_profile))
{
fprintf(stderr, "MESA_handle_runtime_log_creation return error\n");
exit(EXIT_FAILURE);
}
/* adds locking, only required if accessed from separate threads */
evthread_use_pthreads();
unsigned int __log_level = RLOG_LV_INFO;
MESA_load_profile_uint_def(main_profile, "log", "level", &__log_level, RLOG_LV_INFO);
char __log_path[TFE_STRING_MAX]= {};
MESA_load_profile_string_def(main_profile, "log", "location", __log_path, sizeof(__log_path), "log/tfe.log");
g_default_logger = MESA_create_runtime_log_handle(__log_path, __log_level);
if (unlikely(g_default_logger == NULL))
g_default_logger = MESA_create_runtime_log_handle("tfe", RLOG_LV_DEBUG);
if (unlikely(g_default_logger == NULL))
{
TFE_LOG_ERROR(g_default_logger, "Failed at creating default logger: %s", "log/tfe.log");
exit(EXIT_FAILURE);
}
/* PROXY INSTANCE */
/* PROXY INSTANCE */
g_default_proxy = ALLOC(struct tfe_proxy, 1);
assert(g_default_proxy);
strcpy(g_default_proxy->name, "tfe3a");