List of usage examples for java.util.logging Level FINE
Level FINE
To view the source code for java.util.logging Level FINE.
Click Source Link
From source file:cn.im47.cloud.storage.utilities.RangingResourceHttpRequestHandler.java
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String requestURI = request.getRequestURI(); String contextPath = request.getContextPath(); String requestPath = requestURI.substring(contextPath.length()); //locations are set up for delegation if desired /*//from ww w.j a v a 2s . c om if (!requestPath.startsWith("/media/")) { super.handleRequest(request, response); } */ boolean useRanges = false; int rangeStart = 0; int rangeEnd = 0; String rangeHeader = request.getHeader(RANGE); if (null != rangeHeader) { try { if (rangeHeader.startsWith(BYTES_PREFIX)) { String range = rangeHeader.substring(BYTES_PREFIX.length()); int splitIndex = range.indexOf("-"); String startString = range.substring(0, splitIndex); String endString = range.substring(splitIndex + 1); rangeStart = Integer.parseInt(startString); rangeEnd = Integer.parseInt(endString); useRanges = true; } } catch (Exception e) { useRanges = false; if (log.isLoggable(Level.FINE)) { log.fine("Unable to decode range header " + rangeHeader); } } } response.setContentType(context.getServletContext().getMimeType(requestPath)); response.setHeader("Accept-Ranges", "bytes"); Resource theResource = context.getResource(requestPath); String contentLength = Long.toString(theResource.contentLength()); InputStream in = context.getResource(requestPath).getInputStream(); OutputStream out = response.getOutputStream(); if (useRanges) { response.setHeader(CONTENT_RANGE, "bytes " + rangeStart + "-" + rangeEnd + "/" + contentLength); response.setContentLength(1 + rangeEnd - rangeStart); copyStream(in, out, rangeStart, rangeEnd); } else { copyStream(in, out); } }
From source file:com.formkiq.core.service.generator.pdfbox.TextToPDFieldMapper.java
/** * Override the default functionality of PDFTextStripper. *///from w ww . j a v a 2 s. c om @Override protected void writeString(final String o, final List<TextPosition> textPositions) throws IOException { Integer page = Integer.valueOf(getCurrentPageNo() - 1); if (!this.textLocations.containsKey(page)) { this.textLocations.put(page, new ArrayList<>()); } // TODO replace with CollectionUtil.groupBy List<List<TextPosition>> splits = split(removeNonPrintableAndExtraSpaces(textPositions)); for (List<TextPosition> tps : splits) { String text = tps.stream().map(s -> s.getUnicode()).collect(Collectors.joining()); if (text.matches(".*[a-zA-Z0-9/]+.*")) { PDRectangle rect = calculateTextPosition(tps); PDFont font = tps.get(0).getFont(); float fontSize = tps.stream().map(s -> Float.valueOf(s.getFontSizeInPt())).max(Float::compare) .orElse(Float.valueOf(0)).floatValue(); PdfTextField tf = new PdfTextField(); tf.setText(text.replaceAll("\t", " ")); tf.setRectangle(rect); tf.setFontSize(fontSize); tf.setFontName(font.getName()); LOG.log(Level.FINE, "page=" + page + ",rect=" + rect + ",fontsize=" + fontSize + ",font=" + font + ",text=" + text); this.textLocations.get(page).add(tf); } } }
From source file:com.elusive_code.newsboy.EventNotifierTask.java
private void updateStackTrace(Throwable ex) { if (eventStackTrace == null) return;/*w w w . j a va 2s . c o m*/ try { StackTraceElement[] stack1 = ex.getStackTrace(); StackTraceElement[] stack2 = eventStackTrace.getStackTrace(); StackTraceElement[] result = ArrayUtils.addAll(stack1, stack2); ex.setStackTrace(result); } catch (Throwable t) { LOG.log(Level.FINE, "Failed to update stack trace for " + ex, t); } }
From source file:edu.usu.sdl.apiclient.AbstractService.java
protected void logon() { //get the initial cookies HttpGet httpget = new HttpGet(loginModel.getServerUrl()); try (CloseableHttpResponse response = httpclient.execute(httpget)) { HttpEntity entity = response.getEntity(); log.log(Level.FINE, "Login form get: {0}", response.getStatusLine()); EntityUtils.consume(entity);/* w w w . ja v a 2 s. c om*/ log.log(Level.FINEST, "Initial set of cookies:"); List<Cookie> cookies = cookieStore.getCookies(); if (cookies.isEmpty()) { log.log(Level.FINEST, "None"); } else { for (Cookie cookie : cookies) { log.log(Level.FINEST, "- {0}", cookie.toString()); } } } catch (IOException ex) { throw new ConnectionException("Unable to Connect.", ex); } //login try { HttpUriRequest login = RequestBuilder.post().setUri(new URI(loginModel.getSecurityUrl())) .addParameter(loginModel.getUsernameField(), loginModel.getUsername()) .addParameter(loginModel.getPasswordField(), loginModel.getPassword()).build(); try (CloseableHttpResponse response = httpclient.execute(login)) { HttpEntity entity = response.getEntity(); log.log(Level.FINE, "Login form get: {0}", response.getStatusLine()); EntityUtils.consume(entity); log.log(Level.FINEST, "Post logon cookies:"); List<Cookie> cookies = cookieStore.getCookies(); if (cookies.isEmpty()) { log.log(Level.FINEST, "None"); } else { for (Cookie cookie : cookies) { log.log(Level.FINEST, "- {0}", cookie.toString()); } } } //For some reason production requires getting the first page first RequestConfig defaultRequestConfig = RequestConfig.custom().setCircularRedirectsAllowed(true).build(); HttpUriRequest data = RequestBuilder.get().setUri(new URI(loginModel.getServerUrl())) .addHeader(CONTENT_TYPE, MEDIA_TYPE_JSON).setConfig(defaultRequestConfig).build(); try (CloseableHttpResponse response = httpclient.execute(data)) { log.log(Level.FINE, "Response Status from connection: {0} {1}", new Object[] { response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase() }); HttpEntity entity1 = response.getEntity(); EntityUtils.consume(entity1); } } catch (IOException | URISyntaxException ex) { throw new ConnectionException("Unable to login.", ex); } }
From source file:com.gisgraphy.domain.geoloc.service.fulltextsearch.SolrClientTest.java
@Test public void testSetSolRLogLevel() throws Exception { IsolrClient client = new SolrClient(AbstractIntegrationHttpSolrTestCase.fulltextSearchUrlBinded, new MultiThreadedHttpConnectionManager()); assertTrue(client.isServerAlive());/*from ww w. j ava 2 s . c o m*/ client.setSolRLogLevel(Level.CONFIG); client.setSolRLogLevel(Level.FINE); client.setSolRLogLevel(Level.FINER); client.setSolRLogLevel(Level.FINEST); client.setSolRLogLevel(Level.INFO); client.setSolRLogLevel(Level.SEVERE); client.setSolRLogLevel(Level.WARNING); client.setSolRLogLevel(Level.ALL); client.setSolRLogLevel(Level.OFF); }
From source file:edu.wpi.cs.wpisuitetng.modules.core.entitymanagers.UserManager.java
@Override public User makeEntity(Session s, String content) throws WPISuiteException { //TODO: create a custom de-serializer & serializer so we can hash the desired password & remove it from others. logger.log(Level.FINE, "Attempting new User creation..."); User p;/*w w w . ja va 2 s.co m*/ try { p = User.fromJSON(content); } catch (JsonSyntaxException e) { logger.log(Level.WARNING, "Invalid User entity creation string."); throw new BadRequestException( "The entity creation string had invalid format. Entity String: " + content); } if (getEntity(s, p.getUsername())[0] == null) { String newPassword = UserDeserializer.parsePassword(content); String hashedPassword = this.passwordHash.generateHash(newPassword); p.setPassword(hashedPassword); p.setRole(Role.USER); save(s, p); } else { logger.log(Level.WARNING, "Conflict Exception during User creation."); throw new ConflictException("A user with the given ID already exists. Entity String: " + content); } logger.log(Level.FINE, "User creation success!"); return p; }
From source file:net.chrissearle.flickrvote.web.stats.ShowChallengeChartAction.java
private void initializeChallengeInfo() { ChallengeSummary challenge = challengeService.getChallengeSummary(tag); challengeInfo = new DisplayChallengeSummary(challenge); if (logger.isLoggable(Level.FINE)) { logger.info("Saw " + challengeInfo.toString()); }//from w ww .j a va 2 s. c o m }
From source file:eu.trentorise.opendata.commons.test.jackson.TodJacksonTester.java
/** * Tests that the provided object can be converted to json and reconstructed * as type T. Also logs the json with the provided logger at FINE level. * * @return the reconstructed object// ww w.j ava2 s.c om */ public static <T> T testJsonConv(ObjectMapper om, Logger logger, @Nullable Object obj, Class<T> targetClass) { checkNotNull(om); checkNotNull(logger); T recObj; String json; try { json = om.writeValueAsString(obj); logger.log(Level.FINE, "json = {0}", json); } catch (Exception ex) { throw new RuntimeException("FAILED SERIALIZING!", ex); } try { Object ret = om.readValue(json, targetClass); recObj = (T) ret; } catch (Exception ex) { throw new RuntimeException("FAILED DESERIALIZING!", ex); } assertEquals(obj, recObj); return recObj; }
From source file:inet.common.jsf.request.FileUploadFilter.java
@Override public void destroy() { if (logger.isLoggable(Level.FINE)) { logger.fine("Destroying FileUploadFilter"); } }
From source file:com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsConsoleLogFilter.java
@SuppressWarnings("rawtypes") @Override/*from w ww.ja v a 2s. c o m*/ public OutputStream decorateLogger(AbstractBuild _ignore, OutputStream logger) throws IOException, InterruptedException { // check the config MaskPasswordsConfig config = MaskPasswordsConfig.getInstance(); if (!config.isEnabledGlobally()) { LOGGER.log(Level.FINE, "MaskPasswords not enabled globally; not decorating logger"); return logger; } LOGGER.log(Level.FINE, "MaskPasswords IS enabled globally; decorating logger"); // build our config List<String> passwords = new ArrayList<String>(); List<String> regexes = new ArrayList<String>(); // global passwords List<MaskPasswordsBuildWrapper.VarPasswordPair> globalVarPasswordPairs = config.getGlobalVarPasswordPairs(); for (MaskPasswordsBuildWrapper.VarPasswordPair globalVarPasswordPair : globalVarPasswordPairs) { passwords.add(globalVarPasswordPair.getPassword()); } // global regexes List<MaskPasswordsBuildWrapper.VarMaskRegex> globalVarMaskRegexes = config.getGlobalVarMaskRegexes(); for (MaskPasswordsBuildWrapper.VarMaskRegex globalVarMaskRegex : globalVarMaskRegexes) { regexes.add(globalVarMaskRegex.getRegex()); } return new MaskPasswordsOutputStream(logger, passwords, regexes); }