Example usage for java.util.logging Level WARNING

List of usage examples for java.util.logging Level WARNING

Introduction

In this page you can find the example usage for java.util.logging Level WARNING.

Prototype

Level WARNING

To view the source code for java.util.logging Level WARNING.

Click Source Link

Document

WARNING is a message level indicating a potential problem.

Usage

From source file:ws.doerr.httpserver.Server.java

private Server() {
    Logger.getLogger("org.glassfish.grizzly").setLevel(Level.WARNING);
}

From source file:com.almende.eve.capabilities.AbstractCapabilityBuilder.java

/**
 * Builds or retrieves the Capability.//from  w w w .j a v  a 2  s .  co m
 * 
 * @return the t
 */
public T build() {
    final Config params = Config.decorate(parameters);
    final String className = params.getClassName();
    if (className != null) {
        try {
            final Class<?> clazz = Class.forName(className, true, cl);
            if (ClassUtil.hasSuperClass(clazz, AbstractCapabilityBuilder.class)) {
                @SuppressWarnings("unchecked")
                final AbstractCapabilityBuilder<T> instance = (AbstractCapabilityBuilder<T>) clazz
                        .newInstance();
                return instance.withClassLoader(cl).withConfig(parameters).withHandle(handle).build();
            } else {
                LOG.log(Level.WARNING, className + " is not a CapabilityBuilder, which is required.");
                throw new Error();
            }
        } catch (final ClassNotFoundException e) {
            LOG.log(Level.WARNING, "Couldn't find class:" + className, e);
        } catch (InstantiationException e) {
            LOG.log(Level.WARNING, "Couldn't instantiate class:" + className, e);
        } catch (final SecurityException e) {
            LOG.log(Level.WARNING, "Couldn't access class:" + className + " methods", e);
        } catch (final IllegalAccessException e) {
            LOG.log(Level.WARNING, "Couldn't access class:" + className + " methods", e);
        } catch (final IllegalArgumentException e) {
            LOG.log(Level.WARNING, "Method of class:" + className + " has incorrect arguments", e);
        }
    } else {
        LOG.warning("Parameter 'class' is required, incomplete config:" + params.toString());
    }
    return null;
}

From source file:demo.service.CustomerService.java

@POST
@Consumes("application/json")
public Response updateCustomer(final Customer customer) {
    Validate.notNull(customer);//  w ww  .ja  va  2 s  .c  om

    LOGGER.log(Level.FINE, "Invoking updateCustomer, customer={0}", customer);

    if (isCustomerExists(customer)) {
        LOGGER.log(Level.FINE, "Specified customer exists, update data, customer={0}", customer);
    } else {
        LOGGER.log(Level.WARNING, "Specified customer does not exist, add data, customer={0}", customer);
    }

    customers.put(customer.getId(), customer);

    LOGGER.log(Level.INFO, "Customer was updated successful, customer={0}", customer);
    return Response.ok().build();
}

From source file:com.qwazr.server.ServerException.java

final public ServerException warnIfCause(final Logger logger) {
    final Throwable cause = getCause();
    if (cause == null)
        return this;
    if (logger != null)
        logger.log(Level.WARNING, cause, this::getMessage);
    return this;
}

From source file:com.archivas.clienttools.arcutils.impl.adapter.Hcp6AuthNamespaceAdapter.java

@Override
protected boolean getAdditionalMetadata(final XMLStreamReader xmlr, FileMetadata metadata, String filePath) {
    String annotations = "";
    try {/*from ww  w.  ja  va 2s  .c o m*/
        annotations = xmlr.getAttributeValue(null, HttpGatewayConstants.MD_CM_ANNOTATIONS);
    } catch (NullPointerException e) {
        LOG.log(Level.WARNING, "Exception parsing metadata for: " + filePath, e);
    }
    return handleAdditionalMetadata(metadata, annotations, filePath)
            && super.getAdditionalMetadata(xmlr, metadata, filePath);
}

From source file:eu.eexcess.opensearch.querygenerator.OpensearchQueryGenerator.java

/**
 * Concatenate space separated keywords and search result limit if @param
 * userProfile.numResults > 0//from   w  ww . j  a  va2s . com
 */
