[ https://issues.apache.org/jira/browse/TS-4399?focusedWorklogId=30906&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-30906 ]
ASF GitHub Bot logged work on TS-4399: -------------------------------------- Author: ASF GitHub Bot Created on: 20/Oct/16 03:47 Start Date: 20/Oct/16 03:47 Worklog Time Spent: 10m Work Description: Github user jpeach commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/1073#discussion_r84208118 --- Diff: cmd/traffic_manager/traffic_manager.cc --- @@ -611,31 +614,35 @@ main(int argc, const char **argv) /* Update cmd line overrides/environmental overrides/etc */ if (tsArgs) { /* Passed command line args for proxy */ + char* new_proxy_opts = new char[strlen(lmgmt->proxy_options) + strlen(tsArgs) + 1]; + strcpy(new_proxy_opts, lmgmt->proxy_options); + strcat(new_proxy_opts, tsArgs); ats_free(lmgmt->proxy_options); - lmgmt->proxy_options = tsArgs; - mgmt_log("[main] Traffic Server Args: '%s'\n", lmgmt->proxy_options); + lmgmt->proxy_options = new_proxy_opts; } - // we must pass in bind_stdout and bind_stderr values to TS - // we do it so TS is able to create BaseLogFiles for each value + // TS needs to be started up with the same outputlog bindings each time, + // so we append the outputlog location to the persistent proxy options + // + // TS needs them to be able to create BaseLogFiles for each value if (*bind_stdout != 0) { - size_t l = strlen(lmgmt->proxy_options); - size_t n = 3 /* " --" */ - + sizeof(TM_OPT_BIND_STDOUT) /* nul accounted for here */ - + 1 /* space */ - + strlen(bind_stdout); - lmgmt->proxy_options = static_cast<char *>(ats_realloc(lmgmt->proxy_options, n + l)); - snprintf(lmgmt->proxy_options + l, n, " --%s %s", TM_OPT_BIND_STDOUT, bind_stdout); + const char *bind_stdout_opt = " --" TM_OPT_BIND_STDOUT " "; + char *new_proxy_opts = new char[strlen(lmgmt->proxy_options) + strlen(bind_stdout_opt) + strlen(bind_stdout) + 1]; + strcpy(new_proxy_opts, lmgmt->proxy_options); + strcat(new_proxy_opts, bind_stdout_opt); + strcat(new_proxy_opts, bind_stdout); + delete lmgmt->proxy_options; --- End diff -- You can replace all this string code with ``TextBuffer``. ```C TextBuffer args; if (*bind_stdout) { const char * space = args.empty() ? "" : " "; args.format("%s%s", space, "--" TM_OPT_BIND_STDOUT); } ... lmgmt->proxy_options = args.release(); ``` Issue Time Tracking ------------------- Worklog Id: (was: 30906) Time Spent: 1h (was: 50m) > Management API breaks diagnostic log rotation > --------------------------------------------- > > Key: TS-4399 > URL: https://issues.apache.org/jira/browse/TS-4399 > Project: Traffic Server > Issue Type: Bug > Components: Logging, Management API > Reporter: James Peach > Assignee: Daniel Xu > Fix For: 7.1.0 > > Time Spent: 1h > Remaining Estimate: 0h > > Start up Traffic Server: > {code} > 0 26950 1 0 10:13AM ?? 0:00.01 /opt/ats/bin/traffic_cop > -2 26951 26950 0 10:13AM ?? 0:00.02 /opt/ats/bin/traffic_manager > --bind_stdout /opt/ats/var/log/trafficserver/traffic.out --bind_stderr > /opt/ats/var/log/trafficserver/traffic.out > -2 26952 26951 0 10:13AM ?? 0:00.08 /opt/ats/bin/traffic_server > -M --bind_stdout /opt/ats/var/log/trafficserver/traffic.out --bind_stderr > /opt/ats/var/log/trafficserver/traffic.out --httpport 8080:fd=12 > {code} > Now restart it using {{traffic_line -S}} followed by {{traffic_line -U}}: > {code} > 0 26950 1 0 10:13AM ?? 0:00.01 /opt/ats/bin/traffic_cop > -2 26951 26950 0 10:13AM ?? 0:00.05 /opt/ats/bin/traffic_manager > --bind_stdout /opt/ats/var/log/trafficserver/traffic.out --bind_stderr > /opt/ats/var/log/trafficserver/traffic.out > -2 26967 26951 0 10:13AM ?? 0:00.12 /opt/ats/bin/traffic_server > -M --httpport 8080:fd=20 > {code} > Note that we lost the {{\--bind_stdout}} and {{\--bind_stderr}} options. -- This message was sent by Atlassian JIRA (v6.3.4#6332)