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:com.marvelution.hudson.plugins.apiv2.servlet.filter.HudsonAPIV2ServletFilter.java

/**
 * {@inheritDoc}/* w  w w  .  j  a  v a2  s  .  c o  m*/
 */
@Override
public void destroy() {
    LOGGER.log(Level.FINE, "Destroying RestFilter {}", this);
    restServlet.destroy();
}

From source file:net.chrissearle.flickrvote.web.admin.ImageAction.java

@Override
public void validate() {
    boolean seenId = false;

    for (String imageId : id) {
        if (!"".equals(imageId)) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Seen an ID " + imageId);
            }/* w w w .  j  a v a  2  s. c  o m*/

            seenId = true;
        }
    }

    if (!seenId) {
        addActionError("Flickr ID must be provided");
    }

}

From source file:net.nharyes.drivecopy.Main.java

public Main(String[] args) {

    // compose options
    composeOptions();/*from   ww w. j  a v  a  2  s . co m*/

    // create the command line parser
    CommandLineParser parser = new PosixParser();

    try {

        // parse the command line arguments
        CommandLine line = parser.parse(options, args);

        // check log option
        if (line.hasOption('L')) {

            // add file handler
            FileHandler handler = new FileHandler(line.getOptionValue('L'));
            handler.setLevel(Level.FINE);
            Logger.getLogger(getClass().getPackage().getName()).addHandler(handler);
            logger.info(String.format("Added log output file '%s'", line.getOptionValue('L')));
        }

        // check arguments number
        if (line.getArgs().length == 0)
            throw new ParseException("Missing argument MODE");

        // check mode
        int action = -1;
        if (line.getArgs()[0].equals("upload"))
            action = FileStorageWorkflowManager.ACTION_UPLOAD;
        else if (line.getArgs()[0].equals("download"))
            action = FileStorageWorkflowManager.ACTION_DOWNLOAD;
        else if (line.getArgs()[0].equals("replace"))
            action = FileStorageWorkflowManager.ACTION_REPLACE;
        if (action == -1)
            throw new ParseException("MODE must be 'download', 'replace' or 'upload'.");

        // compose BO
        FileBO fileBO = new FileBO();

        // check directory
        char c = 'f';
        fileBO.setDirectory(false);
        if (line.hasOption('d')) {

            c = 'd';
            fileBO.setDirectory(true);
        }
        fileBO.setFile(new File(line.getOptionValue(c)));

        // entry name
        if (line.getArgs().length == 2) {

            // check slashes
            String name = line.getArgs()[1];
            if (name.startsWith("/"))
                name = name.substring(1);
            if (name.endsWith("/"))
                name += "Untitled";
            fileBO.setName(name);

        } else
            fileBO.setName(fileBO.getFile().getName());

        // compression level
        fileBO.setCompressionLevel(Integer.parseInt(line.getOptionValue('l', "0")));

        // check delete after operation
        fileBO.setDeleteAfter(false);
        if (line.hasOption('D'))
            fileBO.setDeleteAfter(true);

        // check skip revision
        fileBO.setSkipRevision(false);
        if (line.hasOption('s'))
            fileBO.setSkipRevision(true);

        // MIME type
        if (line.hasOption('m'))
            fileBO.setMimeType(line.getOptionValue('m'));

        // check MD5 comparison
        fileBO.setCheckMd5(false);
        if (line.hasOption('c'))
            fileBO.setCheckMd5(true);

        // check force
        fileBO.setForce(false);
        if (line.hasOption('F'))
            fileBO.setForce(true);

        // check tree
        fileBO.setCreateFolders(false);
        if (line.hasOption('t'))
            fileBO.setCreateFolders(true);

        // get Workflow Manager
        Injector injector;
        if (line.hasOption('C'))
            injector = Guice.createInjector(new MainModule(line.getOptionValue('C')));
        else
            injector = Guice.createInjector(new MainModule(CONFIGURATION_FILE));
        FileStorageWorkflowManager wfm = injector.getInstance(FileStorageWorkflowManager.class);

        // execute workflow
        wfm.handleWorkflow(fileBO, action);

    } catch (ParseException ex) {

        // print help
        HelpFormatter formatter = new HelpFormatter();
        System.out.println("Drive Copy version " + VERSION);
        System.out.println("Copyright 2012-2013 Luca Zanconato (luca.zanconato@nharyes.net)");
        System.out.println();
        formatter.printHelp("java -jar " + JAR_FILE + " [OPTIONS] <MODE> [ENTRY]", DESCRIPTION + "\n", options,
                "\nMODE can be download/replace/upload.\nENTRY is the path of the entry in Google Drive (i.e. \"Test Folder/Another Folder/file.txt\"); if not set, the name of the local file/directory will be used.");
        System.out.println();

        // log exception
        logger.log(Level.SEVERE, ex.getMessage(), ex);

        // exit with error
        System.exit(1);

    } catch (WorkflowManagerException ex) {

        // log exception
        logger.log(Level.SEVERE, ex.getMessage(), ex);

        // exit with error
        System.exit(1);

    } catch (IOException ex) {

        // log exception
        logger.log(Level.SEVERE, ex.getMessage(), ex);

        // exit with error
        System.exit(1);

    } catch (Exception ex) {

        // log exception
        logger.log(Level.SEVERE, ex.getMessage(), ex);

        // exit with error
        System.exit(1);
    }
}