@Override
public String toQuery(SecureUserProfile userProfile) {

    StringBuilder stringBuilder = new StringBuilder();

    for (ContextKeyword keyword : userProfile.contextKeywords) {
        stringBuilder.append(keyword.text + " ");
    }

    if (stringBuilder.length() > 0) {
        stringBuilder.deleteCharAt(stringBuilder.length() - 1);
    }

    String urlEncodedKeywords = null;
    try {
        urlEncodedKeywords = URLEncoder.encode(stringBuilder.toString(), mDefaultUrlEncoding);

        if (userProfile.numResults != null && userProfile.numResults > 0) {
            return urlEncodedKeywords + "&limit=" + userProfile.numResults;
        }

    } catch (UnsupportedEncodingException e) {
        mLogger.log(Level.WARNING, "failed encoding keywords");
    }

    return urlEncodedKeywords;
}

From source file:me.st28.flexseries.flexlib.log.LogHelper.java

private static void logFromClass(Level level, Class clazz, String message) {
    Validate.notNull(clazz, "Class cannot be null.");
    Validate.notNull(message, "Message cannot be null.");

    if (FlexPlugin.class.isAssignableFrom(clazz)) {
        JavaPlugin plugin = JavaPlugin.getPlugin(clazz);

        if (plugin == null) {
            throw new IllegalArgumentException("Plugin '" + clazz.getCanonicalName() + "' not found.");
        }//  ww  w.  j  a  v  a2 s  .  co m

        if (!(plugin instanceof FlexPlugin)) {
            throw new IllegalArgumentException("Plugin '" + plugin.getName() + "' is not a FlexPlugin.");
        }

        FlexPlugin fp = (FlexPlugin) plugin;

        if (level == Level.INFO) {
            info(fp, message);
        } else if (level == Level.WARNING) {
            warning(fp, message);
        } else if (level == Level.SEVERE) {
            severe(fp, message);
        } else if (level == null) {
            debug(fp, message);
        }
        throw new IllegalArgumentException("Invalid log level '" + level.getName() + "'");
    }

    if (FlexModule.class.isAssignableFrom(clazz)) {
        throw new IllegalArgumentException("Invalid log level '" + level.getName() + "'");
    }

    throw new IllegalArgumentException(
            "Class '" + clazz.getCanonicalName() + "' must be an instance of FlexPlugin or FlexModule.");
}

From source file:com.sios.stc.coseng.util.TestParam.java

