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  ww. j a  v a  2  s  .  c o m
 */
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
        throws IOException, ServletException {
    // The Wink RestFilter can only handle HttpServletRequests so make sure we have one
    if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
        // Put the original HttpServletRequest in the HttpServletRequestWrapper
        final HttpServletRequestWrapper servletRequest = new HttpServletRequestWrapper(
                (HttpServletRequest) request);
        // Get the requestUri without the context path and the leading slash
        String requestUri = servletRequest.getPathInfo();
        if (StringUtils.isNotBlank(requestUri) && requestUri.startsWith("/")) {
            requestUri = requestUri.substring(1);
        }
        LOGGER.log(Level.FINE, "Got a request from URI: " + requestUri + " with Accept Header: "
                + servletRequest.getHeader("Accept"));
        // Make sure it is a REST call
        if (StringUtils.isNotBlank(requestUri) && requestUri.startsWith(BaseRestResource.BASE_REST_URI)) {
            validateRuntimeDelegate();
            LOGGER.log(Level.FINE, "Got a REST request, forwarding it to the Wink RestFilter");
            FilteredHttpServletResponse servletResponse = new FilteredHttpServletResponse(
                    (HttpServletResponse) response);
            restServlet.service(servletRequest, servletResponse);
            if ((!(servletResponse.isCommitted())) && (servletResponse.getStatusCode() == 404)) {
                LOGGER.log(Level.FINE, "Filter " + this.getClass().getName()
                        + " did not match a resource so letting request continue on FilterChain");
                servletResponse.setStatus(200);
                filterChain.doFilter(request, response);
            }
            // Otherwise forward the request to the next Filter in the chain
        } else {
            LOGGER.log(Level.FINE, "No REST request, forwarding request to the next ServletFilter");
            filterChain.doFilter(request, response);
        }
        // If we don't have a HttpServletRequest and HttpServletResponse then forward to the next Filter in the chain
    } else {
        LOGGER.log(Level.FINE,
                "No HttpServletRequest and HttpServletResponse, forwarding request to the next ServletFilter");
        filterChain.doFilter(request, response);
    }
}

From source file:edu.harvard.iq.safe.lockss.impl.DaemonStatusDataUtil.java

/**
 *
 * @param rawDaemonVersion/* ww  w  .  j  av a2s  .  co m*/
 * @return
 */
public static String getDaemonVersion(String rawDaemonVersion) {
    String daemonVersion = null;
    String dmnVerRegex = "Daemon\\s+(\\d+\\.\\d+\\.\\d+)\\s+built";
    Pattern pdv = Pattern.compile(dmnVerRegex);
    Matcher m = pdv.matcher(rawDaemonVersion);
    if (m.find()) {
        logger.log(Level.FINE, "LOCKSS-daemon version found={0}", m.group(1));
        daemonVersion = "" + m.group(1);
    } else {
        logger.log(Level.WARNING, "LOCKSS-daemon version is not found");
    }
    return daemonVersion;
}

From source file:com.hotwire.sid.QuovaIP_GeoServerAdapter.java

/**
 * Queries Quova with ipAddress and returns the IPInfo record that Quova
 * returns, null if the call raises an exception
 *
 * @param ipAddress/*w w w  .  j ava 2s  . co  m*/
 * @return IPInfo record returned by Quova, null if the IP was not found or
 *         an exception was thrown
 */
