This is an automated email from the ASF dual-hosted git repository.
eze pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.1.x by this push:
new 33538a9 Add support for the old lua formatted ease of use conventions
and the numeric log rolling values
33538a9 is described below
commit 33538a941f627be739ace2d38fbf6e938c37c4b8
Author: Evan Zelkowitz <[email protected]>
AuthorDate: Tue Feb 26 19:47:07 2019 -0700
Add support for the old lua formatted ease of use conventions and the
numeric
log rolling values
Addresses issue #5080
(cherry picked from commit a105fd3d177c7c4223609b09014bff372f0c7d0e)
---
proxy/logging/YamlLogConfig.cc | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/proxy/logging/YamlLogConfig.cc b/proxy/logging/YamlLogConfig.cc
index 07bfcfb..baa8bd3 100644
--- a/proxy/logging/YamlLogConfig.cc
+++ b/proxy/logging/YamlLogConfig.cc
@@ -99,7 +99,9 @@ YamlLogConfig::loadLogConfig(const char *cfgFilename)
return true;
}
-TsEnumDescriptor ROLLING_MODE = {{{"none", 0}, {"time", 1}, {"size", 2},
{"both", 3}, {"any", 4}}};
+TsEnumDescriptor ROLLING_MODE_TEXT = {{{"none", 0}, {"time", 1}, {"size", 2},
{"both", 3}, {"any", 4}}};
+TsEnumDescriptor ROLLING_MODE_LUA = {
+ {{"log.roll.none", 0}, {"log.roll.time", 1}, {"log.roll.size", 2},
{"log.roll.both", 3}, {"log.roll.any", 4}}};
std::set<std::string> valid_log_object_keys = {
"filename", "format", "mode", "header",
"rolling_enabled", "rolling_interval_sec",
@@ -152,9 +154,15 @@ YamlLogConfig::decodeLogObject(const YAML::Node &node)
if (node["rolling_enabled"]) {
auto value = node["rolling_enabled"].as<std::string>();
- obj_rolling_enabled = ROLLING_MODE.get(value);
+ obj_rolling_enabled = ROLLING_MODE_TEXT.get(value);
if (obj_rolling_enabled < 0) {
- throw std::runtime_error("unknown value " + value);
+ obj_rolling_enabled = ROLLING_MODE_LUA.get(value);
+ if (obj_rolling_enabled < 0) {
+ obj_rolling_enabled = node["rolling_enabled"].as<int>();
+ if (obj_rolling_enabled < Log::NO_ROLLING || obj_rolling_enabled >
Log::ROLL_ON_TIME_AND_SIZE) {
+ throw YAML::ParserException(node["rolling_enabled"].Mark(), "unknown
value " + value);
+ }
+ }
}
}
if (node["rolling_interval_sec"]) {