event/app: allow to enable log flag for release builds
Log flags could also report on SPDK_LOG_INFO level by using SPDK_INFOLOG() macro. Yet this did not result in additional log due to check for debug build. This patch allows release builds to use that flag. Meanwhile the -L option besides turning on particular log flag changes print log level to SPDK_LOG_DEBUG. Applied changes to serveral applications to follow the behaviour of event framework. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: Ib0d6cce33263c350d6d83300d60e7d15bdfe4b64 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4557 Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
779a6bdf82
commit
8a76c2484a
@ -26,6 +26,10 @@ A log flag structure, `spdk_log_register_flag`, `spdk_log_get_first_flag`,
|
||||
enable registering and interacting with log flags. Added `SPDK_INFOLOG`, `SPDK_DEBUGLOG`
|
||||
and `SPDK_LOGDUMP` macros to display logs for specified log flag.
|
||||
|
||||
The log flags in the event framework `-L` and several SPDK applications has been enabled on
|
||||
release builds of SPDK. On debug builds this option will additionally set
|
||||
log print level to `SPDK_LOG_DEBUG`.
|
||||
|
||||
### ocf
|
||||
|
||||
Updated OCF submodule to v20.03.1
|
||||
|
@ -45,7 +45,7 @@ Param | Long Param | Type | Default | Descript
|
||||
-W | --pci-whitelist | B:D:F | | @ref cmd_arg_pci_blacklist_whitelist.
|
||||
-R | --huge-unlink | flag | | @ref cmd_arg_huge_unlink
|
||||
| | --huge-dir | string | the first discovered | allocate hugepages from a specific mount
|
||||
-L | --logflag | string | | @ref cmd_arg_debug_log_flags
|
||||
-L | --logflag | string | | @ref cmd_arg_log_flags
|
||||
|
||||
### Configuration file {#cmd_arg_config_file}
|
||||
|
||||
@ -137,11 +137,11 @@ By default, each DPDK-based application tries to remove any orphaned hugetlbfs
|
||||
files during its initialization. This option removes hugetlbfs files of the current
|
||||
process as soon as they're created, but is not compatible with `--shm-id`.
|
||||
|
||||
### Debug log {#cmd_arg_debug_log_flags}
|
||||
### Log flag {#cmd_arg_log_flags}
|
||||
|
||||
Enable a specific debug log type. This option can be used more than once. A list of
|
||||
Enable a specific log type. This option can be used more than once. A list of
|
||||
all available types is provided in the `--help` output, with `--logflag all`
|
||||
enabling all of them. Debug logs are only available in debug builds of SPDK.
|
||||
enabling all of them. Additionally enables debug print level in debug builds of SPDK.
|
||||
|
||||
## CPU mask {#cpu_mask}
|
||||
|
||||
|
@ -711,12 +711,8 @@ parse_args(int argc, char **argv)
|
||||
usage(argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
spdk_log_set_print_level(SPDK_LOG_DEBUG);
|
||||
#ifndef DEBUG
|
||||
fprintf(stderr, "%s must be rebuilt with CONFIG_DEBUG=y for -T flag.\n",
|
||||
argv[0]);
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
@ -1830,12 +1830,8 @@ parse_args(int argc, char **argv)
|
||||
usage(argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
spdk_log_set_print_level(SPDK_LOG_DEBUG);
|
||||
#ifndef DEBUG
|
||||
fprintf(stderr, "%s must be rebuilt with CONFIG_DEBUG=y for -L flag.\n",
|
||||
argv[0]);
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
#endif
|
||||
break;
|
||||
case 'H':
|
||||
|
@ -1936,12 +1936,8 @@ parse_args(int argc, char **argv)
|
||||
usage(argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
spdk_log_set_print_level(SPDK_LOG_DEBUG);
|
||||
#ifndef DEBUG
|
||||
fprintf(stderr, "%s must be rebuilt with CONFIG_DEBUG=y for -T flag.\n",
|
||||
argv[0]);
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
#endif
|
||||
break;
|
||||
case 'V':
|
||||
|
@ -761,12 +761,8 @@ parse_args(int argc, char **argv)
|
||||
usage(argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
spdk_log_set_print_level(SPDK_LOG_DEBUG);
|
||||
#ifndef DEBUG
|
||||
fprintf(stderr, "%s must be rebuilt with CONFIG_DEBUG=y for -T flag.\n",
|
||||
argv[0]);
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
@ -964,18 +964,13 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
|
||||
}
|
||||
break;
|
||||
case LOGFLAG_OPT_IDX:
|
||||
#ifndef DEBUG
|
||||
SPDK_ERRLOG("%s must be configured with --enable-debug for -L flag\n",
|
||||
argv[0]);
|
||||
usage(app_usage);
|
||||
goto out;
|
||||
#else
|
||||
rc = spdk_log_set_flag(optarg);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("unknown flag\n");
|
||||
usage(app_usage);
|
||||
goto out;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
opts->print_level = SPDK_LOG_DEBUG;
|
||||
break;
|
||||
#endif
|
||||
|
@ -172,17 +172,12 @@ spdk_log_get_next_flag(struct spdk_log_flag *flag)
|
||||
void
|
||||
spdk_log_usage(FILE *f, const char *log_arg)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
struct spdk_log_flag *flag;
|
||||
fprintf(f, " %s, --logflag <flag> enable debug log flag (all", log_arg);
|
||||
fprintf(f, " %s, --logflag <flag> enable log flag (all", log_arg);
|
||||
|
||||
TAILQ_FOREACH(flag, &g_log_flags, tailq) {
|
||||
fprintf(f, ", %s", flag->name);
|
||||
}
|
||||
|
||||
fprintf(f, ")\n");
|
||||
#else
|
||||
fprintf(f, " %s, --logflag <flag> enable debug log flag (not supported"
|
||||
" - must reconfigure with --enable-debug)\n", log_arg);
|
||||
#endif
|
||||
}
|
||||
|
@ -337,12 +337,8 @@ parse_args(int argc, char **argv)
|
||||
usage(argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
spdk_log_set_print_level(SPDK_LOG_DEBUG);
|
||||
#ifndef DEBUG
|
||||
fprintf(stderr, "%s must be rebuilt with CONFIG_DEBUG=y for -L flag.\n",
|
||||
argv[0]);
|
||||
usage(argv[0]);
|
||||
return 0;
|
||||
#endif
|
||||
break;
|
||||
case 'T':
|
||||
|
Loading…
Reference in New Issue
Block a user