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.dozer.utils.HudsonDozerClassLoader.java

/**
 * {@inheritDoc}/*from ww  w.j  a va 2s  .c  o m*/
 */
@Override
public Class<?> loadClass(String className) {
    LOGGER.log(Level.FINE, "Trying to load Class: " + className);
    Class<?> result = null;
    try {
        result = ClassUtils.getClass(HudsonPluginUtils.getPluginClassloader(), className);
    } catch (ClassNotFoundException e) {
        MappingUtils.throwMappingException(e);
    }
    return result;
}

From source file:io.stallion.boot.MainRunner.java

/**
 * Run main, and manually register plugins, rather than have plugins loaded via the /jars folder.
 *
 * This method is used in plugin development, when we do not have a pre-built jar of the plugin available.
 *
 * @param args//  w w w  . j  a v a  2  s . c o m
 * @param plugins
 * @throws Exception
 */
public static void mainWithPlugins(String[] args, StallionJavaPlugin... plugins) throws Exception {
    try {
        if (ArrayUtils.contains(args, "-autoReload")) {
            runWithAutoReload(args, plugins);
        } else {
            doMain(args, plugins);
        }
    } catch (CommandException ex) {
        System.err.println("\n\nError! \n\n" + ex.getMessage() + "\n\n");
        if (Log.getLogLevel().intValue() <= Level.FINE.intValue()) {
            Log.exception(ex, "Command exception");
        }
    }
}

From source file:com.bardsoftware.server.auth.AuthService.java

private Principal getUser(final HttpApi http) {
    String userId = http.getUsername();
    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine(String.format("req url=%s session_id=%s user_id=%s", http.getRequestUrl(),
                http.getSessionId(), userId));
    }// w w  w.  ja  v  a 2 s.  c o  m
    return (userId == null) ? null : principalExtent.find(String.valueOf(userId));
}

From source file:com.google.oacurl.util.LoggingConfig.java

public static void enableWireLog() {
    // For clarity, override the formatter so that it doesn't print the
    // date and method name for each line, and then munge the output a little
    // bit to make it nicer and more curl-like.
    Formatter wireFormatter = new Formatter() {
        @Override/*www.  j  av a2 s . c  om*/
        public String format(LogRecord record) {
            String message = record.getMessage();
            String trimmedMessage = message.substring(">> \"".length(), message.length() - 1);
            if (trimmedMessage.matches("[0-9a-f]+\\[EOL\\]")) {
                return "";
            }

            trimmedMessage = trimmedMessage.replace("[EOL]", "");
            if (trimmedMessage.isEmpty()) {
                return "";
            }

            StringBuilder out = new StringBuilder();
            out.append(message.charAt(0));
            out.append(" ");
            out.append(trimmedMessage);
            out.append(System.getProperty("line.separator"));
            return out.toString();
        }
    };

    ConsoleHandler wireHandler = new ConsoleHandler();
    wireHandler.setLevel(Level.FINE);
    wireHandler.setFormatter(wireFormatter);

    Logger wireLogger = Logger.getLogger("org.apache.http.wire");
    wireLogger.setLevel(Level.FINE);
    wireLogger.setUseParentHandlers(false);
    wireLogger.addHandler(wireHandler);
}

From source file:net.chrissearle.flickrvote.dao.JpaPhotographyDao.java

/**
 * Method findByUsername finds the photographer with the given username. Null if none found.
 *
 * @param username of type String/*ww  w. j  av a  2s. co m*/
 * @return Photographer
 */
public Photographer findByUsername(String username) {
    if (log.isLoggable(Level.FINE)) {
        log.fine("findByUsername : " + username);
    }

    Query query = entityManager.createQuery("select p from Photographer p where p.username = :username");
    query.setParameter("username", username);

    try {
        return (Photographer) query.getSingleResult();
    } catch (NoResultException e) {
        if (log.isLoggable(Level.FINE)) {
            log.fine("No matching user found");
        }

        // Just means that there is no photographer yet present
        return null;
    }
}

From source file:com.bc.appbase.ui.dialog.SendReportAction.java

private static Email getEmail(String host, int port, String emailAddress, String password, String subject) {

    final SimpleEmail email = new SimpleEmail();

    try {// w  w w .jav  a2s  .c  om
        email.addTo(emailAddress);
    } catch (EmailException e) {
        logger.log(Level.WARNING,
                "Error add `to address`: " + emailAddress + " to email with subject: " + subject, e);
        return null;
    }

    if (password != null) {
        email.setAuthentication(emailAddress, password);
    }
    email.setDebug(logger.isLoggable(Level.FINE));

    try {
        email.setFrom(emailAddress);
    } catch (EmailException e) {
        logger.log(Level.WARNING,
                "Error setting `from address` = " + emailAddress + " to email with subject: " + subject, e);
        return null;
    }

    email.setHostName(host);
    email.setSmtpPort(port);

    if (password != null) {
        email.setSSLOnConnect(true);
    }

    email.setSubject(subject);

    return email;
}

From source file:net.oneandone.sushi.fs.webdav.WebdavConnection.java