public synchronized Boolean isValid(final LocalParam localParam) throws IOException {
    Boolean isValid = true;//  w w  w.j a  v a  2s. c  om
    // Warning items that don't necessarily invalidate the config
    if ((baseUrl == null) || baseUrl.isEmpty()) {
        TestParam.log.log(Level.WARNING, logDetails("A baseUrl was not provided; some tests may fail"));
    }
    if (verbosity == null) {
        TestParam.log.log(Level.INFO, logDetails("A verbosity was not provided; assuming level (0)"));
        verbosity = 0;
    }
    if (spot == null) {
        TestParam.log.log(Level.INFO, logDetails("A spot was not provided; assuming LOCAL"));
        spot = Spot.LOCAL;
    }
    // True|False validation parameters
    if (platform == null) {
        TestParam.log.log(Level.SEVERE, logDetails(
                "No platform was provided; a platform of (" + getPlatformOptions() + ") is REQUIRED"));
        isValid = false;
    }
    if (browser == null) {
        TestParam.log.log(Level.SEVERE,
                logDetails("No browser was provided; a browser of (" + getBrowserOptions() + ") is REQUIRED"));
        isValid = false;
    }
    // Special; chromeDriver|ieDriver when Spot.LOCAL and !Browser.FIREFOX
    if ((browser != null) && (spot == Spot.LOCAL)) {
        if (browser == Browser.CHROME) {
            // If can't find chromeDriver; bail
            final File chromeDriver = localParam.getChromeDriver();
            if ((chromeDriver == null) || !chromeDriver.exists() || !chromeDriver.canExecute()) {
                TestParam.log.log(Level.SEVERE,
                        logDetails(
                                "Testing with browser (" + browser.toString() + ") at spot (" + spot.toString()
                                        + ") REQUIRES chromeDriver. Could not find executable chromeDriver ("
                                        + chromeDriver + ")"));
                isValid = false;
            }
        } else if (browser != Browser.FIREFOX) {
            // Must be IE*
            final File ieDriver = localParam.getIeDriver();
            // If can't find ieDriver; bail
            if ((ieDriver == null) || !ieDriver.exists() || !ieDriver.canExecute()) {
                TestParam.log.log(Level.SEVERE,
                        logDetails("Testing with browser (" + browser.toString() + ") at spot ("
                                + spot.toString() + ") REQUIRES ieDriver. Could not find executable ieDriver ("
                                + ieDriver + ")"));
                isValid = false;
            }
        }
    }
    // If !windows but browser is IE*; bail
    if ((browser != null) && (platform != null)) {
        if (platform != Platform.WINDOWS) {
            if ((browser != Browser.FIREFOX) && (browser != Browser.CHROME)) {
                TestParam.log.log(Level.SEVERE,
                        logDetails("Internet Explorer IE*, any version; REQUIRES platform WINDOWS"));
                isValid = false;
            }
        }
    }
    if ((suite == null) || suite.isEmpty()) {
        TestParam.log.log(Level.SEVERE, logDetails("No suite provided; at least one suite XML REQUIRED"));
        isValid = false;
    } else {
        // jarSuiteTempDirectory is checked in findTestSuite
        if (!findTestSuite(localParam)) {
            TestParam.log.log(Level.SEVERE, logDetails("Could not find ALL suite (" + suite.toString() + ")"));
            isValid = false;
        }
    }
    if ((spot == Spot.GRID) && ((gridUrl == null) || gridUrl.isEmpty())) {
        TestParam.log.log(Level.SEVERE,
                logDetails("A gridUrl was not provided; spot (" + spot.toString() + ") REQUIRES gridUrl"));
        isValid = false;
    }
    if (!setTestReportDirectory(localParam)) {
        TestParam.log.log(Level.SEVERE, logDetails(
                "Could not create testReportDirectory (" + testReportDirectory.getCanonicalPath() + ")"));
        isValid = false;
    }
    if ((verbosity < 0) || (verbosity > 10)) {
        TestParam.log.log(Level.SEVERE, logDetails("Invalid verbosity; must be 0-10"));
        isValid = false;
    }
    setIsValid(isValid);
    return isValid;
}

From source file:org.openspaces.bigdata.processor.CassandraExternalPersistence.java

@Override
public void write(Object data) {
    if (!(data instanceof SpaceDocument)) {
        log.log(Level.WARNING, "Received non document event");
        return;/*from w  ww.  j  a  va  2 s  . co  m*/
    }
    SpaceDocument document = (SpaceDocument) data;
    Long id = document.getProperty("Id");
    log.info("persisting data with id=" + id);
    Mutator<String> mutator = createMutator(keyspace, stringSerializer);
    for (String key : document.getProperties().keySet()) {
        Object value = document.getProperty(key);
        if (value != null) {
            mutator.addInsertion(String.valueOf(id), //
                    columnFamily, //
                    createColumn(key, value.toString(), stringSerializer, stringSerializer));
        }
    }
    mutator.execute();
}

From source file:com.boundlessgeo.geoserver.AppConfiguration.java

/**
 * Determines the location of the composer thumbnail cache directory by running a property 
 * lookup on COMPOSER_CACHE_DIR. If this property is not found, uses the default value of 
 * GEOSERVER_DATA_DIR/composer//w ww. j ava  2  s .  c  om
 * 
 * @param servContext The servlet context.
 * @return String The absolute path to the data directory, or <code>null</code> if it could not
 * be found. 
 */
private String lookupCacheDirectory(ServletContext servContext) {

    //Try property lookup
    String cacheDir = GeoServerExtensions.getProperty("COMPOSER_CACHE_DIR", servContext);

    //Use the default of data/composer
    if (cacheDir == null) {
        cacheDir = (GeoServerExtensions.bean(GeoServerDataDirectory.class).root().getPath()) + File.separator
                + "composer";
    }
    try {
        File cacheFile = new File(cacheDir);
        if (!cacheFile.exists()) {
            cacheFile.mkdirs();
        }
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "Could not initilize composer cache directory", e);
    }
    return cacheDir;
}