src/agent/Shared/ApiServerUtils.h in passenger-5.1.11 vs src/agent/Shared/ApiServerUtils.h in passenger-5.1.12

- old
+ new

@@ -782,11 +782,16 @@ LoggingKit::ConfigChangeRequest configReq; vector<ConfigKit::Error> errors; bool ok; try { - ok = LoggingKit::context->prepareConfigChange(Json::objectValue, + // We deliberately ignore the target.stderr key. + // If the log file was equal to stderr then we'll want + // to reopen the log file anyway. + Json::Value updates; + updates["target"] = config["target"]["path"]; + ok = LoggingKit::context->prepareConfigChange(updates, errors, configReq); } catch (const SystemException &e) { unsigned int bufsize = 2048; char *message = (char *) psg_pnalloc(req->pool, bufsize); snprintf(message, bufsize, "{ \"status\": \"error\", " @@ -865,9 +870,10 @@ LoggingKit::ConfigChangeRequest configReq; bool ok; config["target"] = oldConfig["target"]; config["target"]["fd"] = fd; + config["target"].removeMember("stderr"); try { ok = LoggingKit::context->prepareConfigChange(config, errors, configReq); } catch (const std::exception &e) { resp.status = InternalResponse::ERROR_INTERNAL;