private IPInfo getIP_InfoRecord(String ipAddress) throws HwIP_GeoException {
    IPInfo ipInfoRecord = null;

    // if the ipAddressOverride property is not null, then use it to query
    // for geo information
    if (!StringUtils.isEmpty(ipAddressOverride)) {
        ipAddress = ipAddressOverride;
    }

    // throw exception if ipAddress is empty (Quova throws does not allow an
    // empty IP as an arg)
    if (StringUtils.isEmpty(ipAddress)) {
        log.warning("IP Address passed to Quova GeoServer was empty");
        throw new HwIP_GeoException(HotwireErrors.IPGEO_GEO_SERVER_INVALID_ARGUMENT);
    }

    if (geoDirectoryConnection != null) {
        QuovaResponse quovaResponse = null;
        long startTimeMillis = System.currentTimeMillis();
        try {
            // Query Quova adapter for geo information
            quovaResponse = geoDirectoryConnection.getIPInfo(ipAddress);

            // log elapsed query time
            if (log.isLoggable(Level.FINE)) {
                log.fine("Successful Quova query for ip " + ipAddress + " took "
                        + (System.currentTimeMillis() - startTimeMillis) + " milliseconds");
            }
        } catch (QuovaException qe) {
            long errorQueryTime = System.currentTimeMillis() - startTimeMillis;
            boolean isRecoverableError = false;
            QuovaReturnCode quovaExceptionReturnCode = qe.getErrorCode();
            if (QuovaReturnCode.INVALID_INPUT.equals(quovaExceptionReturnCode)
                    || QuovaReturnCode.TIMEOUT.equals(quovaExceptionReturnCode)) {
                // recoverable, log but don't null connection
                isRecoverableError = true;
            } else {
                if (QuovaReturnCode.POOL_FAILURE.equals(quovaExceptionReturnCode)) {
                    // recoverable, but pool tuning is needed to handle
                    // load, syslog but don't null connection
                    // if this happens it should be only for a short time,
                    // so it won't spam syslogs
                    isRecoverableError = true;
                } else {
                    // unrecoverable error such as invalid license, server
                    // down etc
                    // null the connection so that the app does not keep
                    // querying the broken geo server
                    // syslog so that the server can be brought back up
                    geoDirectoryConnection = null;
                }
                // HwLogger.syslog(SyslogFunctionalAreas.AREA_QUOVA,
                // "Exception querying Quova - exception code: " +
                // quovaExceptionReturnCode);
            }
            String errorTypeMessage = isRecoverableError ? "Recoverable error" : "Unrecoverable error";
            log.log(Level.SEVERE,
                    errorTypeMessage + " encountered querying Quova - exception code: "
                            + quovaExceptionReturnCode + ". Query took " + errorQueryTime + " milliseconds.",
                    qe);
            throw new HwIP_GeoException(HotwireErrors.IPGEO_GEO_SERVER_NOT_AVAILABLE, qe);
        } catch (Throwable t) {
            // THIS SHOULD NEVER HAPPEN, however we catch it here so it does
            // not crash the server
            // null the connection so that the app does not query the broken
            // geo server
            geoDirectoryConnection = null;
            // HwLogger.syslog(SyslogFunctionalAreas.AREA_QUOVA,
            // "Runtime error encountered querying Geo Server");
            log.severe("Runtime error encountered querying Geo Server: " + t);
            throw new HwIP_GeoException(HotwireErrors.IPGEO_GEO_SERVER_RUNTIME_ERROR, new Exception(t));
        }

        // Quova supports batch ipLookups, since we only sent 1 ipAddress,
        // we want the record at index 0
        ipInfoRecord = quovaResponse.getIPInfo(0);

        // sanity check the return code
        if (!ipInfoRecord.getRetCode().equals(QuovaReturnCode.NOT_FOUND)
                && !ipInfoRecord.getRetCode().equals(QuovaReturnCode.SUCCESS)) {
            // we received an info record with an invalid return code, log
            // it
            log.severe("Quova returned a response with an error return code: " + ipInfoRecord.getRetCode());
            throw new HwIP_GeoException(HotwireErrors.IPGEO_GEO_SERVER_INVALID_RESPONSE);
        }
    } else {
        log.warning("Quova Geo Server connection is null, geo server query will be skipped");
        throw new HwIP_GeoException(HotwireErrors.IPGEO_GEO_SERVER_NOT_AVAILABLE);
    }

    return ipInfoRecord;
}

From source file:nl.jeslee.jersey.server.spring.SpringComponentProvider.java

@Override
public void initialize(ServiceLocator locator) {
    this.locator = locator;

    if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine(LocalizationMessages.CTX_LOOKUP_STARTED());
    }/*  w  w  w . ja  v  a 2 s . c o  m*/

    ServletContext sc = locator.getService(ServletContext.class);

    if (sc != null) {
        // servlet container
        ctx = WebApplicationContextUtils.getWebApplicationContext(sc);
    } else {
        // non-servlet container
        ctx = createSpringContext();
    }
    if (ctx == null) {
        LOGGER.severe(LocalizationMessages.CTX_LOOKUP_FAILED());
        return;
    }
    LOGGER.config(LocalizationMessages.CTX_LOOKUP_SUCESSFUL());

    // initialize HK2 spring-bridge
    SpringBridge.getSpringBridge().initializeSpringBridge(locator);
    SpringIntoHK2Bridge springBridge = locator.getService(SpringIntoHK2Bridge.class);
    springBridge.bridgeSpringBeanFactory(ctx);

    // register Spring @Autowired annotation handler with HK2 ServiceLocator
    ServiceLocatorUtilities.addOneConstant(locator, new AutowiredInjectResolver(ctx));
    ServiceLocatorUtilities.addOneConstant(locator, ctx, "SpringContext", ApplicationContext.class);
    LOGGER.config(LocalizationMessages.SPRING_COMPONENT_PROVIDER_INITIALIZED());
}

From source file:eu.trentorise.opendata.commons.test.jackson.JacksonTest.java

/**
 * Shows that nasty Jackson deserializes "" into null instead of
 * {@link Locale.ROOT} !!!/*from w w  w .  j a  v  a2  s . com*/
 *
 */
@Test(expected = AssertionError.class)
public void testLocaleDeser() throws JsonProcessingException, IOException {
    ObjectMapper om = new ObjectMapper();
    String json = om.writeValueAsString(new RootLocale());
    LOG.log(Level.FINE, "json = {0}", json);
    RootLocale res = om.readValue(json, RootLocale.class);
    assertNotNull(res.locale);
    assertEquals(Locale.ROOT, res.locale);
}

