Skip to content

Commit

Permalink
redirect mercury log messages to our server log
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBrim authored and adammoody committed Feb 22, 2021
1 parent 3e1640f commit 48eec87
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
4 changes: 0 additions & 4 deletions client/src/margo_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ int unifyfs_client_rpc_init(void)
ctx->mid = margo_init(proto, MARGO_SERVER_MODE, 1, 1);
assert(ctx->mid);

/* TODO: want to keep this enabled all the time */
/* what's this do? */
margo_diag_start(ctx->mid);

/* get server margo address */
ctx->svr_addr = HG_ADDR_NULL;
margo_addr_lookup(ctx->mid, svr_addr_string, &(ctx->svr_addr));
Expand Down
28 changes: 28 additions & 0 deletions server/src/margo_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "unifyfs_global.h"
#include "margo_server.h"
#include "na_config.h" // from mercury include lib
#include "mercury_log.h"

// global variables
ServerRpcContext_t* unifyfsd_rpc_context;
Expand Down Expand Up @@ -327,6 +328,33 @@ int margo_server_rpc_init(void)
}
}

#if defined(HG_VERSION_MAJOR) && (HG_VERSION_MAJOR > 1)
/* redirect mercury log to ours, using current log level */
const char* mercury_log_level = NULL;
switch (unifyfs_log_level) {
case LOG_DBG:
mercury_log_level = "debug";
break;
case LOG_ERR:
mercury_log_level = "error";
break;
case LOG_WARN:
mercury_log_level = "warning";
break;
default:
break;
}
if (NULL != mercury_log_level) {
HG_Set_log_level(mercury_log_level);
NA_Set_log_level(mercury_log_level);
}
if (NULL != unifyfs_log_stream) {
hg_log_set_stream_debug(unifyfs_log_stream);
hg_log_set_stream_error(unifyfs_log_stream);
hg_log_set_stream_warning(unifyfs_log_stream);
}
#endif

margo_instance_id mid;
mid = setup_local_target();
if (mid == MARGO_INSTANCE_NULL) {
Expand Down

0 comments on commit 48eec87

Please sign in to comment.