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:de.jfachwert.post.Ort.java

private static String[] split(String name) {
    String input = StringUtils.trimToEmpty(name);
    String[] splitted = new String[] { "", input };
    if (input.contains(" ")) {
        try {/* ww  w.  j av  a 2s. c  o  m*/
            String plz = PLZ.validate(StringUtils.substringBefore(input, " "));
            splitted[0] = plz;
            splitted[1] = StringUtils.substringAfter(input, " ").trim();
        } catch (ValidationException ex) {
            LOG.log(Level.FINE, "no PLZ inside '" + name + "' found:", ex);
        }
    }
    return splitted;
}

From source file:net.osten.watermap.batch.FetchPCTWaypointsJob.java

/**
 * Fetch the PCT waypoint files and save in output directory.
 *
 * @see javax.batch.api.Batchlet#process()
 * @return FAILED if the files cannot be downloaded or can't be written to disk; COMPLETED otherwise
 *///from ww w.j  a  v a  2s.  c o m
@Override
public String process() throws Exception {
    outputDir = new File(config.getString("output_dir"));

    if (!outputDir.isDirectory()) {
        log.log(Level.WARNING, "Output directory [{0}] is not a directory.", outputDir);
        return BatchStatus.FAILED.toString();
    } else if (!outputDir.canWrite()) {
        log.log(Level.WARNING, "Output directory [{0}] is not writable.", outputDir);
        return BatchStatus.FAILED.toString();
    }

    for (String url : URLS) {
        log.log(Level.FINE, "Fetching PCT waypoints from {0}", new Object[] { url });

        byte[] response = Request.Get(context.getProperties().getProperty(url)).execute().returnContent()
                .asBytes();
        File outputFile = new File(outputDir.getAbsolutePath() + File.separator + url + "_state_gps.zip");
        FileUtils.writeByteArrayToFile(outputFile, response);

        if (outputFile.exists()) {
            unZipIt(outputFile, outputDir);
        }
    }

    return BatchStatus.COMPLETED.toString();
}

From source file:com.amazonaws.eclipse.elasticbeanstalk.git.AWSGitPushCommand.java

public void execute() throws CoreException {
    Iterable<PushResult> pushResults = null;
    try {/*from  w  ww. j a v a2  s  . c  o  m*/
        Repository repository = initializeRepository();

        // Add the new files
        clearOutRepository(repository);
        extractZipFile(archiveFile, repoLocation);
        commitChanges(repository, "Incremental Deployment: " + new Date().toString());

        // Push to AWS
        String remoteUrl = getRemoteUrl();

        if (log.isLoggable(Level.FINE))
            log.fine("Pushing to: " + remoteUrl);
        PushCommand pushCommand = new Git(repository).push().setRemote(remoteUrl).setForce(true).add("master");
        // TODO: we could use a ProgressMonitor here for reporting status back to the UI
        pushResults = pushCommand.call();
    } catch (Throwable t) {
        throwCoreException(null, t);
    }

    for (PushResult pushResult : pushResults) {
        String messages = pushResult.getMessages();
        if (messages != null && messages.trim().length() > 0) {
            throwCoreException(messages, null);
        }
    }
}

From source file:com.qualogy.qafe.service.DocumentServiceImpl.java

public DocumentOutput processExcelUpload(DocumentParameter parameter) {
    DocumentOutput out = null;/*from   w  w  w.j av  a 2  s.c o  m*/
    try {
        out = handleExcel2003(parameter);
    } catch (OfficeXmlFileException e) {
        out = handleExcel2007(parameter);
    } catch (IOException e) {
        if (canHandleCSV(e)) {
            out = handleCSV(parameter);
        } else {
            LOG.log(Level.FINE, e.getMessage(), e);
            throw new RuntimeException(e);
        }
    }
    // store the sequence of the columns,
    // this information will lose when calling through the webservice
    out.setColumnSequence(getSequence(out.getData()));
    return out;
}

From source file:com.aliyun.datahub.auth.AliyunRequestSigner.java

