diff --git a/lib/test/rlc/rlc_stress_test.cc b/lib/test/rlc/rlc_stress_test.cc index b1ea4ba29..96cc73fed 100644 --- a/lib/test/rlc/rlc_stress_test.cc +++ b/lib/test/rlc/rlc_stress_test.cc @@ -229,6 +229,17 @@ void rlc_tester::run_thread() void stress_test(stress_test_args_t args) { + auto log_sink = + (args.log_filename == "stdout") ? srslog::create_stdout_sink() : srslog::create_file_sink(args.log_filename); + if (!log_sink) { + return; + } + srslog::log_channel* chan = srslog::create_log_channel("main_channel", *log_sink); + if (!chan) { + return; + } + srslog::set_default_sink(*log_sink); + auto& log1 = srslog::fetch_basic_logger("RLC_1", false); log1.set_level(static_cast(args.log_level)); log1.set_hex_dump_max_size(args.log_hex_limit); diff --git a/lib/test/rlc/rlc_stress_test.h b/lib/test/rlc/rlc_stress_test.h index a904586ac..acd4657e4 100644 --- a/lib/test/rlc/rlc_stress_test.h +++ b/lib/test/rlc/rlc_stress_test.h @@ -73,6 +73,7 @@ typedef struct { uint32_t nof_pdu_tti; uint32_t max_retx; int32_t log_hex_limit; + std::string log_filename; uint32_t min_sdu_size; uint32_t max_sdu_size; } stress_test_args_t; @@ -102,6 +103,7 @@ void parse_args(stress_test_args_t* args, int argc, char* argv[]) ("pdu_cut_rate", bpo::value(&args->pdu_cut_rate)->default_value(0.0), "Rate at which RLC PDUs are chopped in length") ("pdu_duplicate_rate", bpo::value(&args->pdu_duplicate_rate)->default_value(0.0), "Rate at which RLC PDUs are duplicated") ("loglevel", bpo::value(&args->log_level)->default_value((int)srslog::basic_levels::debug), "Log level (1=Error,2=Warning,3=Info,4=Debug)") + ("log_filename", bpo::value(&args->log_filename)->default_value("stdout"), "Filename to save log to") ("singletx", bpo::value(&args->single_tx)->default_value(false), "If set to true, only one node is generating data") ("pcap", bpo::value(&args->write_pcap)->default_value(false), "Whether to write all RLC PDU to PCAP file") ("zeroseed", bpo::value(&args->zero_seed)->default_value(false), "Whether to initialize random seed to zero")