Example usage for java.util.logging Level FINE

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

Introduction

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

Prototype

Level FINE

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

Click Source Link

Document

FINE is a message level providing tracing information.

Usage

From source file:edu.emory.cci.aiw.i2b2etl.ksb.QueryExecutor.java

public void prepare() throws KnowledgeSourceReadException {
    if (this.preparedStatement == null) {
        try {/*from   w  w w . j a  v a2 s.co m*/
            readOntologyTables();
            if (this.ontTables.length > 0) {
                QueryConstructorUnionedMetadataQueryBuilder builder = new QueryConstructorUnionedMetadataQueryBuilder();
                this.sql = builder.queryConstructor(this.queryConstructor).ontTables(this.ontTables).build();
                LOGGER.log(Level.FINE, "Preparing query {0}", this.sql);
                this.preparedStatement = this.connection.prepareStatement(this.sql);
                this.preparedStatement.setFetchSize(1000);
            }
        } catch (SQLException ex) {
            throw new KnowledgeSourceReadException(ex);
        }
    }
}

From source file:hudson.TcpSlaveAgentListener.java

/**
 * @param port/*from  w w w  . j a v  a 2 s  .  c  om*/
 *      Use 0 to choose a random port.
 */
public TcpSlaveAgentListener(int port) throws IOException {
    super("TCP agent listener port=" + port);
    try {
        serverSocket = ServerSocketChannel.open();
        serverSocket.socket().bind(new InetSocketAddress(port));
    } catch (BindException e) {
        throw (BindException) new BindException(
                "Failed to listen on port " + port + " because it's already in use.").initCause(e);
    }
    this.configuredPort = port;
    setUncaughtExceptionHandler((t, e) -> {
        LOGGER.log(Level.SEVERE,
                "Uncaught exception in TcpSlaveAgentListener " + t + ", attempting to reschedule thread", e);
        shutdown();
        TcpSlaveAgentListenerRescheduler.schedule(t, e);
    });

    LOGGER.log(Level.FINE, "TCP agent listener started on port {0}", getPort());

    start();
}

From source file:com.qualogy.qafe.core.application.ApplicationContextLoader.java

private static ApplicationIdentifier load(ApplicationContext context, URI applicationFilePath) {

    if (context == null)
        throw new IllegalArgumentException("context cannot be null");

    if (logger.isLoggable(Level.FINE))
        logger.info("start loading [" + context.getName() + "]\ncontext [" + context + "]\ncluster ["
                + ApplicationCluster.getInstance().toString() + "]");
    else if (logger.isLoggable(Level.INFO))
        logger.info("start loading [" + context.getName() + "]");

    try {/*  ww w . j a  v a2 s. c om*/
        context = createManagers(context);
        context.setOriginAppConfigFileLocation(applicationFilePath);
        context.init();
    } catch (Exception e) {
        e.printStackTrace();
        context.handleLoadFailure(e);
    }

    if (logger.isLoggable(Level.FINE))
        logger.info("done loading [" + context.getName() + "]\nstored in cluster with id [" + context.getId()
                + "]\ncontext [" + context + "]\ncluster [" + ApplicationCluster.getInstance().toString()
                + "]");
    else if (logger.isLoggable(Level.INFO))
        logger.info("done loading [" + context.getName() + "], stored in cluster with id [" + context.getId()
                + "]");

    return context.getId();
}

From source file:com.michelin.cio.jenkins.plugin.rrod.RequestRenameOrDeletePlugin.java

public HttpResponse doManageRequests(StaplerRequest request, StaplerResponse response)
        throws IOException, ServletException {
    Hudson.getInstance().checkPermission(Hudson.ADMINISTER);

    errors.clear();//from  ww w .  ja v  a  2s.com

    String[] selectedRequests = request.getParameterValues("selected");

    //Store the request once they have been applied
    List<Request> requestsToRemove = new ArrayList<Request>();

    if (selectedRequests != null && selectedRequests.length > 0) {
        for (String sindex : selectedRequests) {
            if (StringUtils.isNotBlank(sindex)) {
                int index = Integer.parseInt(sindex);
                Request currentRequest = requests.get(index);

                if (StringUtils.isNotBlank(request.getParameter("apply"))) {

                    if (currentRequest.process()) {
                        //Store to remove
                        requestsToRemove.add(currentRequest);
                    } else {
                        errors.add(currentRequest.getErrorMessage());
                        LOGGER.log(Level.WARNING, "The request \"{0}\" can not be processed",
                                currentRequest.getMessage());
                    }
                } else {
                    requestsToRemove.add(currentRequest);
                    LOGGER.log(Level.INFO, "The request \"{0}\" has been discarded",
                            currentRequest.getMessage());
                }

            } else {
                LOGGER.log(Level.WARNING, "The request index is not defined");
            }
        }
    } else {
        LOGGER.log(Level.FINE, "Nothing selected");
    }

    //Once it has done thr work, it removes the applied requests
    if (!requestsToRemove.isEmpty()) {
        removeAllRequests(requestsToRemove);
    }

    return new HttpRedirect(".");
}

