Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1213 from objmagic/more-logging-impro
Browse files Browse the repository at this point in the history
Improve logging for TMasterUtils.
  • Loading branch information
kramasamy authored Aug 4, 2016
2 parents 4a320e5 + ab551af commit d26a5d9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions heron/spi/src/java/com/twitter/heron/spi/utils/TMasterUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ private TMasterUtils() {
public static boolean sendToTMaster(String command, String topologyName,
SchedulerStateManagerAdaptor stateManager) {
// fetch the TMasterLocation for the topology
LOG.info("Fetching TMaster location for topology: " + topologyName);
LOG.fine("Fetching TMaster location for topology: " + topologyName);

TopologyMaster.TMasterLocation location = stateManager.getTMasterLocation(topologyName);
if (location == null) {
LOG.severe("Failed to fetch TMaster Location for topology: " + topologyName);
return false;
}
LOG.info("Fetched TMaster location for topology: " + topologyName);
LOG.fine("Fetched TMaster location for topology: " + topologyName);

// for the url request to be sent to TMaster
String endpoint = String.format("http://%s:%d/%s?topologyid=%s",
location.getHost(), location.getControllerPort(), command, location.getTopologyId());
LOG.info("HTTP URL for TMaster: " + endpoint);
LOG.fine("HTTP URL for TMaster: " + endpoint);

// create a URL connection
HttpURLConnection connection = null;
Expand All @@ -62,21 +62,21 @@ public static boolean sendToTMaster(String command, String topologyName,
LOG.log(Level.SEVERE, "Failed to get a HTTP connection to TMaster: ", e);
return false;
}
LOG.info("Successfully opened HTTP connection to TMaster");
LOG.fine("Successfully opened HTTP connection to TMaster");

// now sent the http request
NetworkUtils.sendHttpGetRequest(connection);
LOG.info("Sent the HTTP payload to TMaster");
LOG.fine("Sent the HTTP payload to TMaster");

boolean success = false;
// get the response and check if it is successful
try {
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
LOG.info("Successfully got a HTTP response from TMaster for " + command);
LOG.fine("Successfully got a HTTP response from TMaster for " + command);
success = true;
} else {
LOG.info(String.format("Non OK HTTP response %d from TMaster for command %s",
LOG.fine(String.format("Non OK HTTP response %d from TMaster for command %s",
responseCode, command));
}
} catch (IOException e) {
Expand Down

0 comments on commit d26a5d9

Please sign in to comment.