Example usage for java.util.logging Level FINER

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

Introduction

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

Prototype

Level FINER

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

Click Source Link

Document

FINER indicates a fairly detailed tracing message.

Usage

From source file:com.agiletec.aps.util.ForJLogger.java

public boolean isDebugEnabled() {
    return _log.isLoggable(Level.FINER);
}

From source file:com.google.cloud.runtime.jetty.util.HttpUrlUtil.java

/**
 * Wait for a server to be "up" by requesting a specific GET resource
 * that should be returned in status code 200.
 * <p>//from w w  w  .  j a v a2 s  . c  o m
 * This will attempt a check for server up.
 * If any result other then response code 200 occurs, then
 * a 2s delay is performed until the next test.
 * Up to the duration/timeunit specified.
 * </p>
 *
 * @param uri      the URI to request
 * @param duration the time duration to wait for server up
 * @param unit     the time unit to wait for server up
 */
public static void waitForServerUp(URI uri, int duration, TimeUnit unit) {
    System.err.println("Waiting for server up: " + uri);
    boolean waiting = true;
    long expiration = System.currentTimeMillis() + unit.toMillis(duration);
    while (waiting && System.currentTimeMillis() < expiration) {
        try {
            System.out.print(".");
            HttpURLConnection http = openTo(uri);
            int statusCode = http.getResponseCode();
            if (statusCode != HttpURLConnection.HTTP_OK) {
                log.log(Level.FINER, "Waiting 2s for next attempt");
                TimeUnit.SECONDS.sleep(2);
            } else {
                waiting = false;
            }
        } catch (MalformedURLException e) {
            throw new IllegalArgumentException("Invalid URI: " + uri.toString());
        } catch (IOException e) {
            log.log(Level.FINEST, "Ignoring IOException", e);
        } catch (InterruptedException ignore) {
            // ignore
        }
    }
    System.err.println();
    System.err.println("Server seems to be up.");
}

From source file:com.google.code.jahath.common.StreamRelay.java

public void run() {
    byte buf[] = new byte[4096];
    try {// www  .ja  va 2s.  c o  m
        int n;
        while ((n = in.read(buf)) != -1) {
            if (log.isLoggable(Level.FINER)) {
                HexDump.log(log, Level.FINER, label, buf, 0, n);
            }
            out.write(buf, 0, n);
            out.flush();
        }
    } catch (IOException ex) {
        log.log(Level.SEVERE, label, ex);
    } finally {
        IOUtils.closeQuietly(in);
        IOUtils.closeQuietly(out);
    }
    log.info(label + " closed");
}

From source file:at.bitfire.davdroid.log.LogcatHandler.java

@Override
public void publish(LogRecord r) {
    String text = getFormatter().format(r);
    int level = r.getLevel().intValue();

    int end = text.length();
    for (int pos = 0; pos < end; pos += MAX_LINE_LENGTH) {
        String line = text.substring(pos, NumberUtils.min(pos + MAX_LINE_LENGTH, end));

        if (level >= Level.SEVERE.intValue())
            Log.e(r.getLoggerName(), line);
        else if (level >= Level.WARNING.intValue())
            Log.w(r.getLoggerName(), line);
        else if (level >= Level.CONFIG.intValue())
            Log.i(r.getLoggerName(), line);
        else if (level >= Level.FINER.intValue())
            Log.d(r.getLoggerName(), line);
        else//w w w  .j  a v  a  2  s .c o m
            Log.v(r.getLoggerName(), line);
    }
}

From source file:org.apache.reef.util.JARFileMaker.java

public JARFileMaker(final File outputFile, final Manifest manifest) throws IOException {
    LOG.log(Level.FINER, "Output jar: {0}", outputFile);
    final FileOutputStream outputStream = new FileOutputStream(outputFile);
    this.jarOutputStream = manifest == null ? new JarOutputStream(outputStream)
            : new JarOutputStream(outputStream, manifest);
}

From source file:net.nyvaria.nyvariacore.coregroup.CoreGroup.java

public CoreGroup(String name) {
    super(name);/*w  w w .ja v  a  2s .c om*/
    this.priority = CoreGroup.getGroupPriority(name);
    this.players = new CorePlayerList();

    NyvariaCore.getInstance().log(Level.FINER, "Group name     = " + this.getName());
    NyvariaCore.getInstance().log(Level.FINER, "Group label    = " + this.getLabel());
    NyvariaCore.getInstance().log(Level.FINER, "Group priority = " + this.priority);
    NyvariaCore.getInstance().log(Level.FINER, "Group prefix   = " + this.getPrefix());
    NyvariaCore.getInstance().log(Level.FINER, "Group suffix   = " + this.getSuffix());
}

