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:au.gov.aims.atlasmapperserver.servlet.Proxy.java

private static synchronized void reloadConfig(ServletContext servletContext, String clientId) {
    try {/*  w ww.  j  ava  2 s . co m*/
        ConfigManager configManager = ConfigHelper.getConfigManager(servletContext);

        if (FileFinder.PUBLIC_FOLDER.equals(clientId)) {
            allAllowedHostCache = getAllProxyAllowedHosts(configManager);
        } else {
            ClientConfig clientConfig = configManager.getClientConfig(clientId);
            // The main config may be incomplete without the list of layers, but it will contains enough info to configure the proxy.
            ClientWrapper jsonMainConfig = new ClientWrapper(
                    configManager.getClientConfigFileJSon(clientConfig, ConfigType.MAIN, false));
            JSONObject jsonLayersConfig = configManager.getClientConfigFileJSon(clientConfig, ConfigType.LAYERS,
                    false);
            Proxy.reloadConfig(jsonMainConfig, jsonLayersConfig, clientConfig);
        }
    } catch (Throwable ex) {
        LOGGER.log(Level.SEVERE, "Error occurred while reloading the proxy configuration: {0}",
                Utils.getExceptionMessage(ex));
        LOGGER.log(Level.FINE, "Stack trace: ", ex);
    }
}

From source file:com.symbian.driver.plugins.reboot.Activator.java

/**
 * @param switchState/*from  ww w  .  j a v a2s  .co m*/
 * @throws IOException
 */
private synchronized void switchOp(String switchState) throws IOException {
    LOGGER.log(Level.INFO, "Activator::switchOp");

    // Alternative being "TelnetSwitch"
    if (method.compareToIgnoreCase("PortTalk") == 0)// ATX power
    {
        String state = switchState == "2" ? "OFF" : "ON";
        File hardwareSwitchFile = JarUtils.extractResource(Activator.class, "/resource/HardwareSwitch.exe");
        if (hardwareSwitchFile.isFile()) {
            Process p = Runtime.getRuntime()
                    .exec("cmd.exe /c " + hardwareSwitchFile.getAbsolutePath() + " " + state);
            BufferedReader iBufferedReader = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String lOutput = null;
            StringBuffer iOutputBuffer = new StringBuffer();
            while ((lOutput = iBufferedReader.readLine()) != null) {
                lOutput += System.getProperty("line.separator");
                iOutputBuffer.append(lOutput);
                // Parse for errors and redirect to appropriate buffer.
            }
            LOGGER.info(iOutputBuffer.toString());
        } else {
            LOGGER.warning(hardwareSwitchFile.getAbsolutePath() + " was not found");
        }
    } else {

        String responseLine = "";
        String[] states = { "User Name :", "Password  :", "Control Console", "Device Manager",
                "Outlet Management", "Outlet Control/Configuration", "Outlet " + outletNo, "Control Outlet",
                "Immediate Off", "Press <ENTER> to continue..." };

        String[] answers = { userName, password, "1", "2", "1", outletNo, "1", switchState, "YES", "\n" };

        Socket sock = new Socket(hostAddr, 23);
        PrintWriter dataToTelnetServer = new PrintWriter(sock.getOutputStream(), true);
        BufferedReader dataFromTelnetServer = new BufferedReader(new InputStreamReader(sock.getInputStream()));
        // start the state machine...
        int state = 0;
        long lastStateChng = System.currentTimeMillis();
        while (state < states.length) {
            while (dataFromTelnetServer.ready()) {
                char nextChar = (char) dataFromTelnetServer.read();
                responseLine += nextChar;
            }
            LOGGER.log(Level.FINE, responseLine);
            if (responseLine.contains(states[state])) // sort of on
            {

                LOGGER.log(Level.FINE, "answers[" + state + "]:" + answers[state]);
                dataToTelnetServer.println(answers[state]);
                state++;
                lastStateChng = System.currentTimeMillis();
                continue;
            }
            if ((System.currentTimeMillis() - lastStateChng) > 10000) {
                // too much time since last change of state...
                // we have lost the connection...
                LOGGER.log(Level.SEVERE, "Lost telnet connection");
                break;
            }
        }
        responseLine = "";
        dataToTelnetServer.flush();
        dataToTelnetServer.close();
        dataFromTelnetServer.close();
        sock.close();
    }
}

From source file:org.cogsurv.cogsurver.http.AbstractHttpApi.java

