Example usage for java.util.logging Level FINEST

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

Introduction

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

Prototype

Level FINEST

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

Click Source Link

Document

FINEST indicates a highly detailed tracing message.

Usage

From source file:com.machinepublishers.jbrowserdriver.LogsServer.java

public void wire(String message) {
    Settings settings = SettingsManager.settings();
    if (settings != null && settings.logWire()) {
        handleMessage(message, wire, Level.FINEST, "wire", settings);
    }// w w  w  .  j  av  a  2s . c om
}

From source file:com.ibm.watson.developer_cloud.service.WatsonService.java

/**
 * Execute the Http request./*from ww  w.  ja  v a2 s  .com*/
 * 
 * @param request
 *            the http request
 * 
 * @return the http response
 */
protected HttpResponse execute(HttpRequestBase request) {

    setAuthentication(request);

    if (getEndPoint() == null)
        throw new IllegalArgumentException("service endpoint was not specified");

    if (!request.containsHeader(ACCEPT)) {
        request.addHeader(ACCEPT, getDefaultContentType());
    }

    // from /v1/foo/bar to https://host:port/api/v1/foo/bar
    if (!request.getURI().isAbsolute()) {
        request.setURI(buildRequestURI(request));
    }
    HttpResponse response;

    //HttpHost proxy=new HttpHost("10.100.1.124",3128);

    log.log(Level.FINEST, "Request to: " + request.getURI());
    try {
        response = getHttpClient().execute(request);
        //ConnRouteParams.setDefaultProxy(response.getParams(),proxy);
    } catch (ClientProtocolException e) {
        log.log(Level.SEVERE, "ClientProtocolException", e);
        throw new RuntimeException(e);
    } catch (IOException e) {
        log.log(Level.SEVERE, "IOException", e);
        throw new RuntimeException(e);
    }

    final int status = response.getStatusLine().getStatusCode();
    log.log(Level.FINEST, "Response HTTP Status: " + status);

    if (status >= 200 && status < 300)
        return response;

    // There was a Client Error 4xx or a Server Error 5xx
    // Get the error message and create the exception
    String error = getErrorMessage(response);
    log.log(Level.SEVERE, "HTTP Status: " + status + ", message: " + error);

    switch (status) {
    case HttpStatus.SC_BAD_REQUEST: // HTTP 400
        throw new BadRequestException(error != null ? error : "Bad Request");
    case HttpStatus.SC_UNAUTHORIZED: // HTTP 401
        throw new UnauthorizedException("Unauthorized: Access is denied due to invalid credentials");
    case HttpStatus.SC_FORBIDDEN: // HTTP 403
        throw new ForbiddenException(error != null ? error : "Forbidden: Service refuse the request");
    case HttpStatus.SC_NOT_FOUND: // HTTP 404
        throw new NotFoundException(error != null ? error : "Not found");
    case HttpStatus.SC_NOT_ACCEPTABLE: // HTTP 406
        throw new ForbiddenException(error != null ? error : "Forbidden: Service refuse the request");
    case HttpStatus.SC_REQUEST_TOO_LONG: // HTTP 413
        throw new RequestTooLargeException(error != null ? error
                : "Request too large: The request entity is larger than the server is able to process");
    case HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE: // HTTP 415
        throw new UnsupportedException(error != null ? error
                : "Unsupported MIME type: The request entity has a media type which the server or resource does not support");
    case 429: // HTTP 429
        throw new TooManyRequestsException(error != null ? error : "Too many requests");
    case HttpStatus.SC_INTERNAL_SERVER_ERROR: // HTTP 500
        throw new InternalServerErrorException(error != null ? error : "Internal Server Error");
    case HttpStatus.SC_SERVICE_UNAVAILABLE: // HTTP 503
        throw new ServiceUnavailableException(error != null ? error : "Service Unavailable");
    default: // other errors
        throw new ServiceResponseException(status, error);
    }
}

From source file:com.sun.grizzly.http.jk.common.JniHandler.java

protected void initNative(String nativeComponentName) {
    apr = (AprImpl) wEnv.getHandler("apr");
    if (apr == null) {
        // In most cases we can just load it automatically.
        // that requires all libs to be installed in standard places
        // ( LD_LIBRARY_PATH, /usr/lib
        try {/*from   w w  w .  j  a v  a2s  .  co  m*/
            apr = new AprImpl();
            wEnv.addHandler("apr", apr);
            apr.init();
            if (oname != null) {
                ObjectName aprname = new ObjectName(oname.getDomain() + ":type=JkHandler, name=apr");
                Registry.getRegistry(null, null).registerComponent(apr, aprname, null);
            }
        } catch (Throwable t) {
            LoggerUtils.getLogger().log(Level.FINEST, "Can't load apr", t);
            apr = null;
        }
    }
    if (apr == null || !apr.isLoaded()) {
        if (LoggerUtils.getLogger().isLoggable(Level.FINEST)) {
            LoggerUtils.getLogger().log(Level.FINEST, "No apr, disabling jni proxy ");
        }
        apr = null;
        return;
    }

    try {
        long xEnv = apr.getJkEnv();
        nativeJkHandlerP = apr.getJkHandler(xEnv, nativeComponentName);

        if (nativeJkHandlerP == 0) {
            LoggerUtils.getLogger().log(Level.FINEST,
                    "Component not found, creating it " + nativeComponentName);
            nativeJkHandlerP = apr.createJkHandler(xEnv, nativeComponentName);
        }
        LoggerUtils.getLogger().log(Level.FINEST, "Native proxy " + nativeJkHandlerP);
        apr.releaseJkEnv(xEnv);
    } catch (Throwable t) {
        apr = null;
    }
}