public String getSignature(String resource, DefaultRequest req) {
    try {//from  ww  w.jav  a2  s  .  com
        resource = URLDecoder.decode(resource, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    String strToSign = SecurityUtils.buildCanonicalString(resource, req, "x-datahub-");

    if (log.isLoggable(Level.FINE)) {
        log.fine("String to sign: " + strToSign);
    }

    byte[] crypto = SecurityUtils.hmacsha1Signature(strToSign.getBytes(), accessKey.getBytes());

    String signature = Base64.encodeBase64String(crypto).trim();

    return "DATAHUB " + accessId + ":" + signature;
}

From source file:com.hipu.bdb.util.FileUtils.java

/**
  * Copy up to extent bytes of the source file to the destination
  */*  www . j  a va  2  s.c  o  m*/
  * @param src
  * @param dest
  * @param extent Maximum number of bytes to copy
 * @param overwrite If target file already exits, and this parameter is
  * true, overwrite target file (We do this by first deleting the target
  * file before we begin the copy).
 * @return True if the extent was greater than actual bytes copied.
  * @throws FileNotFoundException
  * @throws IOException
  */
public static boolean copyFile(final File src, final File dest, long extent, final boolean overwrite)
        throws FileNotFoundException, IOException {
    boolean result = false;
    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine("Copying file " + src + " to " + dest + " extent " + extent + " exists " + dest.exists());
    }
    if (dest.exists()) {
        if (overwrite) {
            dest.delete();
            LOGGER.finer(dest.getAbsolutePath() + " removed before copy.");
        } else {
            // Already in place and we're not to overwrite.  Return.
            return result;
        }
    }
    FileInputStream fis = null;
    FileOutputStream fos = null;
    FileChannel fcin = null;
    FileChannel fcout = null;
    try {
        // Get channels
        fis = new FileInputStream(src);
        fos = new FileOutputStream(dest);
        fcin = fis.getChannel();
        fcout = fos.getChannel();
        if (extent < 0) {
            extent = fcin.size();
        }

        // Do the file copy
        long trans = fcin.transferTo(0, extent, fcout);
        if (trans < extent) {
            result = false;
        }
        result = true;
    } catch (IOException e) {
        // Add more info to the exception. Preserve old stacktrace.
        // We get 'Invalid argument' on some file copies. See
        // http://intellij.net/forums/thread.jsp?forum=13&thread=63027&message=853123
        // for related issue.
        String message = "Copying " + src.getAbsolutePath() + " to " + dest.getAbsolutePath() + " with extent "
                + extent + " got IOE: " + e.getMessage();
        if ((e instanceof ClosedByInterruptException)
                || ((e.getMessage() != null) && e.getMessage().equals("Invalid argument"))) {
            LOGGER.severe("Failed copy, trying workaround: " + message);
            workaroundCopyFile(src, dest);
        } else {
            IOException newE = new IOException(message);
            newE.initCause(e);
            throw newE;
        }
    } finally {
        // finish up
        if (fcin != null) {
            fcin.close();
        }
        if (fcout != null) {
            fcout.close();
        }
        if (fis != null) {
            fis.close();
        }
        if (fos != null) {
            fos.close();
        }
    }
    return result;
}

From source file:edu.uci.ics.hyracks.algebricks.core.rewriter.base.AbstractRuleController.java

private void printRuleApplication(IAlgebraicRewriteRule rule, String beforePlan, String afterPlan)
        throws AlgebricksException {
    if (AlgebricksConfig.ALGEBRICKS_LOGGER.isLoggable(Level.FINE)) {
        AlgebricksConfig.ALGEBRICKS_LOGGER.fine(">>>> Rule " + rule.getClass() + " fired.\n");
        AlgebricksConfig.ALGEBRICKS_LOGGER.fine(">>>> Before plan\n" + beforePlan + "\n");
        AlgebricksConfig.ALGEBRICKS_LOGGER.fine(">>>> After plan\n" + afterPlan + "\n");
    }/*from  w  w  w . j  a v a  2s  . c om*/
}

From source file:fr.ortolang.diffusion.runtime.engine.task.ImportHandlesTask.java

@Override
public void executeTask(DelegateExecution execution) throws RuntimeEngineTaskException {
    checkParameters(execution);/*from w  w w .  j  a v a2 s.c o  m*/
    String handlespath = execution.getVariable(HANDLES_PATH_PARAM_NAME, String.class);
    if (execution.getVariable(INITIER_PARAM_NAME, String.class)
            .equals(MembershipService.SUPERUSER_IDENTIFIER)) {
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
        try {
            if (getUserTransaction().getStatus() == Status.STATUS_NO_TRANSACTION) {
                LOGGER.log(Level.FINE, "starting new user transaction.");
                getUserTransaction().begin();
            }
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "unable to start new user transaction", e);
        }
        try {
            boolean needcommit;
            long tscommit = System.currentTimeMillis();
            List<JsonHandle> handles = Arrays
                    .asList(mapper.readValue(new File(handlespath), JsonHandle[].class));
            LOGGER.log(Level.FINE, "- starting import handles");
            boolean partial = false;
            StringBuilder report = new StringBuilder();
            for (JsonHandle handle : handles) {
                needcommit = false;
                try {
                    getHandleStore().recordHandle(handle.handle, handle.key, handle.url);
                } catch (HandleStoreServiceException e) {
                    partial = true;
                    report.append("unable to import handle [").append(handle.handle).append("] : ")
                            .append(e.getMessage()).append("\r\n");
                }
                if (System.currentTimeMillis() - tscommit > 30000) {
                    LOGGER.log(Level.FINE, "current transaction exceed 30sec, need commit.");
                    needcommit = true;
                }
                try {
                    if (needcommit && getUserTransaction().getStatus() == Status.STATUS_ACTIVE) {
                        LOGGER.log(Level.FINE, "committing active user transaction.");
                        getUserTransaction().commit();
                        tscommit = System.currentTimeMillis();
                        getUserTransaction().begin();
                    }
                } catch (Exception e) {
                    LOGGER.log(Level.SEVERE, "unable to commit active user transaction", e);
                }
            }
            if (partial) {
                throwRuntimeEngineEvent(
                        RuntimeEngineEvent.createProcessLogEvent(execution.getProcessBusinessKey(),
                                "Some handles has not been imported (see trace for detail)"));
                throwRuntimeEngineEvent(RuntimeEngineEvent
                        .createProcessTraceEvent(execution.getProcessBusinessKey(), report.toString(), null));
            }
            throwRuntimeEngineEvent(RuntimeEngineEvent.createProcessLogEvent(execution.getProcessBusinessKey(),
                    "Import Handles done"));
        } catch (IOException e) {
            throw new RuntimeEngineTaskException("error parsing json file: " + e.getMessage());
        }
    } else {
        throw new RuntimeEngineTaskException(
                "only " + MembershipService.SUPERUSER_IDENTIFIER + " can perform this task !!");
    }
}