From source file:com.ibm.jaggr.core.util.ZipUtil.java

/**
 * Extracts the specified zip file to the specified location. If {@code selector} is specified,
 * then only the entry specified by {@code selector} (if {@code selector} is a filename) or the
 * contents of the directory specified by {@code selector} (if {@code selector} is a directory
 * name) will be extracted. If {@code selector} specifies a directory, then the contents of the
 * directory in the zip file will be rooted at {@code destDir} when extracted.
 *
 * @param zipFile/*from   ww  w.  ja  va 2 s.c o  m*/
 *            the {@link File} object for the file to unzip
 * @param destDir
 *            the {@link File} object for the target directory
 * @param selector
 *            The name of a file or directory to extract
 * @throws IOException
 */
public static void unzip(File zipFile, File destDir, String selector) throws IOException {
    final String sourceMethod = "unzip"; //$NON-NLS-1$
    final boolean isTraceLogging = log.isLoggable(Level.FINER);
    if (isTraceLogging) {
        log.entering(sourceClass, sourceMethod, new Object[] { zipFile, destDir });
    }

    boolean selectorIsFolder = selector != null && selector.charAt(selector.length() - 1) == '/';
    ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFile));
    try {
        ZipEntry entry = zipIn.getNextEntry();
        // iterates over entries in the zip file
        while (entry != null) {
            String entryName = entry.getName();
            if (selector == null || !selectorIsFolder && entryName.equals(selector) || selectorIsFolder
                    && entryName.startsWith(selector) && entryName.length() != selector.length()) {
                if (selector != null) {
                    if (selectorIsFolder) {
                        // selector is a directory.  Strip selected path
                        entryName = entryName.substring(selector.length());
                    } else {
                        // selector is a filename.  Extract the filename portion of the path
                        int idx = entryName.lastIndexOf("/"); //$NON-NLS-1$
                        if (idx != -1) {
                            entryName = entryName.substring(idx + 1);
                        }
                    }
                }
                File file = new File(destDir, entryName.replace("/", File.separator)); //$NON-NLS-1$
                if (!entry.isDirectory()) {
                    // if the entry is a file, extract it
                    extractFile(entry, zipIn, file);
                } else {
                    // if the entry is a directory, make the directory
                    extractDirectory(entry, file);
                }
                zipIn.closeEntry();
            }
            entry = zipIn.getNextEntry();
        }
    } finally {
        zipIn.close();
    }

    if (isTraceLogging) {
        log.exiting(sourceClass, sourceMethod);
    }
}

From source file:name.richardson.james.bukkit.alias.persistence.InetAddressRecordManager.java

public InetAddressRecord create(String address) {
    InetAddressRecord record = find(address);
    if (record == null) {
        logger.log(Level.FINER, "Creating new InetAddressRecord for {0}.", address);
        record = new InetAddressRecord();
        record.setAddress(address);// w ww  .  j a  v  a  2  s. c o m
        record.setLastSeen(new Timestamp(System.currentTimeMillis()));
        save(record);
        record = find(address);
    }
    return record;
}

From source file:name.richardson.james.bukkit.alias.persistence.PlayerNameRecordManager.java

public PlayerNameRecord create(String playerName) {
    PlayerNameRecord record = find(playerName);
    if (record == null) {
        logger.log(Level.FINER, "Creating new PlayerNameRecord for {0}.", playerName);
        record = new PlayerNameRecord();
        record.setPlayerName(playerName);
        record.setLastSeen(new Timestamp(System.currentTimeMillis()));
        save(record);/* w  w  w  .ja  v  a 2 s  .  co  m*/
        record = find(playerName);
    }
    return record;
}

From source file:org.geoserver.ManifestLoaderTest.java

@Override
protected void onSetUp(SystemTestData testData) throws Exception {
    try {/*  ww  w  .  j a va  2s  .c o m*/
        loader = new ManifestLoader(getResourceLoader());
    } catch (Exception e) {
        LOGGER.log(Level.FINER, e.getMessage(), e);
        org.junit.Assert.fail(e.getLocalizedMessage());
    }
}