From source file:com.elasticgrid.storage.rackspace.CloudFilesContainer.java

public Storable uploadStorable(String name, File file) throws StorageException {
    try {/*from  ww  w  . j  a  va2 s . c  o  m*/
        rackspace.login();
        // create directories if needed
        String path = name.substring(0, name.lastIndexOf('/'));
        logger.log(Level.FINE, "Creating full path \"{0}\"", path);
        rackspace.createFullPath(getName(), path);
        // upload the file
        logger.log(Level.FINE, "Uploading \"{0}\"", name);
        InputStream stream = null;
        try {
            stream = FileUtils.openInputStream(file);
            rackspace.storeStreamedObject(getName(), stream, mimes.getContentType(file), name,
                    Collections.<String, String>emptyMap());
        } finally {
            IOUtils.closeQuietly(stream);
        }
        // retrieve rackspace object
        return findStorableByName(name);
    } catch (Exception e) {
        throw new StorageException("Can't upload storable from file", e);
    }
}

From source file:bookkeepr.managers.SyncManager.java

public void sync() {
    HttpClient httpclient = obsdb.getBookkeepr().checkoutHttpClient();

    for (BookkeeprHost host : config.getBookkeeprHostList()) {
        Logger.getLogger(SyncManager.class.getName()).log(Level.INFO,
                "Attempting to sync with " + host.getUrl());
        try {/* w ww.j a  va2s  . c  om*/

            HttpGet httpget = new HttpGet(host.getUrl() + "/ident/");
            HttpResponse response = httpclient.execute(httpget);
            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                InputStream in = response.getEntity().getContent();
                BookkeeprHost rhost = (BookkeeprHost) XMLReader.read(in);
                in.close();

                Logger.getLogger(SyncManager.class.getName()).log(Level.FINE,
                        "Managed to connect to " + host.getUrl() + "/ident/ ");
                host.setOriginId(rhost.getOriginId());

                host.setMaxOriginId(rhost.getMaxOriginId());
                host.setVersion(rhost.getVersion());
                if (host.getVersion() != obsdb.getBookkeepr().getHost().getVersion()) {
                    Logger.getLogger(SyncManager.class.getName()).log(Level.INFO, "Host " + host.getUrl()
                            + " is not of the same BookKeepr version as us! (Cannot sync)");
                    if (host.getVersion() > obsdb.getBookkeepr().getHost().getVersion()) {
                    }
                    Logger.getLogger(SyncManager.class.getName()).log(Level.INFO,
                            "There are newer versions of the BookKeepr on the network. Please update this software!");
                }

            } else {
                Logger.getLogger(SyncManager.class.getName()).log(Level.WARNING,
                        "Host " + host.getUrl() + " could not be identified");
                continue;
            }

        } catch (SAXException ex) {
            Logger.getLogger(SyncManager.class.getName()).log(Level.SEVERE, null, ex);
            continue;
        } catch (IOException ex) {
            Logger.getLogger(SyncManager.class.getName()).log(Level.INFO,
                    "Host " + host.getUrl() + " was not avaiable for syncing");
            continue;
        } catch (HttpException ex) {
            Logger.getLogger(SyncManager.class.getName()).log(Level.INFO,
                    "Host " + host.getUrl() + " was not avaiable for syncing");
            continue;
        } catch (URISyntaxException ex) {
            Logger.getLogger(SyncManager.class.getName()).log(Level.SEVERE, null, ex);
            continue;
        }

        ArrayList<Session> sessions = new ArrayList<Session>();

        for (int originId = 0; originId <= host.getMaxOriginId(); originId++) {

            long maxRequestId;
            try {

                String url = host.getUrl() + "/sync/" + originId + "/"
                        + TypeIdManager.getTypeFromClass(Session.class);
                HttpGet httpget = new HttpGet(url);
                HttpResponse response = httpclient.execute(httpget);
                if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {

                    Logger.getLogger(SyncManager.class.getName()).log(Level.FINE,
                            "Managed to connect to " + host.getUrl() + "/sync/ ");

                } else if (response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_FOUND) {
                    Logger.getLogger(SyncManager.class.getName()).log(Level.INFO, "Up-to-date with host");
                    continue;
                } else {
                    Logger.getLogger(SyncManager.class.getName()).log(Level.INFO, "Got an unexpected "
                            + response.getStatusLine().getStatusCode() + " response from " + host.getUrl());
                    continue;
                }

                InputStream in = response.getEntity().getContent();
                Session topSession = (Session) XMLReader.read(in);
                in.close();

                maxRequestId = topSession.getId();
            } catch (ClassCastException ex) {
                Logger.getLogger(SyncManager.class.getName()).log(Level.WARNING, "Server " + host.getUrl()
                        + " returned something that was not as session when asked for the latest session.", ex);
                continue;
            } catch (HttpException ex) {
                Logger.getLogger(SyncManager.class.getName()).log(Level.INFO,
                        "Host " + host.getUrl() + " could not be contacted");
                continue;
            } catch (URISyntaxException ex) {
                Logger.getLogger(SyncManager.class.getName()).log(Level.WARNING, "Bad url " + host.getUrl()
                        + "/sync/" + originId + "/" + TypeIdManager.getTypeFromClass(Session.class), ex);
                continue;
            } catch (SAXException ex) {
                Logger.getLogger(SyncManager.class.getName()).log(Level.WARNING,
                        "Malformed XML file received from server " + host.getOriginId(), ex);
                continue;
            } catch (IOException ex) {
                Logger.getLogger(SyncManager.class.getName()).log(Level.INFO,
                        "Host " + host.getUrl() + " was not avaiable for syncing");
                continue;
            }

            long startId = sessionManager.getNextId(originId);
            Logger.getLogger(SyncManager.class.getName()).log(Level.INFO,
                    "Expecting next session: " + Long.toHexString(startId));
            for (long requestId = startId; requestId <= maxRequestId; requestId++) {
                if (originId == 0) {
                    Logger.getLogger(SyncManager.class.getName()).log(Level.SEVERE, "Server " + host.getUrl()
                            + " claims that there are items created by server 0, which is impossible.");
                    break;
                }
                if (originId == obsdb.getOriginId()) {
                    Logger.getLogger(SyncManager.class.getName()).log(Level.SEVERE,
                            "There are more up-to-date versions of data we created than in our database!");
                    break;
                }
                Logger.getLogger(SyncManager.class.getName()).log(Level.INFO,
                        "Updating to session " + Long.toHexString(requestId));
                try {
                    String url = host.getUrl() + "/update/" + Long.toHexString(requestId);

                    HttpGet httpget = new HttpGet(url);
                    HttpResponse response = httpclient.execute(httpget);
                    if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                    } else {
                        Logger.getLogger(SyncManager.class.getName()).log(Level.INFO, "Got an unexpected "
                                + response.getStatusLine().getStatusCode() + " response from " + host.getUrl());
                        continue;
                    }

                    InputStream in = response.getEntity().getContent();
                    IndexIndex idxidx = (IndexIndex) XMLReader.read(in);
                    in.close();

                    Session session = new Session();
                    session.setId(requestId);

                    for (Index idx : idxidx.getIndexList()) {
                        for (Object idable : idx.getIndex()) {
                            obsdb.add((IdAble) idable, session);
                        }
                    }
                    sessions.add(session);
                    //obsdb.save(session);
                } catch (HttpException ex) {
                    Logger.getLogger(SyncManager.class.getName()).log(Level.INFO,
                            "HTTP exception connecting to host " + host.getUrl());
                    continue;
                } catch (URISyntaxException ex) {
                    Logger.getLogger(SyncManager.class.getName()).log(Level.WARNING, ex.getMessage(), ex);
                    break;
                } catch (SAXException ex) {
                    Logger.getLogger(SyncManager.class.getName()).log(Level.WARNING, ex.getMessage(), ex);
                    break;
                } catch (IOException ex) {
                    Logger.getLogger(SyncManager.class.getName()).log(Level.WARNING, ex.getMessage(), ex);
                    break;
                }
            }
        }
        if (!sessions.isEmpty()) {
            try {
                Logger.getLogger(SyncManager.class.getName()).log(Level.INFO, "Saving updates to database");
                obsdb.save(sessions);
                Logger.getLogger(SyncManager.class.getName()).log(Level.INFO,
                        "Database Synchronised with " + host.getUrl());
            } catch (BookKeeprException ex) {
                Logger.getLogger(SyncManager.class.getName()).log(Level.SEVERE,
                        "Somehow tried to modify external elements from a database sync. This should never happen!",
                        ex);
            }
        }
    }
    this.obsdb.getBookkeepr().returnHttpClient(httpclient);
}