From source file:org.doxu.g2.gwc.crawler.CrawlThread.java

private void crawlGWC(String gwcUrl, final CloseableHttpClient httpclient) {
    URI uri = basicGet(gwcUrl);/*from w w  w  .  j  ava  2 s.  c om*/
    InetAddress address = getIPAddress(uri);
    String ip = null;
    if (address != null) {
        ip = address.getHostAddress();
    }

    Service service = session.addService(gwcUrl);
    service.setIp(ip);
    if (ip == null) {
        service.setStatus(Status.BAD_DNS);
    } else if (isAddressBlocked(address)) {
        service.setStatus(Status.BAD_IP);
    } else if (uri != null) {
        HttpGet httpget = new HttpGet(uri);
        try (CloseableHttpResponse response = httpclient.execute(httpget)) {
            if (response.getStatusLine().getStatusCode() == 200) {
                parseResponse(service, response);
                service.setStatus(Status.WORKING);
            } else {
                service.setStatus(Status.HTTP_ERROR);
            }
        } catch (IOException ex) {
            service.setStatus(Status.CONNECT_ERROR);
            LOGGER.log(Level.FINE, null, ex);
        }
    }
    System.out.println("Service: " + service.getUrl());
    System.out.println("  Status: " + service.getStatus());
    System.out.println("  IP: " + service.getIp());
    System.out.println("  Hosts: " + service.getHosts().size());
    System.out.println("  URLs: " + service.getUrls().size());
    System.out.println();
}