public HttpGet createHttpGet(String url, NameValuePair... nameValuePairs) {
    if (DEBUG)//  w w  w .ja va  2s  .  com
        LOG.log(Level.FINE, "creating HttpGet for: " + url);
    String query = URLEncodedUtils.format(stripNulls(nameValuePairs), HTTP.UTF_8);
    HttpGet httpGet = new HttpGet(url + "?" + query);
    httpGet.addHeader(CLIENT_VERSION_HEADER, mClientVersion);
    if (DEBUG)
        LOG.log(Level.FINE, "Created: " + httpGet.getURI());
    return httpGet;
}

From source file:com.cyberway.issue.crawler.prefetch.PreconditionEnforcer.java

/**
 * Consider the robots precondition.//from  w  w  w  .java 2s .c o m
 *
 * @param curi CrawlURI we're checking for any required preconditions.
 * @return True, if this <code>curi</code> has a precondition or processing
 *         should be terminated for some other reason.  False if
 *         we can precede to process this url.
 */
private boolean considerRobotsPreconditions(CrawlURI curi) {
    //CMS???
    // treat /robots.txt fetches specially
    UURI uuri = curi.getUURI();
    try {
        if (uuri != null && uuri.getPath() != null && curi.getUURI().getPath().equals("/robots.txt")) {
            // allow processing to continue
            curi.setPrerequisite(true);
            return false;
        }
    } catch (URIException e) {
        logger.severe("Failed get of path for " + curi);
    }
    // require /robots.txt if not present
    if (isRobotsExpired(curi)) {
        // Need to get robots
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("No valid robots for " + getController().getServerCache().getServerFor(curi)
                    + "; deferring " + curi);
        }

        // Robots expired - should be refetched even though its already
        // crawled.
        try {
            String prereq = curi.getUURI().resolve("/robots.txt").toString();
            curi.markPrerequisite(prereq, getController().getPostprocessorChain());
        } catch (URIException e1) {
            logger.severe("Failed resolve using " + curi);
            throw new RuntimeException(e1); // shouldn't ever happen
        }
        return true;
    }
    // test against robots.txt if available
    CrawlServer cs = getController().getServerCache().getServerFor(curi);
    if (cs.isValidRobots()) {
        String ua = getController().getOrder().getUserAgent(curi);
        if (cs.getRobots().disallows(curi, ua)) {
            if (((Boolean) getUncheckedAttribute(curi, ATTR_CALCULATE_ROBOTS_ONLY)).booleanValue() == true) {
                // annotate URI as excluded, but continue to process normally
                curi.addAnnotation("robotExcluded");
                return false;
            }
            // mark as precluded; in FetchHTTP, this will
            // prevent fetching and cause a skip to the end
            // of processing (unless an intervening processor
            // overrules)
            curi.setFetchStatus(S_ROBOTS_PRECLUDED);
            curi.putString("error", "robots.txt exclusion");
            logger.fine("robots.txt precluded " + curi);
            return true;
        }
        return false;
    }
    // No valid robots found => Attempt to get robots.txt failed
    curi.skipToProcessorChain(getController().getPostprocessorChain());
    curi.setFetchStatus(S_ROBOTS_PREREQUISITE_FAILURE);
    curi.putString("error", "robots.txt prerequisite failed");
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("robots.txt prerequisite failed " + curi);
    }
    return true;
    //return false;
}

From source file:hudson.plugins.testlink.result.ResultSeeker.java

/**
 * Scans a directory for files matching the includes pattern.
 * //from www  . j a v a  2  s  . co m
 * @param directory
 *            the directory to scan.
 * @param includes
 *            the includes pattern.
 * @param listener
 *            Hudson Build listener.
 * @return array of strings of paths for files that match the includes
 *         pattern in the directory.
 * @throws IOException
 */
protected String[] scan(final File directory, final String includes, final BuildListener listener)
        throws IOException {
    String[] fileNames = new String[0];

    if (StringUtils.isNotBlank(includes)) {
        FileSet fs = null;

        try {
            fs = Util.createFileSet(directory, includes);

            DirectoryScanner ds = fs.getDirectoryScanner();
            fileNames = ds.getIncludedFiles();
        } catch (BuildException e) {
            e.printStackTrace(listener.getLogger());
            throw new IOException(e);
        }
    }

    if (LOGGER.isLoggable(Level.FINE)) {
        for (String fileName : fileNames) {
            LOGGER.log(Level.FINE, "Test result file found: " + fileName);
        }
    }

    return fileNames;

}

From source file:com.ibm.ws.lars.rest.RepositoryRESTResource.java