From source file:name.richardson.james.bukkit.utilities.persistence.database.AbstractDatabaseLoader.java

@Override
public final void load() {
    logger.log(Level.FINE, "Loading database.");
    final Level level = java.util.logging.Logger.getLogger("").getLevel();
    java.util.logging.Logger.getLogger("").setLevel(Level.OFF);
    ClassLoader currentClassLoader = null;
    try {/*from  ww w  .  j a  v a2  s  . com*/
        this.serverConfig.setClasses(this.classes);
        if (logger.isLoggable(Level.ALL)) {
            this.serverConfig.setLoggingToJavaLogger(true);
            this.serverConfig.setLoggingLevel(LogLevel.SQL);
        }
        // suppress normal ebean warnings and notifications
        currentClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(this.classLoader);
        this.ebeanserver = EbeanServerFactory.create(this.serverConfig);
    } finally {
        // re-enable logging
        java.util.logging.Logger.getLogger("").setLevel(level);
        if (currentClassLoader != null) {
            Thread.currentThread().setContextClassLoader(currentClassLoader);
        }
    }
}

From source file:com.elasticgrid.platforms.ec2.StartInstanceTask.java

public List<String> call() throws RemoteException {
    String securityGroupNameForCluster = "elastic-grid-cluster-" + clusterName;
    // start the agent node
    List<String> groups = null;
    switch (profile) {
    case MONITOR:
        groups = Arrays.asList(securityGroupNameForCluster, Discovery.MONITOR.getGroupName(), "elastic-grid");
        break;//w w w.  j  a v  a  2  s .  c o  m
    case AGENT:
        groups = Arrays.asList(securityGroupNameForCluster, Discovery.AGENT.getGroupName(), "elastic-grid");
        break;
    case MONITOR_AND_AGENT:
        groups = Arrays.asList(securityGroupNameForCluster, Discovery.MONITOR.getGroupName(),
                Discovery.AGENT.getGroupName(), "elastic-grid");
        break;
    }
    logger.log(Level.FINE, "Starting 1 Amazon EC2 instance from AMI {0} using groups {1} and user data {2}...",
            new Object[] { ami, groups.toString(), userData });
    return nodeInstantiator.startInstances(ami, 1, 1, groups, userData, keypair, true, instanceType);
}

