1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Fix #3218: Log: Follow Java/log4j log level specs. v5.0.83 (#3219)

1. Support Java/log4j log level text.
2. Support configuring by `--log-new-level=on` which is enabled by default.
3. Support `--log-new-level=off` to use SRS 4.0 log level for compatibility.
This commit is contained in:
Winlin 2022-10-26 21:23:03 +08:00 committed by GitHub
parent 20c38e07c0
commit 2d1ba46e37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 147 additions and 24 deletions

View file

@ -2280,7 +2280,7 @@ srs_error_t SrsConfig::check_normal_config()
SrsConfDirective* conf = root->at(i);
std::string n = conf->name;
if (n != "listen" && n != "pid" && n != "chunk_size" && n != "ff_log_dir"
&& n != "srs_log_tank" && n != "srs_log_level" && n != "srs_log_file"
&& n != "srs_log_tank" && n != "srs_log_level" && n != "srs_log_level_v2" && n != "srs_log_file"
&& n != "max_connections" && n != "daemon" && n != "heartbeat" && n != "tencentcloud_apm"
&& n != "http_api" && n != "stats" && n != "vhost" && n != "pithy_print_ms"
&& n != "http_server" && n != "stream_caster" && n != "rtc_server" && n != "srt_server"
@ -6342,12 +6342,26 @@ string SrsConfig::get_log_level()
SRS_OVERWRITE_BY_ENV_STRING("srs.srs_log_level");
static string DEFAULT = "trace";
SrsConfDirective* conf = root->get("srs_log_level");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return conf->arg0();
}
string SrsConfig::get_log_level_v2()
{
SRS_OVERWRITE_BY_ENV_STRING("srs.srs_log_level_v2");
static string DEFAULT = "";
SrsConfDirective* conf = root->get("srs_log_level_v2");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return conf->arg0();
}