From source file:eu.europa.ejusticeportal.dss.applet.model.action.SavePdfAction.java

/**
 * Allow the user to save the signed PDF on his computer.
 *//*from   w  w w  .j a  va2  s . c  om*/
@Override
protected void doExec() {
    LOG.info("saveSignedPDF");
    if (pdf == null || pdf.length == 0) {
        throw new IllegalArgumentException("pdf == null || pdf.length == 0");
    }

    if (file != null) {
        FileOutputStream fos = null;
        try {
            LOG.log(Level.FINE, "Saving file ", file);
            LOG.log(Level.FINE, "Saving file to {0} ", file);
            fos = new FileOutputStream(file);
            fos.write(pdf);
            fos.close();
            Event.getInstance().fire(new StatusRefreshed(MessagesEnum.dss_applet_message_pdf_saved_path,
                    MessageLevel.INFO, file.getAbsolutePath()));
        } catch (IOException ex) {
            // The user can't do anything about this
            LOG.error("Cannot save the file", ex);
            Event.getInstance().fire(new StatusRefreshed(MessagesEnum.dss_applet_message_pdf_not_saved,
                    MessageLevel.ERROR, file.getAbsolutePath()));

        } finally {
            IOUtils.closeQuietly(fos);
        }
    }
}

From source file:net.chrissearle.flickrvote.flickr.impl.FlickrJImageTagSearchDAO.java

public FlickrImages searchTag(String tag) {
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("Searching for " + tag);
    }//w ww .  j  a  va 2 s .co m

    try {
        List<FlickrImage> images = new ArrayList<FlickrImage>();

        for (Photo photo : retrieveByTag(tag)) {
            images.add(buildImage(photo));
        }

        return new FlickrImages(images);
    } catch (IOException e) {
        throw new FlickrServiceException(e);
    } catch (SAXException e) {
        throw new FlickrServiceException(e);
    } catch (FlickrException e) {
        throw new FlickrServiceException(e);
    }
}

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

/**
 * Fetch the PCT 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  w  w w .j av a 2s .c o m*/
@Override
public String process() throws Exception {
    googleKey = config.getString("GOOGLE_API_KEY");
    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 to {0}", new Object[] { url });
        String response = Request.Get(context.getProperties().getProperty(url) + "?key=" + googleKey).execute()
                .returnContent().asString();
        File outputFile = new File(outputDir.getAbsolutePath() + File.separator + url + ".json");
        FileUtils.writeStringToFile(outputFile, response, Charsets.UTF_8);
    }

    /*
     * curl -o $od/pct-CA-A.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Campo%20-%
     * 20Idyllwild!A11:G1000?key=$apik
     * curl -o $od/pct-CA-C.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Idyllwild%20-
     * %20Agua%20Dulce!A11:G1000?key=$apik
     * curl -o $od/pct-CA-E.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Agua%20Dulce%
     * 20-%20Cottonwood%20Pass!A11:G100?key=$apik
     * curl -o $od/pct-CA-M.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Northern%20CA
     * !A9:G1000?key=$apik
     * curl -o $od/pct-OR-B.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Oregon!A9:
     * G1000?key=$apik
     * curl -o $od/pct-WA-H.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Washington!A9
     * :G1000?key=$apik
     */
    return BatchStatus.COMPLETED.toString();
}

From source file:com.cybernostics.jsp2thymeleaf.JSP2Thymeleaf.java

