public void debugf(String format, Object... args) { debug(String.format(format, args)); }
outputClassName, e.getValue(), e.getKey()); S object = deserializeObject(e.getKey(), outputClass); logger.debug(" ...OK\n"); readCompleted.incrementAndGet(); return new SimpleImmutableEntry<>(e.getValue(), object);
_logger.debugf("Writing config to \"%s\"...", outputFileAsString); CommonUtil.writeFile(outputFile, flatConfigText); _logger.debug("OK\n");
private boolean answerFile( Path questionFile, boolean isDifferential, boolean isDelta, FileWriter outWriter) { if (!Files.exists(questionFile)) { throw new BatfishException("Question file not found: " + questionFile); } String questionName = DEFAULT_QUESTION_PREFIX + "_" + UUID.randomUUID(); // upload the question boolean resultUpload = _workHelper.uploadQuestion( _currContainerName, isDelta ? _currDeltaTestrig : _currTestrig, questionName, questionFile.toAbsolutePath().toString()); if (!resultUpload) { return false; } _logger.debug("Uploaded question. Answering now.\n"); // answer the question WorkItem wItemAs = WorkItemBuilder.getWorkItemAnswerQuestion( questionName, _currContainerName, _currTestrig, _currDeltaTestrig, isDifferential, isDelta); return execute(wItemAs, outWriter); }
private void serializeAwsConfigs( Path testRigPath, Path outputPath, ParseVendorConfigurationAnswerElement pvcae) { Map<Path, String> configurationData = readConfigurationFiles(testRigPath, BfConsts.RELPATH_AWS_CONFIGS_DIR); AwsConfiguration config; try (ActiveSpan parseAwsConfigsSpan = GlobalTracer.get().buildSpan("Parse AWS configs").startActive()) { assert parseAwsConfigsSpan != null; // avoid unused warning config = parseAwsConfigurations(configurationData, pvcae); } _logger.info("\n*** SERIALIZING AWS CONFIGURATION STRUCTURES ***\n"); _logger.resetTimer(); outputPath.toFile().mkdirs(); Path currentOutputPath = outputPath.resolve(BfConsts.RELPATH_AWS_CONFIGS_FILE); _logger.debugf("Serializing AWS to \"%s\"...", currentOutputPath); serializeObject(config, currentOutputPath); _logger.debug("OK\n"); _logger.printElapsedTime(); }
/** * Returns a {@link Container Container} that contains information of '{@code networkName}', * returns null if network '{@code networkName}' does not exist or the api key that is using has * no access to the network */ @Nullable Container getNetwork(String networkName) { try { WebTarget webTarget = getTargetV2(Lists.newArrayList(CoordConstsV2.RSC_NETWORKS, networkName)); Response response = webTarget .request(MediaType.APPLICATION_JSON) .header(CoordConstsV2.HTTP_HEADER_BATFISH_APIKEY, _settings.getApiKey()) .header(CoordConstsV2.HTTP_HEADER_BATFISH_VERSION, Version.getVersion()) .get(); _logger.debug(response.getStatus() + " " + response.getStatusInfo() + " " + response + "\n"); if (response.getStatus() != Response.Status.OK.getStatusCode()) { _logger.errorf("getNetwork: Did not get OK response. Got: %s\n", response.getStatus()); _logger.error(response.readEntity(String.class) + "\n"); return null; } String containerStr = response.readEntity(String.class); return BatfishObjectMapper.mapper().readValue(containerStr, Container.class); } catch (Exception e) { _logger.errorf("Exception in getNetwork from %s for %s\n", _coordWorkMgrV2, networkName); _logger.error(Throwables.getStackTraceAsString(e) + "\n"); return null; } }
.post(Entity.entity(multiPart, multiPart.getMediaType())); _logger.debug(response.getStatus() + " " + response.getStatusInfo() + " " + response + "\n");
return false; _logger.debug("Uploaded question. Answering now.\n");
private void outputAnswer(Answer answer, boolean writeLog) { try { String answerString = BatfishObjectMapper.writePrettyString(answer) + '\n'; _logger.debug(answerString); @Nullable String logString = writeLog ? answerString : null; writeJsonAnswerWithLog(logString, answerString); } catch (Exception e) { BatfishException be = new BatfishException("Error in sending answer", e); try { Answer failureAnswer = Answer.failureAnswer(e.toString(), answer.getQuestion()); failureAnswer.addAnswerElement(be.getBatfishStackTrace()); String answerString = BatfishObjectMapper.writePrettyString(failureAnswer) + '\n'; _logger.error(answerString); @Nullable String logString = writeLog ? answerString : null; writeJsonAnswerWithLog(logString, answerString); } catch (Exception e1) { _logger.errorf( "Could not serialize failure answer. %s", Throwables.getStackTraceAsString(e1)); } throw be; } }
String baseUrl = String.format("%s://%s", protocol, _mainSettings.getServiceBindHost()); URI baseUri = UriBuilder.fromUri(baseUrl).port(_mainSettings.getServicePort()).build(); _mainLogger.debug(String.format("Starting server at %s\n", baseUri)); ResourceConfig rc = new ResourceConfig(Service.class).register(new JettisonFeature()); if (_mainSettings.getTracingEnable()) {