@POST
@Path("/assets")
@Produces(MediaType.APPLICATION_JSON)//from  w  w w.  j  a  va 2 s .  c  om
@RolesAllowed(ADMIN_ROLE)
public Response postAssets(String assetJSON, @Context SecurityContext context) {
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("postAssets called with json content:\n" + assetJSON);
    }

    String name = "";
    Principal principal = context.getUserPrincipal();
    if (principal != null) {
        name = principal.getName();
    }

    Asset asset = null;
    try {
        asset = assetService.createAsset(Asset.deserializeAssetFromJson(assetJSON), name);
    } catch (InvalidJsonAssetException e) {
        String body = getErrorJson(Response.Status.BAD_REQUEST, "Invalid asset definition");
        return Response.status(Response.Status.BAD_REQUEST).entity(body).build();
    }

    return Response.ok(asset.toJson()).build();
}

From source file:org.crank.javax.faces.component.MenuRenderer.java

public Object convertSelectOneValue(FacesContext context, UISelectOne uiSelectOne, String newValue)
        throws ConverterException {

    Object convertedValue = null;
    if (RIConstants.NO_VALUE.equals(newValue)) {
        return null;
    }//www  .  j  a  va2 s. c  om
    if (newValue == null) {
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("No conversion necessary for SelectOne Component  " + uiSelectOne.getId()
                    + " since the new value is null ");
        }
        return null;
    }

    convertedValue = super.getConvertedValue(context, uiSelectOne, newValue);
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("SelectOne Component  " + uiSelectOne.getId() + " convertedValue " + convertedValue);
    }
    return convertedValue;

}

From source file:com.brainlounge.zooterrain.netty.WebSocketServerInboundHandler.java

private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {

    // Check for closing frame
    if (frame instanceof CloseWebSocketFrame) {
        handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain());
        return;//  w w  w. j  a v  a2 s .c o m
    }
    if (frame instanceof PingWebSocketFrame) {
        ctx.channel().write(new PongWebSocketFrame(frame.content().retain()));
        return;
    }
    if (!(frame instanceof TextWebSocketFrame)) {
        throw new UnsupportedOperationException(
                String.format("%s frame types not supported", frame.getClass().getName()));
    }

    String request = ((TextWebSocketFrame) frame).text();
    if (logger.isLoggable(Level.FINE)) {
        logger.fine(String.format("%s received %s", ctx.channel(), request));
    }

    // expecting JSON, parse now
    TreeNode jsonRequest;
    ClientRequest.Type requestType;
    try {
        final JsonParser parser = jsonMapper.getFactory().createParser(request);
        jsonRequest = parser.readValueAsTree();
        TextNode type = (TextNode) jsonRequest.get("r");
        requestType = ClientRequest.Type.valueOf(type.textValue());
    } catch (Exception e) {
        logger.info("parsing JSON failed for '" + request + "'");
        // TODO return error to client
        return;
    }

    if (requestType == ClientRequest.Type.i) {
        // client requested initial data

        // sending connection string info
        final ControlMessage handshakeInfo = new ControlMessage(zkStateObserver.getZkConnection(),
                ControlMessage.Type.H);
        writeClientMessage(ctx, handshakeInfo);

        // sending initial znodes
        try {
            zkStateObserver.initialTree("/", 6, Sets.<ZkStateListener>newHashSet(new OutboundConnector(ctx)));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    } else if (requestType == ClientRequest.Type.b) {
        final String znode;
        try {
            znode = ((TextNode) jsonRequest.get("z")).textValue();
        } catch (Exception e) {
            return; // TODO return error
        }
        final DataMessage dataMessage = zkStateObserver.retrieveNodeData(znode);
        if (dataMessage != null) {
            writeClientMessage(ctx, dataMessage);
        }
    } else {
        System.out.println("unknown, unhandled client request = " + request);
    }
}

From source file:com.tc.utils.DxlUtils.java

public static byte[] extractData(Document docLib, String start, String end) {
    byte[] byteMe = null;
    try {/* ww  w.  j av a  2 s.  c  o  m*/
        logger.log(Level.FINE, "retrieving docLib " + docLib.getItemValueString("$Title"));
        Session s = docLib.getParentDatabase().getParent();
        DxlExporter exporter = s.createDxlExporter();
        String dxl = exporter.exportDxl(docLib);
        dxl = dxl.replaceAll("\n", "");
        String base64 = StrUtils.middle(dxl, start, end);
        byteMe = Base64.decode(base64);
    } catch (NotesException e) {
        logger.log(Level.SEVERE, null, e);
    } catch (Exception e) {
        logger.log(Level.SEVERE, null, e);
    }
    return byteMe;
}