From source file:com.google.enterprise.connector.db.diffing.DBSnapshot.java

@Override
public String toString() {
    LOG.log(Level.FINEST, "Serializing document snapshot for {0}", documentId);
    return jsonString;
}

From source file:com.google.enterprise.connector.salesforce.BaseTraversalManager.java

/**
 * The connectormanager sets the batch limit (num of docs to return to it)..
 * this param is ignored by the salesforce connector
 *///from w w  w .j a v  a 2s.  co  m
public void setBatchHint(int hint) {
    logger.log(Level.FINEST, " setBatchHint called " + hint);
    batch_limit = hint;
}

From source file:edu.umass.cs.nio.AbstractPacketDemultiplexer.java

protected boolean handleMessageSuper(byte[] msg, NIOHeader header) throws JSONException {
    NIOInstrumenter.incrRcvd();/* w ww .j  a va  2 s  .com*/
    MessageType message = null;
    Level level = Level.FINEST;
    try {
        message = processHeader(msg, header);
    } catch (Exception | Error e) {
        e.printStackTrace();
        return false;
    }
    Integer type = message != null ? getPacketType(message) : null;
    log.log(level, "{0} handling type {1} message {2}:{3}",
            new Object[] { this, type, header, log.isLoggable(level) ? new Stringer(msg) : msg });

    if (type == null || !this.demuxMap.containsKey(type)) {
        /* It is natural for some demultiplexers to not handle some packet
         * types, so it is not a "bad" thing that requires a warning log. */
        log.log(Level.FINER, "{0} ignoring unknown packet type: {1}: {2}",
                new Object[] { this, type, message });
        return false;
    }
    Tasker tasker = new Tasker(message, this.demuxMap.get(type));
    if (this.myThreadPoolSize == 0 || isOrderPreserving(message)) {
        log.log(Level.FINER, "{0} handling message type {1} in selector thread; this can cause "
                + "deadlocks if the handler involves blocking operations", new Object[] { this, type });
        // task better be lightning quick
        tasker.run();
    } else
        try {
            log.log(Level.FINEST, "{0} invoking {1}.handleMessage({2})",
                    new Object[] { this, tasker.pd, message });
            // task should still be non-blocking
            executor.schedule(tasker, emulateDelays ? JSONDelayEmulator.getEmulatedDelay() : 0,
                    TimeUnit.MILLISECONDS);
        } catch (RejectedExecutionException ree) {
            if (!executor.isShutdown())
                ree.printStackTrace();
            return false;
        }
    /* Note: executor.submit() consistently yields poorer performance than
     * scheduling at 0 as above even though they are equivalent. Probably
     * garbage collection or heap optimization issues. */
    return true;
}

From source file:com.google.enterprise.connector.salesforce.BaseTraversalManager.java

public DocumentList startTraversal() {
    logger.log(Level.FINEST, " startTraversal called ");
    DocumentList rdl = traverse("");
    return rdl;
}

From source file:net.sourceforge.pmd.util.database.DBType.java

/**
 * Load properties from one or more files or resources.
 *
 * <p>//from  w ww .j  av a  2  s  .  co m
 * This method recursively finds property files or JAR resources matching
 * {@matchstring}.
 * </p>
 * .
 * <p>
 * The method is intended to be able to use , so any
 *
 * @param matchString
 * @return "current" set of properties (from one or more resources/property
 *         files)
 */
