Repository: trafficserver Updated Branches: refs/heads/master c0662e5e6 -> ae56b904c
TS-407 Cleanup the syslog facility setup for traffic_server Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ae56b904 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ae56b904 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ae56b904 Branch: refs/heads/master Commit: ae56b904c69a0f2ec9ad9df447fad840dca5ff6c Parents: c0662e5 Author: Leif Hedstrom <[email protected]> Authored: Wed Aug 27 10:11:38 2014 -0600 Committer: Leif Hedstrom <[email protected]> Committed: Wed Sep 3 14:06:20 2014 -0600 ---------------------------------------------------------------------- CHANGES | 2 ++ cmd/traffic_manager/traffic_manager.cc | 5 +++-- proxy/Main.cc | 28 ++++++++++++++-------------- 3 files changed, 19 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ae56b904/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index a0141aa..8fe045c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 5.2.0 + *) [TS-407] Cleanup the syslog facility setup for traffic_server. + *) [TS-3049] - Enhance FetchSM to handle response with "Connection:Close" header and limit the response header/body duplication to non-streaming scenarios for backward compatibility with TSFetchUrl() http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ae56b904/cmd/traffic_manager/traffic_manager.cc ---------------------------------------------------------------------- diff --git a/cmd/traffic_manager/traffic_manager.cc b/cmd/traffic_manager/traffic_manager.cc index a45e246..93bbbd2 100644 --- a/cmd/traffic_manager/traffic_manager.cc +++ b/cmd/traffic_manager/traffic_manager.cc @@ -595,17 +595,18 @@ main(int argc, char **argv) char sys_var[] = "proxy.config.syslog_facility"; char *facility_str = NULL; int facility_int; + facility_str = REC_readString(sys_var, &found); ink_assert(found); if (!found) { - mgmt_elog(0, "Could not read %s. Defaulting to DAEMON\n", sys_var); + mgmt_elog(0, "Could not read %s. Defaulting to LOG_DAEMON\n", sys_var); facility_int = LOG_DAEMON; } else { facility_int = facility_string_to_int(facility_str); ats_free(facility_str); if (facility_int < 0) { - mgmt_elog(0, "Bad syslog facility specified. Defaulting to DAEMON\n"); + mgmt_elog(0, "Bad syslog facility specified. Defaulting to LOG_DAEMON\n"); facility_int = LOG_DAEMON; } } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ae56b904/proxy/Main.cc ---------------------------------------------------------------------- diff --git a/proxy/Main.cc b/proxy/Main.cc index 4f3654d..02ad7de 100644 --- a/proxy/Main.cc +++ b/proxy/Main.cc @@ -980,9 +980,6 @@ ShowStats():Continuation(NULL), }; -// TODO: How come this is never used ?? -static int syslog_facility = LOG_DAEMON; - // static void syslog_log_configure() // // Reads the syslog configuration variable @@ -993,21 +990,24 @@ static int syslog_facility = LOG_DAEMON; static void syslog_log_configure() { - char *facility_str = NULL; - int facility; + bool found = false; + char sys_var[] = "proxy.config.syslog_facility"; + char *facility_str = REC_readString(sys_var, &found); - REC_ReadConfigStringAlloc(facility_str, "proxy.config.syslog_facility"); + if (found) { + int facility = facility_string_to_int(facility_str); - if (facility_str == NULL || (facility = facility_string_to_int(facility_str)) < 0) { - syslog(LOG_WARNING, "Bad or missing syslog facility. " "Defaulting to LOG_DAEMON"); + ats_free(facility_str); + if (facility < 0) { + syslog(LOG_WARNING, "Bad syslog facility in records.config. Keeping syslog at LOG_DAEMON"); + } else { + Debug("server", "Setting syslog facility to %d\n", facility); + closelog(); + openlog("traffic_server", LOG_PID | LOG_NDELAY | LOG_NOWAIT, facility); + } } else { - syslog_facility = facility; - closelog(); - openlog("traffic_server", LOG_PID | LOG_NDELAY | LOG_NOWAIT, facility); + syslog(LOG_WARNING, "Missing syslog facility config %s. Keeping syslog at LOG_DAEMON", sys_var); } - // TODO: Not really, what's up with this? - Debug("server", "Setting syslog facility to %d\n", syslog_facility); - ats_free(facility_str); } static void
