diff --git a/CHANGELOG.md b/CHANGELOG.md index b7bb209a9..4872dba49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/doc/applications.md b/doc/applications.md index f841b1c84..20177ca44 100644 --- a/doc/applications.md +++ b/doc/applications.md @@ -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} diff --git a/examples/nvme/abort/abort.c b/examples/nvme/abort/abort.c index d3f54e08a..1a73b38b7 100644 --- a/examples/nvme/abort/abort.c +++ b/examples/nvme/abort/abort.c @@ -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: diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index 06d828b29..108ea8f60 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -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': diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 8de4247ea..084c4db39 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -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': diff --git a/examples/nvme/reconnect/reconnect.c b/examples/nvme/reconnect/reconnect.c index 0f2a752c4..1387b74e7 100644 --- a/examples/nvme/reconnect/reconnect.c +++ b/examples/nvme/reconnect/reconnect.c @@ -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: diff --git a/lib/event/app.c b/lib/event/app.c index ac661cc87..ad5f8fc48 100644 --- a/lib/event/app.c +++ b/lib/event/app.c @@ -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 diff --git a/lib/log/log_flags.c b/lib/log/log_flags.c index ad0a84040..d6721a6b0 100644 --- a/lib/log/log_flags.c +++ b/lib/log/log_flags.c @@ -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 enable debug log flag (all", log_arg); + fprintf(f, " %s, --logflag 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 enable debug log flag (not supported" - " - must reconfigure with --enable-debug)\n", log_arg); -#endif } diff --git a/test/nvme/aer/aer.c b/test/nvme/aer/aer.c index ae9e32663..be77a2e1a 100644 --- a/test/nvme/aer/aer.c +++ b/test/nvme/aer/aer.c @@ -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':