private Properties loadDBProperties(String matchString) throws IOException {
    LOGGER.entering(DBType.class.getCanonicalName(), matchString);
    // Locale locale = Control.g;
    ResourceBundle resourceBundle = null;
    InputStream stream = null;

    if (LOGGER.isLoggable(Level.FINEST)) {
        LOGGER.finest("class_path+" + System.getProperty("java.class.path"));
    }

    /*
     * Attempt to match properties files in this order:- File path with
     * properties suffix File path without properties suffix Resource
     * without class prefix Resource with class prefix
     */
    try {
        File propertiesFile = new File(matchString);
        if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.finest("Attempting File no file suffix: " + matchString);
        }
        stream = new FileInputStream(propertiesFile);
        resourceBundle = new PropertyResourceBundle(stream);
        propertiesSource = propertiesFile.getAbsolutePath();
        LOGGER.finest("FileSystemWithoutExtension");
    } catch (FileNotFoundException notFoundOnFilesystemWithoutExtension) {
        if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.finest("notFoundOnFilesystemWithoutExtension");
            LOGGER.finest("Attempting File with added file suffix: " + matchString + ".properties");
        }
        try {
            File propertiesFile = new File(matchString + ".properties");
            stream = new FileInputStream(propertiesFile);
            resourceBundle = new PropertyResourceBundle(stream);
            propertiesSource = propertiesFile.getAbsolutePath();
            LOGGER.finest("FileSystemWithExtension");
        } catch (FileNotFoundException notFoundOnFilesystemWithExtensionTackedOn) {
            if (LOGGER.isLoggable(Level.FINEST)) {
                LOGGER.finest("Attempting JARWithoutClassPrefix: " + matchString);
            }
            try {
                resourceBundle = ResourceBundle.getBundle(matchString);
                propertiesSource = "[" + INTERNAL_SETTINGS + "]" + File.separator + matchString + ".properties";
                LOGGER.finest("InJarWithoutPath");
            } catch (Exception notInJarWithoutPath) {
                if (LOGGER.isLoggable(Level.FINEST)) {
                    LOGGER.finest("Attempting JARWithClass prefix: " + DBType.class.getCanonicalName() + "."
                            + matchString);
                }
                try {
                    resourceBundle = ResourceBundle
                            .getBundle(DBType.class.getPackage().getName() + "." + matchString);
                    propertiesSource = "[" + INTERNAL_SETTINGS + "]" + File.separator + matchString
                            + ".properties";
                    LOGGER.finest("found InJarWithPath");
                } catch (Exception notInJarWithPath) {
                    notInJarWithPath.printStackTrace();
                    notFoundOnFilesystemWithExtensionTackedOn.printStackTrace();
                    throw new RuntimeException(" Could not locate DBTYpe settings : " + matchString,
                            notInJarWithPath);
                }
            }
        }
    } finally {
        IOUtils.closeQuietly(stream);
    }

    // Properties in this matched resource
    Properties matchedProperties = getResourceBundleAsProperties(resourceBundle);
    resourceBundle = null;
    String saveLoadedFrom = getPropertiesSource();

    /*
     * If the matched properties contain the "extends" key, use the value as
     * a matchstring, to recursively set the properties before overwriting
     * any previous properties with the matched properties.
     */
    String extendedPropertyFile = (String) matchedProperties.remove("extends");
    if (null != extendedPropertyFile && !"".equals(extendedPropertyFile.trim())) {
        Properties extendedProperties = loadDBProperties(extendedPropertyFile.trim());

        // Overwrite extended properties with properties in the matched
        // resource
        extendedProperties.putAll(matchedProperties);
        matchedProperties = extendedProperties;
    }

    /*
     * Record the location of the original matched resource/property file,
     * and the current set of properties secured.
     */
    propertiesSource = saveLoadedFrom;
    setProperties(matchedProperties);

    return matchedProperties;
}

From source file:com.microsoft.azuretools.adauth.ResponseUtils.java

private static IdToken parseIdToken(String idToken) throws IOException {
    IdToken idTokenBody = null;//  w  w  w .  ja va 2  s  .  com
    if (!StringUtils.isNullOrWhiteSpace(idToken)) {
        log.log(Level.FINEST, "idToken: " + idToken);
        String[] idTokenSegments = idToken.split("\\.");

        // If Id token format is invalid, we silently ignore the id token
        if (idTokenSegments.length == 2) {
            byte[] decoded = Base64.decodeBase64(idTokenSegments[1]);
            log.log(Level.FINEST, "==> decoded idToken: " + new String(decoded));
            idTokenBody = JsonHelper.deserialize(IdToken.class, new String(decoded));
        }
    }
    return idTokenBody;
}

From source file:com.microsoft.azure.util.TokenCache.java

private boolean writeTokenFile(final AccessToken token) {
    LOGGER.log(Level.FINEST, "TokenCache: writeTokenFile: Write token into file {0}", path);

    FileOutputStream fout = null;
    ObjectOutputStream oos = null;

    boolean res = false;

    try {/*from w  ww . ja  v  a  2s .  c om*/
        fout = new FileOutputStream(path, false);
        oos = new ObjectOutputStream(fout);
        oos.writeObject(token);
        res = true;
    } catch (FileNotFoundException e) {
        LOGGER.log(Level.SEVERE, "TokenCache: writeTokenFile: Cache file not found", e);
    } catch (IOException e) {
        LOGGER.log(Level.SEVERE, "TokenCache: writeTokenFile: Error serializing object", e);
    } finally {
        IOUtils.closeQuietly(fout);
        IOUtils.closeQuietly(oos);
    }

    return res;
}