public static WebdavConnection open(Socket socket, HttpParams params) throws IOException {
    int linger;//from ww  w  .ja v a2s  .com
    int buffersize;
    SessionInputBuffer input;
    SessionOutputBuffer output;

    socket.setTcpNoDelay(HttpConnectionParams.getTcpNoDelay(params));
    socket.setSoTimeout(HttpConnectionParams.getSoTimeout(params));
    linger = HttpConnectionParams.getLinger(params);
    if (linger >= 0) {
        socket.setSoLinger(linger > 0, linger);
    }
    buffersize = HttpConnectionParams.getSocketBufferSize(params);
    if (WebdavFilesystem.WIRE.isLoggable(Level.FINE)) {
        input = new LoggingSessionInputBuffer(socket, buffersize, params, WebdavFilesystem.WIRE);
        output = new LoggingSessionOutputBuffer(socket, buffersize, params, WebdavFilesystem.WIRE);
    } else {
        input = new SocketInputBuffer(socket, buffersize, params);
        output = new SocketOutputBuffer(socket, buffersize, params);
    }
    return new WebdavConnection(socket, input, output, params);
}

From source file:com.symbian.driver.core.controller.utils.DeviceUtils.java

/**
 * @param aEpoc//from   ww w  .  jav a 2 s. c om
 * @param aNumberRetries
 * @return 
 * @throws ParseException
 * @throws InterruptedException
 * @throws TimeLimitExceededException
 */
public static final boolean poll(ExecuteOnHost aEpoc, final int aNumberRetries) throws ParseException {
    LOGGER.info("Polling the Symbian device.");

    int lAttempts = 0;
    boolean lDeviceInfo = false;
    while (!lDeviceInfo && lAttempts < aNumberRetries) {

        if (PollStop == true) {
            break;
        }

        try {
            Thread.sleep(TimeOut.RESTART_WAIT);
        } catch (InterruptedException lInterruptedException) {
            LOGGER.log(Level.FINE, "Timer was interrupted while polling.", lInterruptedException);
        }

        try {

            // Check if emulator is still running
            if (aEpoc != null && !aEpoc.isRunning()) {
                LOGGER.log(Level.SEVERE, "Emulator stopped prematurely.");
                return false;
            }

            if (DeviceCommsProxy.getInstance().isDeviceAlive()) {
                lDeviceInfo = true;
                break;
            } else {
                LOGGER.info("Waiting for the Symbian device to startup, attempt #: " + lAttempts);
            }

        } catch (Exception lException) {
            LOGGER.log(Level.SEVERE, "Failed to get comms instance.", lException);
        }

        lAttempts++;

    }

    if (!lDeviceInfo) {
        LOGGER.log(Level.SEVERE, "The Symbian Device did not respond after " + lAttempts
                + " attempts. Please check your CommDB file for WinTap and accessiblity of your Symbian Device (HW or SW).");
        return false;
    }

    LOGGER.info("Polling of the Symbian Device finished succefully. Using transport at: "
            + TDConfig.getInstance().getPreference(TDConfig.TRANSPORT));
    return true;
}

From source file:eu.edisonproject.utility.commons.IDFSort.java

@Override
public Map<String, Double> sort(Map<String, Double> termDictionaray, String dirPath)
        throws IOException, InterruptedException {
    Map<String, Double> newTermDictionaray = new HashMap<>();
    File dir = new File(dirPath);
    File[] docs = dir.listFiles();
    //        GrepOptionSets go = new GrepOptionSets();
    for (String term : termDictionaray.keySet()) {
        int numOfDocsWithTerm = 0;
        for (File f : docs) {
            int count = 0;
            if (FilenameUtils.getExtension(f.getName()).endsWith("txt")) {
                count++;//from   ww w .  j  av  a  2  s  .c  om
                Logger.getLogger(IDFSort.class.getName()).log(Level.FINE, "{0}: {1} of {2}",
                        new Object[] { f.getName(), count, docs.length });
                ReaderFile rf = new ReaderFile(f.getAbsolutePath());
                String contents = rf.readFileWithN();
                cleanStopWord.setDescription(contents);
                contents = cleanStopWord.execute();

                cleanStopWord.setDescription(term.replaceAll("_", " "));
                String cTerm = cleanStopWord.execute();

                //                    int lastIndex = 0;
                //                    int wcount = 0;
                //
                //                    while (lastIndex != -1) {
                //
                //                        lastIndex = contents.indexOf(cTerm, lastIndex);
                //
                //                        if (lastIndex != -1) {
                //                            wcount++;
                //                            lastIndex += cTerm.length();
                //                        }
                //                    }
                //                    System.out.println(f.getName() + "," + cTerm + "," + wcount);
                //
                //                    wcount = StringUtils.countMatches(contents, cTerm);
                //                    System.out.println(f.getName() + "," + cTerm + "," + wcount);
                if (contents.contains(cTerm)) {
                    numOfDocsWithTerm++;
                    //                        System.out.println(f.getName() + "," + cTerm + "," + numOfDocsWithTerm);
                }
                //                    try (InputStream fis = new FileInputStream(f)) {
                //                        String result = Unix4j.from(fis).grep(go.i.count, cTerm).toStringResult();
                //                        Integer lineCount = Integer.valueOf(result);
                //                        if (lineCount > 0) {
                //                            numOfDocsWithTerm++;
                //                        }
                //                    }
            }

        }
        double idf = 0;
        if (numOfDocsWithTerm > 0) {
            idf = Math.log((double) docs.length / (double) numOfDocsWithTerm);
        }
        newTermDictionaray.put(term, idf);
    }
    return newTermDictionaray;
}

From source file:ch.cyberduck.core.io.BufferOutputStream.java

@Override
public void write(final byte[] bytes, final int off, final int len) throws IOException {
    if (log.isLoggable(Level.FINE)) {
        log.fine(String.format("Buffer %d bytes at offset %d", len, offset));
    }/* w  w  w  .  java 2  s  .c o m*/
    final byte[] chunk = new byte[len];
    System.arraycopy(bytes, off, chunk, 0, len);
    buffer.write(chunk, offset);
    super.write(bytes, off, len);
}