Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to direct SCR log messages to stderr or a custom file descriptor #541

Open
adammoody opened this issue May 3, 2023 · 0 comments

Comments

@adammoody
Copy link
Contributor

adammoody commented May 3, 2023

When running with SCR_DEBUG=1, SCR prints log messages to stdout. It would be useful at times to direct those messages to other files like stderr or perhaps a user-provided file descriptor. This would enable users to more easily filter SCR messages from their job logs.

The related code in SCR is in scr_err_mpi.c and scr_err_serial.c, e.g.:

scr/src/scr_err_mpi.c

Lines 52 to 63 in 48328f6

/* print message to stdout if scr_debug is set and it is >= level */
void scr_dbg(int level, const char *fmt, ...)
{
va_list argp;
if (level == 0 || (scr_debug > 0 && scr_debug >= level)) {
fprintf(stdout, "SCR %s: rank %d on %s: ", SCR_VERSION, scr_my_rank_world, scr_my_hostname);
va_start(argp, fmt);
vfprintf(stdout, fmt, argp);
va_end(argp);
fprintf(stdout, "\n");
}
}

There are a few other places where SCR calls print functions of other components, like:

scr/src/scr.c

Lines 1278 to 1289 in 48328f6

if (scr_debug > 0 && scr_my_rank_world == 0) {
scr_dbg(1, "Group descriptors:");
kvtree_print_mode(scr_groupdesc_hash, 4, KVTREE_PRINT_KEYVAL);
}
if (scr_debug > 0 && scr_my_rank_world == 0) {
scr_dbg(1, "Store descriptors:");
kvtree_print_mode(scr_storedesc_hash, 4, KVTREE_PRINT_KEYVAL);
}
if (scr_debug > 0 && scr_my_rank_world == 0) {
scr_dbg(1, "Redundancy descriptors:");
kvtree_print_mode(scr_reddesc_hash, 4, KVTREE_PRINT_KEYVAL);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant