APISonar


com.yahoo.config.application.api.DeployLogger.log

> com > yahoo > config > application > api > DeployLogger > log
com APIs yahoo APIs config APIs application APIs api APIs DeployLogger APIs log APIs

Example 1
private final DeployLogger deployLogger;

    void checkName(String hostname) {
        // Give a warning if the host does not exist
        try {
            Object address = java.net.InetAddress.getByName(hostname);
        } catch (UnknownHostException e) {
            deployLogger.log(Level.WARNING, "Unable to lookup IP address of host: " + hostname);
        }
        if (! hostname.contains(".")) {
            deployLogger.log(Level.WARNING, "Host named '" + hostname + "' may not receive any config " +
                                            "since it is not a canonical hostname. " +
                                            "Disregard this warning when testing in a Docker container.");
        }
    }
Example 2
private void logMessages(DeployLogger logger) {
        logger.log(LogLevel.DEBUG, "foobar");
        logger.log(LogLevel.SPAM, "foobar");
        logger.log(LogLevel.FINE, "baz");
        logger.log(LogLevel.WARNING, "baz");
    }
Example 3
private DeployLogger deployLogger = new DeployLogger() {
        public void log(Level level, String message) {
            System.err.println("deploy log["+level+"]: "+message);
        }
    };

    public int wantNetworkPort(int port, NetworkPortRequestor service, String suffix) {
        if (portDB.containsKey(port)) {
            int fallback = nextAvailableNetworkPort();
            NetworkPortRequestor s = portDB.get(port);
            deployLogger.log(Level.WARNING,
                service.getServiceName() +" cannot reserve port " + port + " on " +
                hostname + ": Already reserved for " + s.getServiceName() +
                ". Using default port range from " + fallback);
            return allocateNetworkPort(service, suffix);
        }
        return requireNetworkPort(port, service, suffix);
    }
Example 4
private final DeployLogger logger;

    private void logFine(String msg) {
        if (logFine) {
            logger.log(LogLevel.FINE, msg);
        }
    }
Example 5
protected DeployLogger deployLogger;

    protected void warn(String searchName, String fieldName, String msg) {
        String fullMsg = formatError(searchName, fieldName, msg);
        deployLogger.log(Level.WARNING, fullMsg);
    }
Example 6
private void cleanupApplicationDirectory(File tempDir, DeployLogger logger) {
        logger.log(LogLevel.DEBUG, "Deleting tmp dir '" + tempDir + "'");
        if (!IOUtils.recursiveDeleteDir(tempDir)) {
            logger.log(LogLevel.WARNING, "Not able to delete tmp dir '" + tempDir + "'");
        }
    }
Example 7
private void checkTagName(Element spec, DeployLogger logger) {
        if (spec.getTagName().equals(DEPRECATED_TAG_NAME)) {
            logger.log(WARNING, "'" + DEPRECATED_TAG_NAME + "' is deprecated as tag name. Use '" + TAG_NAME + "' instead.");
        }
    }
Example 8
private final DeployLogger logger;

    void cleanupZooKeeper() {
        trace("Exception occurred. Cleaning up ZooKeeper");
        try {
            for (String subPath : Arrays.asList(
                    ConfigCurator.DEFCONFIGS_ZK_SUBPATH,
                    ConfigCurator.USER_DEFCONFIGS_ZK_SUBPATH,
                    ConfigCurator.USERAPP_ZK_SUBPATH)) {
                configCurator.deleteRecurse(getZooKeeperAppPath(null).append(subPath).getAbsolute());
            }
        } catch (Exception e) {
            logger.log(LogLevel.WARNING, "Could not clean up in zookeeper");
            //Might be called in an exception handler before re-throw, so do not throw here.
        }
    }
Example 9
public static Binding create(ComponentSpecification filterId, String binding, DeployLogger logger) {
        if (binding.startsWith("https://")) {
            logger.log(Level.WARNING, String.format(
                    "For binding '%s' on '%s': 'https' bindings are deprecated, " +
                            "use 'http' instead to bind to both http and https traffic.",
                    binding, filterId));
        }
        return new Binding(filterId, binding);
    }
Example 10
private void validateWarn(Exception e, DeployLogger deployLogger) {
        String msg = "Unable to execute 'vespa-verify-ranksetup', validation of rank expressions will only take place when you start Vespa: " +
                Exceptions.toMessageString(e);
        deployLogger.log(LogLevel.WARNING, msg);
    }
Example 11
private static void logConfigChangeActions(ConfigChangeActions actions, DeployLogger logger) {
        RestartActions restartActions = actions.getRestartActions();
        if ( ! restartActions.isEmpty()) {
            logger.log(Level.WARNING, "Change(s) between active and new application that require restart:\n" +
                    restartActions.format());
        }
        RefeedActions refeedActions = actions.getRefeedActions();
        if ( ! refeedActions.isEmpty()) {
            boolean allAllowed = refeedActions.getEntries().stream().allMatch(RefeedActions.Entry::allowed);
            logger.log(allAllowed ? Level.INFO : Level.WARNING,
                       "Change(s) between active and new application that may require re-feed:\n" +
                               refeedActions.format());
        }
    }
Example 12
private String getNameProperty(HttpRequest request, DeployLogger logger) {
        String name = request.getProperty("name");
        // TODO: Do we need validation of this parameter?
        if (name == null) {
            name = "default";
            logger.log(LogLevel.INFO, "No application name given, using '" + name + "'");
        }
        return name;
    }
Example 13
private final DeployLogger logger;

    private void writeUserDefs(ApplicationPackage applicationPackage) {
        Map<ConfigDefinitionKey, UnparsedConfigDefinition> configDefs = applicationPackage.getAllExistingConfigDefs();
        for (Map.Entry<ConfigDefinitionKey, UnparsedConfigDefinition> entry : configDefs.entrySet()) {
            ConfigDefinitionKey key = entry.getKey();
            String contents = entry.getValue().getUnparsedContent();
            write(key.getName(), key.getNamespace(), getZooKeeperAppPath(ConfigCurator.USER_DEFCONFIGS_ZK_SUBPATH).getAbsolute(), contents);
            write(key.getName(), key.getNamespace(), getZooKeeperAppPath(ConfigCurator.DEFCONFIGS_ZK_SUBPATH).getAbsolute(), contents);
        }
        logger.log(LogLevel.FINE, configDefs.size() + " user config definitions");
    }
Example 14
private DeployLogger deployLogger = new BaseDeployLogger();

    private void addField(String name, DataType type, SummaryTransform transform) {
        if (fields.containsKey(name)) {
            SummaryClassField sf = fields.get(name);
            if (!SummaryClassField.convertDataType(type, transform).equals(sf.getType())) {
                deployLogger.log(Level.WARNING, "Conflicting definition of field " + name + ". " +
                               "Declared as type " + sf.getType() + " and " +
                               type);
            }
        } else {
            fields.put(name, new SummaryClassField(name, type, transform));
        }
    }
Example 15
private void warnStreamingGramMatching(SearchCluster sc, DeployLogger logger) {
        if (sc.getSdConfig() != null) {
            for (SDField sd : sc.getSdConfig().getSearch().allFieldsList()) {
                if (sd.getMatching().getType().equals(Matching.Type.GRAM)) {
                    logger.log(Level.WARNING, "For streaming search cluster '" + sc.getClusterName() +
                            "', SD field '" + sd.getName() + "': n-gram matching is not supported for streaming search.");
                }
            }
        }
    }
Example 16
public LocalSession createSessionFromExisting(LocalSession existingSession,
                                                  DeployLogger logger,
                                                  boolean internalRedeploy,
                                                  TimeoutBudget timeoutBudget) {
        File existingApp = getSessionAppDir(existingSession.getSessionId());
        ApplicationId existingApplicationId = existingSession.getApplicationId();

        long activeSessionId = getActiveSessionId(existingApplicationId);
        logger.log(LogLevel.DEBUG, "Create from existing application id " + existingApplicationId + ", active session id is " + activeSessionId);
        LocalSession session = create(existingApp, existingApplicationId, activeSessionId, internalRedeploy, timeoutBudget);
        session.setApplicationId(existingApplicationId);
        session.setVespaVersion(existingSession.getVespaVersion());
        return session;
    }
Example 17
public LocalSession createSessionFromExisting(LocalSession existingSession,
                                                  DeployLogger logger,
                                                  TimeoutBudget timeoutBudget) {
        File existingApp = getSessionAppDir(existingSession.getSessionId());
        ApplicationMetaData metaData = FilesApplicationPackage.readMetaData(existingApp);
        final ApplicationId existingSessionId = existingSession.getApplicationId();


        final long liveApp = getLiveApp(existingSessionId);
        logger.log(LogLevel.DEBUG, "Create from existing application id " + existingSessionId + ", live app for it is " + liveApp);
        LocalSession session = create(existingApp, metaData.getApplicationName(), liveApp, timeoutBudget);
        session.setApplicationId(existingSessionId);
        return session;
    }
Example 18
private static void warnStreamingAttribute(SearchCluster sc, ImmutableSDField sd, DeployLogger logger) {
        // If the field is numeric, we can't print this, because we may have converted the field to
        // attribute indexing ourselves (IntegerIndex2Attribute)
        if (sd.getDataType() instanceof NumericDataType) return;
        logger.log(Level.WARNING, "For streaming search cluster '" + sc.getClusterName() +
                "', SD field '" + sd.getName() + "': 'attribute' has same match semantics as 'index'.");
    }