public void convert(InputStream inputStream, OutputStream outputStream) {
    try {//from  w ww  .  j a v a2 s . c o m
        final JspTree jspTree = parse(new String(IOUtils.toByteArray(inputStream)));
        logger.log(Level.FINE, jspTree.toStringTree());
        writeTree(jspTree, outputStream);
    } catch (IOException ex) {
        Logger.getLogger(JSP2Thymeleaf.class.getName()).log(Level.SEVERE, null, ex);
    } catch (RecognitionException ex) {
        Logger.getLogger(JSP2Thymeleaf.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:de.jackwhite20.japs.server.JaPSServer.java

public JaPSServer(String host, int port, int backlog, boolean debug, int workerThreads,
        List<ClusterServer> cluster, int cleanupInterval, int snapshotInterval) {

    this.host = host;
    this.port = port;
    this.backlog = backlog;
    this.workerThreads = workerThreads;
    this.cache = new JaPSCache(cleanupInterval, snapshotInterval);

    LOGGER.setLevel((debug) ? Level.FINE : Level.INFO);

    start();//from   w  w  w .j a  v  a 2 s . c  o m

    // Check if there are cluster servers to avoid unnecessary logic execution
    if (cluster.size() > 0) {
        new Thread(() -> {
            while (cluster.size() > 0) {
                LOGGER.info("Trying to connecting to all cluster servers");

                Iterator<ClusterServer> clusterServerIterator = cluster.iterator();
                while (clusterServerIterator.hasNext()) {
                    ClusterServer clusterServer = clusterServerIterator.next();

                    // Remove the own endpoint of this instance (does not work if it is bound to 0.0.0.0)
                    if (clusterServer.port() == port && clusterServer.host().equals(host)) {
                        clusterServerIterator.remove();
                        continue;
                    }

                    try {
                        ClusterPublisher cb = new ClusterPublisher(clusterServer.host(), clusterServer.port());

                        if (cb.connect()) {
                            clusterPublisher.add(cb);

                            clusterServerIterator.remove();

                            cb.write(new JSONObject().put("op", OpCode.OP_CLUSTER_INFO_SET.getCode())
                                    .put("host", host).put("port", port));

                            LOGGER.log(Level.INFO, "Connected to cluster server {0}:{1}", new Object[] {
                                    clusterServer.host(), String.valueOf(clusterServer.port()) });
                        } else {
                            LOGGER.log(Level.SEVERE, "Could not connect to cluster server {0}:{1}",
                                    new Object[] { clusterServer.host(),
                                            String.valueOf(clusterServer.port()) });
                        }
                    } catch (Exception e) {
                        LOGGER.log(Level.SEVERE, "Could not connect to cluster server {0}:{1}",
                                new Object[] { clusterServer.host(), String.valueOf(clusterServer.port()) });
                    }
                }

                if (cluster.size() == 0) {
                    break;
                }

                try {
                    Thread.sleep(5000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

            LOGGER.info("Cluster servers are connected successfully!");
        }).start();
    }
}

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

/**
 * Fetch the San Gorgonio 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.  ja  va  2 s  . c o m
@Override
public String process() throws Exception {
    System.out.println("config=" + config);
    System.out.println("context=" + context);
    outputDir = new File(config.getString(WatermapConfig.OUTPUT_DIR));

    // curl -o $od/datafile.txt http://www.howlingduck.com/triterra/gorgonio/datafile.txt
    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 to {0}", new Object[] { url });
        String response = Request.Get(context.getProperties().getProperty(url)).execute().returnContent()
                .asString();
        File outputFile = new File(outputDir.getAbsolutePath() + File.separator + "datafile.txt");
        FileUtils.writeStringToFile(outputFile, response, Charsets.UTF_8);
    }

    return BatchStatus.COMPLETED.toString();
}

From source file:magma.agent.behavior.complex.RunToPosition.java

@Override
public void perform(float intensity) {
    if (currentBehavior == null || currentBehavior.isFinished()) {

        IThisPlayer thisPlayer = worldModel.getThisPlayer();
        float distanceToTarget = (float) thisPlayer.getDistanceToXY(position);
        double directionToTarget = thisPlayer.getBodyDirectionTo(position).degrees();

        if (distanceToTarget < DISTANCE_PRECISION) {
            // once reached the position we turn to the desired direction
            directionToTarget = rotation;
        }//from  w  w  w .j a  v  a 2s.  co m

        logger.log(Level.FINE, "runToPosition far distanceToTarget: {0} directionToTarget: {1}",
                new Object[] { distanceToTarget, directionToTarget });

        // check if we can make side steps
        // if (distanceToTarget > DISTANCE_PRECISION && distanceToTarget < 0.7)
        // {
        // if (targetAngle > Math.toRadians(45)
        // && targetAngle < Math.toRadians(90)) {
        // sideStepLeft();
        // } else if (targetAngle < Math.toRadians(-45)
        // && targetAngle > Math.toRadians(-90)) {
        // sideStepRight();
        // }
        // }

        // or do we prefer to turn
        if (!turnedRightBefore && directionToTarget > ANGULAR_PRECISION) {
            turnLeft(directionToTarget);

        } else if (!turnedLeftBefore && directionToTarget < -ANGULAR_PRECISION) {
            turnRight(directionToTarget);

        } else {
            walk(distanceToTarget);
        }
    }
    currentBehavior.perform(intensity);
}