From source file:io.hops.hopsworks.api.tensorflow.TensorboardProxyServlet.java

@Override
protected void service(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
        throws ServletException, IOException {
    String email = servletRequest.getUserPrincipal().getName();
    LOGGER.log(Level.FINE, "Request URL: {0}", servletRequest.getRequestURL());

    String uri = servletRequest.getRequestURI();
    // valid hostname regex:
    // https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
    Pattern urlPattern = Pattern.compile("([a-zA-Z0-9\\-\\.]{2,255}:[0-9]{4,6})(/.*$)");
    Matcher urlMatcher = urlPattern.matcher(uri);
    String hostPortPair = "";
    String uriToFinish = "/";
    if (urlMatcher.find()) {
        hostPortPair = urlMatcher.group(1);
        uriToFinish = urlMatcher.group(2);
    }/* w  w w  .  jav  a 2  s  . c o  m*/
    if (hostPortPair.isEmpty()) {
        throw new ServletException("Couldn't extract host:port from: " + servletRequest.getRequestURI());
    }

    Pattern appPattern = Pattern.compile("(application_.*?_\\d*)");
    Matcher appMatcher = appPattern.matcher(servletRequest.getRequestURI());

    Pattern elasticPattern = Pattern.compile("(experiments)");
    Matcher elasticMatcher = elasticPattern.matcher(servletRequest.getRequestURI());
    if (elasticMatcher.find()) {

        List<TensorBoard> TBList = tensorBoardFacade.findByUserEmail(email);
        if (TBList == null) {
            servletResponse.sendError(Response.Status.FORBIDDEN.getStatusCode(),
                    "This TensorBoard is not running right now");
        }
        boolean foundTB = false;
        for (TensorBoard tb : TBList) {
            if (tb.getEndpoint().equals(hostPortPair)) {
                foundTB = true;
                break;
            }
        }

        if (!foundTB) {
            servletResponse.sendError(Response.Status.FORBIDDEN.getStatusCode(),
                    "This TensorBoard is not running right now");
            return;
        }

        targetUri = uriToFinish;

        String theHost = "http://" + hostPortPair;
        URI targetUriHost;
        try {
            targetUriObj = new URI(targetUri);
            targetUriHost = new URI(theHost);
        } catch (Exception e) {
            throw new ServletException("Trying to process targetUri init parameter: ", e);
        }
        targetHost = URIUtils.extractHost(targetUriHost);
        servletRequest.setAttribute(ATTR_TARGET_URI, targetUri);
        servletRequest.setAttribute(ATTR_TARGET_HOST, targetHost);
        servletRequest.setAttribute(ATTR_URI_FINISH, uriToFinish);
        servletRequest.setAttribute(ATTR_HOST_PORT, hostPortPair);

        try {
            super.service(servletRequest, servletResponse);
        } catch (IOException ex) {
            sendErrorResponse(servletResponse,
                    "This TensorBoard is not ready to serve requests right now, " + "try refreshing the page");
            return;
        }

    } else if (appMatcher.find()) {
        String appId = appMatcher.group(1);
        YarnApplicationstate appState = yarnApplicationstateFacade.findByAppId(appId);
        if (appState == null) {
            servletResponse.sendError(Response.Status.FORBIDDEN.getStatusCode(),
                    "You don't have the access right for this application");
            return;
        }
        String projectName = hdfsUsersBean.getProjectName(appState.getAppuser());
        ProjectDTO project;
        try {
            project = projectController.getProjectByName(projectName);
        } catch (ProjectException ex) {
            throw new ServletException(ex);
        }

        Users user = userFacade.findByEmail(email);

        boolean inTeam = false;
        for (ProjectTeam pt : project.getProjectTeam()) {
            if (pt.getUser().equals(user)) {
                inTeam = true;
                break;
            }
        }
        if (!inTeam) {
            servletResponse.sendError(Response.Status.FORBIDDEN.getStatusCode(),
                    "You don't have the access right for this application");
            return;
        }
        if (appState.getAppsmstate() != null
                && (appState.getAppsmstate().equalsIgnoreCase(YarnApplicationState.FINISHED.toString())
                        || appState.getAppsmstate().equalsIgnoreCase(YarnApplicationState.KILLED.toString()))) {
            sendErrorResponse(servletResponse, "This TensorBoard has finished running");
            return;
        }
        targetUri = uriToFinish;

        String theHost = "http://" + hostPortPair;
        URI targetUriHost;
        try {
            targetUriObj = new URI(targetUri);
            targetUriHost = new URI(theHost);
        } catch (Exception e) {
            throw new ServletException("Trying to process targetUri init parameter: ", e);
        }
        targetHost = URIUtils.extractHost(targetUriHost);
        servletRequest.setAttribute(ATTR_TARGET_URI, targetUri);
        servletRequest.setAttribute(ATTR_TARGET_HOST, targetHost);
        servletRequest.setAttribute(ATTR_URI_FINISH, uriToFinish);
        servletRequest.setAttribute(ATTR_HOST_PORT, hostPortPair);

        try {
            super.service(servletRequest, servletResponse);
        } catch (IOException ex) {
            sendErrorResponse(servletResponse, "This TensorBoard is not running right now");
            return;
        }

    } else {
        servletResponse.sendError(Response.Status.FORBIDDEN.getStatusCode(),
                "You don't have the access right for this application");
        return;
    }

}

From source file:org.apache.reef.runtime.hdinsight.client.yarnrest.HDInsightInstance.java

/**
 * Submits an application for execution.
 *
 * @param applicationSubmission/*from  w  ww. j av  a 2s .com*/
 * @throws IOException
 */
public void submitApplication(final ApplicationSubmission applicationSubmission) throws IOException {
    final String url = "ws/v1/cluster/apps";
    final HttpPost post = preparePost(url);

    final StringWriter writer = new StringWriter();
    try {
        this.objectMapper.writeValue(writer, applicationSubmission);
    } catch (final IOException e) {
        throw new RuntimeException(e);
    }
    final String message = writer.toString();
    LOG.log(Level.FINE, "Sending:\n{0}", message.replace("\n", "\n\t"));
    post.setEntity(new StringEntity(message, ContentType.APPLICATION_JSON));

    try (final CloseableHttpResponse response = this.httpClient.execute(post, this.httpClientContext)) {
        final String responseMessage = IOUtils.toString(response.getEntity().getContent());
        LOG.log(Level.FINE, "Response: {0}", responseMessage.replace("\n", "\n\t"));
    }
}