From source file:de.theit.hudson.crowd.CrowdUserDetailsService.java

/**
 * {@inheritDoc}/*from w  ww.j ava2 s.  com*/
 * 
 * @see org.acegisecurity.userdetails.UserDetailsService#loadUserByUsername(java.lang.String)
 */
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
    // check whether there's at least one active group the user is a member
    // of
    if (!this.configuration.isGroupMember(username)) {
        throw new DataRetrievalFailureException(userNotValid(username, this.configuration.allowedGroupNames));
    }

    User user;
    try {
        // load the user object from the remote Crowd server
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Loading user object from the remote Crowd server...");
        }
        user = this.configuration.crowdClient.getUser(username);
    } catch (UserNotFoundException ex) {
        if (LOG.isLoggable(Level.INFO)) {
            LOG.info(userNotFound(username));
        }
        throw new UsernameNotFoundException(userNotFound(username), ex);
    } catch (ApplicationPermissionException ex) {
        LOG.warning(applicationPermission());
        throw new DataRetrievalFailureException(applicationPermission(), ex);
    } catch (InvalidAuthenticationException ex) {
        LOG.warning(invalidAuthentication());
        throw new DataRetrievalFailureException(invalidAuthentication(), ex);
    } catch (OperationFailedException ex) {
        LOG.log(Level.SEVERE, operationFailed(), ex);
        throw new DataRetrievalFailureException(operationFailed(), ex);
    }

    // create the list of granted authorities
    List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
    // add the "authenticated" authority to the list of granted
    // authorities...
    authorities.add(SecurityRealm.AUTHENTICATED_AUTHORITY);
    // ..and all authorities retrieved from the Crowd server
    authorities.addAll(this.configuration.getAuthoritiesForUser(username));

    return new CrowdUser(user, authorities);
}

From source file:es.itecban.deployment.executionmanager.gui.swf.service.PlanLaunchManager.java

public String launchPlan(RequestContext context, String planNameUniq) throws Exception {

    if (this.lock.tryLock()) {
        try {/*from w w  w  . j  a v a 2  s.c  o m*/
            logger.fine("********* LAUNCHING PLAN");
            DeploymentPlanType dp = this.planManager.findPlanByName(planNameUniq);
            if (dp == null)
                return "The plan name in the user session is not stored at the database";
            String reportString = "No report set";
            ExecutionReportType er = planExecutor.launchPlan(dp);
            reportString = ReportMarshaller.getXMLFromReport(er);
            logger.fine("********* PLAN LAUNCHED");
            if (logger.isLoggable(Level.FINE))
                logger.fine(reportString);
            boolean isExecutedOK = this.isExecutedOK(reportString);
            context.getFlowScope().put("isExecutedOK", isExecutedOK);
            return reportString;
        } catch (Exception e) {
            if (e instanceof MessageException) {
                String[] args = ((MessageException) e).getArgs();
                String errorCode = e.getMessage();
                ErrorUtils.createMessageError(context, errorCode, args);
            } else {
                ErrorUtils.createMessageError(context, e.getMessage(), null);
            }
            throw new Exception();
        } finally {
            this.lock.unlock();
        }
    } else {
        ErrorUtils.createMessageError(context, "running.error.concurrentLaunchNonPermited", null);
        throw new Exception();
    }
}

From source file:com.esri.gpt.control.webharvest.client.waf.FtpClientRequest.java

/**
 * Disconnects from the server./*from  ww w  . ja v  a  2  s  . c om*/
 */
public void disconnect() {
    aborted = false;
    LOG.log(Level.INFO, "Disconnecting from: {0}", host);
    try {
        client.logout();
    } catch (Exception ex) {
        LOG.log(Level.FINE, "Error disconnecting from the host: " + host, ex);
    }
    try {
        client.disconnect();
    } catch (Exception ex) {
        LOG.log(Level.FINE, "Error disconnecting from the host: " + host, ex);
    }
}

From source file:fr.ortolang.diffusion.bootstrap.BootstrapServiceBean.java

public BootstrapServiceBean() {
    LOGGER.log(Level.FINE, "new bootstrap service instance created");
}

From source file:mendeley2kindle.KindleDAO.java

public void createKCollection(String collection) throws JSONException {
    String key = collection + KINDLE_LOCALE;
    log.log(Level.FINER, "Creating kindle collection: " + key);
    if (!collections.isNull(key)) {
        log.log(Level.FINE, "Collection already exists: " + key);
        return;/*  www.  j a v a  2  s.  co m*/
    }
    JSONObject data = new JSONObject();
    data.put("items", new JSONArray());
    data.put("lastAccess", System.currentTimeMillis());
    collections.put(key, data);
    log.log(Level.FINER, "Created kindle collection: " + key);
}