List of usage examples for java.util.logging Level FINER
Level FINER
To view the source code for java.util.logging Level FINER.
Click Source Link
From source file:org.geoserver.jdbcconfig.JDBCConfigTestSupport.java
public void setUp() throws Exception { ConfigDatabase.LOGGER.setLevel(Level.FINER); resourceLoader = new GeoServerResourceLoader(createTempDir()); GeoserverDataDirectory.loader = resourceLoader; // just to avoid hundreds of warnings in the logs about extension lookups with no app // context set appContext = createNiceMock(WebApplicationContext.class); new GeoServerExtensions().setApplicationContext(appContext); configureAppContext(appContext);//w w w . ja v a2 s . c o m replay(appContext); // final File testDbDir = new File("target", "jdbcconfig"); // FileUtils.deleteDirectory(testDbDir); // testDbDir.mkdirs(); dataSource = new BasicDataSource(); dataSource.setDriverClassName(driver); dataSource .setUrl(connectionUrl.replace("${DATA_DIR}", resourceLoader.getBaseDirectory().getAbsolutePath())); dataSource.setUsername(dbUser); dataSource.setPassword(dbPasswd); dataSource.setMinIdle(3); dataSource.setMaxActive(10); try { Connection connection = dataSource.getConnection(); connection.close(); } catch (Exception e) { throw new RuntimeException(e); } try { dropDb(dataSource); } catch (Exception ignored) { } initDb(dataSource); XStreamInfoSerialBinding binding = new XStreamInfoSerialBinding(new XStreamPersisterFactory()); catalog = new CatalogImpl(); configDb = new ConfigDatabase(dataSource, binding); configDb.setCatalog(catalog); configDb.initDb(null); }
From source file:net.daboross.bukkitdev.skywars.world.WorldUnzipper.java
public void doWorldUnzip(Logger logger) throws StartupFailedException { Validate.notNull(logger, "Logger cannot be null"); Path outputDir = Bukkit.getWorldContainer().toPath().resolve(Statics.BASE_WORLD_NAME); if (Files.exists(outputDir)) { return;//from www . j a v a2 s. c om } try { Files.createDirectories(outputDir); } catch (IOException e) { throw new StartupFailedException("Couldn't create directory " + outputDir.toAbsolutePath() + "."); } InputStream fis = WorldUnzipper.class.getResourceAsStream(Statics.ZIP_FILE_PATH); if (fis == null) { throw new StartupFailedException("Couldn't get resource.\nError creating world. Please delete " + Statics.BASE_WORLD_NAME + " and restart server."); } try { try (ZipInputStream zis = new ZipInputStream(fis)) { ZipEntry ze = zis.getNextEntry(); while (ze != null) { String fileName = ze.getName(); Path newFile = outputDir.resolve(fileName); Path parent = newFile.getParent(); if (parent != null) { Files.createDirectories(parent); } if (ze.isDirectory()) { logger.log(Level.FINER, "Making dir {0}", newFile); Files.createDirectories(newFile); } else if (Files.exists(newFile)) { logger.log(Level.FINER, "Already exists {0}", newFile); } else { logger.log(Level.FINER, "Copying {0}", newFile); try (FileOutputStream fos = new FileOutputStream(newFile.toFile())) { try { int next; while ((next = zis.read()) != -1) { fos.write(next); } fos.flush(); } catch (IOException ex) { logger.log(Level.WARNING, "Error copying file from zip", ex); throw new StartupFailedException("Error creating world. Please delete " + Statics.BASE_WORLD_NAME + " and restart server."); } fos.close(); } } try { ze = zis.getNextEntry(); } catch (IOException ex) { throw new StartupFailedException( "Error getting next zip entry\nError creating world. Please delete " + Statics.BASE_WORLD_NAME + " and restart server.", ex); } } } } catch (IOException | RuntimeException ex) { throw new StartupFailedException( "\nError unzipping world. Please delete " + Statics.BASE_WORLD_NAME + " and restart server.", ex); } }
From source file:org.b3log.solo.event.comment.PageCommentReplyNotifier.java
@Override public void action(final Event<JSONObject> event) throws EventException { final JSONObject eventData = event.getData(); final JSONObject comment = eventData.optJSONObject(Comment.COMMENT); final JSONObject page = eventData.optJSONObject(Page.PAGE); LOGGER.log(Level.FINER, "Processing an event[type={0}, data={1}] in listener[className={2}]", new Object[] { event.getType(), eventData, PageCommentReplyNotifier.class.getName() }); final String originalCommentId = comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID); if (Strings.isEmptyOrNull(originalCommentId)) { LOGGER.log(Level.FINER, "This comment[id={0}] is not a reply", comment.optString(Keys.OBJECT_ID)); return;// w w w . j ava 2s .c o m } try { final String commentEmail = comment.getString(Comment.COMMENT_EMAIL); final JSONObject originalComment = commentRepository.get(originalCommentId); final String originalCommentEmail = originalComment.getString(Comment.COMMENT_EMAIL); if (originalCommentEmail.equalsIgnoreCase(commentEmail)) { return; } final JSONObject preference = preferenceQueryService.getPreference(); if (null == preference) { throw new EventException("Not found preference"); } final String blogTitle = preference.getString(Preference.BLOG_TITLE); final String adminEmail = preference.getString(Preference.ADMIN_EMAIL); final String commentContent = comment.getString(Comment.COMMENT_CONTENT) .replaceAll(SoloServletListener.ENTER_ESC, "<br/>"); final String commentSharpURL = comment.getString(Comment.COMMENT_SHARP_URL); final Message message = new Message(); message.setFrom(adminEmail); message.addRecipient(originalCommentEmail); final JSONObject replyNotificationTemplate = preferenceQueryService.getReplyNotificationTemplate(); final String mailSubject = replyNotificationTemplate.getString("subject").replace("${blogTitle}", blogTitle); message.setSubject(mailSubject); final String pageTitle = page.getString(Page.PAGE_TITLE); final String blogHost = preference.getString(Preference.BLOG_HOST); final String pageLink = "http://" + blogHost + page.getString(Page.PAGE_PERMALINK); final String commentName = comment.getString(Comment.COMMENT_NAME); final String commentURL = comment.getString(Comment.COMMENT_URL); String commenter = null; if (!"http://".equals(commentURL)) { commenter = "<a target=\"_blank\" " + "href=\"" + commentURL + "\">" + commentName + "</a>"; } else { commenter = commentName; } final String mailBody = replyNotificationTemplate.getString("body").replace("${postLink}", pageLink) .replace("${postTitle}", pageTitle).replace("${replier}", commenter) .replace("${replyURL}", "http://" + blogHost + commentSharpURL) .replace("${replyContent}", commentContent); message.setHtmlBody(mailBody); LOGGER.log(Level.FINER, "Sending a mail[mailSubject={0}, mailBody=[{1}] to [{2}]", new Object[] { mailSubject, mailBody, originalCommentEmail }); mailService.send(message); } catch (final Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); throw new EventException("Reply notifier error!"); } }
From source file:jshm.logging.Log.java
public static void reloadConfig() throws Exception { // all logging Handler consoleHandler = new ConsoleHandler(); consoleHandler.setLevel(DEBUG ? Level.ALL : Level.WARNING); consoleHandler.setFormatter(new OneLineFormatter()); Logger cur = Logger.getLogger(""); removeHandlers(cur);/* w ww .ja va 2 s . c o m*/ cur.addHandler(consoleHandler); // jshm logging Formatter fileFormatter = new FileFormatter(); Handler jshmHandler = new FileHandler("data/logs/JSHManager.txt"); jshmHandler.setLevel(Level.ALL); jshmHandler.setFormatter(fileFormatter); cur = Logger.getLogger("jshm"); cur.addHandler(jshmHandler); cur.setLevel(DEBUG ? Level.ALL : Level.INFO); // hibernate logging Handler hibernateHandler = new FileHandler("data/logs/Hibernate.txt"); hibernateHandler.setLevel(Level.ALL); hibernateHandler.setFormatter(fileFormatter); cur = Logger.getLogger("org.hibernate"); removeHandlers(cur); cur.addHandler(hibernateHandler); cur.setLevel(DEBUG ? Level.INFO : Level.WARNING); // HttpClient logging Handler httpClientHandler = new FileHandler("data/logs/HttpClient.txt"); httpClientHandler.setLevel(Level.ALL); httpClientHandler.setFormatter(fileFormatter); // cur = Logger.getLogger("httpclient.wire"); cur = Logger.getLogger("httpclient.wire.header"); removeHandlers(cur); cur.addHandler(httpClientHandler); cur.setLevel(DEBUG ? Level.ALL : Level.INFO); cur = Logger.getLogger("org.apache.commons.httpclient"); removeHandlers(cur); cur.addHandler(httpClientHandler); cur.setLevel(DEBUG ? Level.FINER : Level.INFO); // HtmlParser logging Handler htmlParserHandler = new FileHandler("data/logs/HtmlParser.txt"); htmlParserHandler.setLevel(Level.ALL); htmlParserHandler.setFormatter(fileFormatter); cur = Logger.getLogger("org.htmlparser"); removeHandlers(cur); cur.addHandler(htmlParserHandler); cur.setLevel(DEBUG ? Level.ALL : Level.INFO); // SwingX logging Handler swingxHandler = new FileHandler("data/logs/SwingX.txt"); swingxHandler.setLevel(Level.ALL); swingxHandler.setFormatter(fileFormatter); cur = Logger.getLogger("org.jdesktop.swingx"); removeHandlers(cur); cur.addHandler(swingxHandler); cur.setLevel(DEBUG ? Level.ALL : Level.INFO); }
From source file:name.richardson.james.bukkit.alias.persistence.PlayerNameRecordManager.java
public List<PlayerNameRecord> list(String playerName) { logger.log(Level.FINER, "Listing all PlayerNameRecords starting with '{0}'.", playerName); Query<PlayerNameRecord> query = database.createQuery(PlayerNameRecord.class); query.where().istartsWith("playerName", playerName); return query.findList(); }
From source file:org.b3log.solo.event.comment.ArticleCommentReplyNotifier.java
@Override public void action(final Event<JSONObject> event) throws EventException { final JSONObject eventData = event.getData(); final JSONObject comment = eventData.optJSONObject(Comment.COMMENT); final JSONObject article = eventData.optJSONObject(Article.ARTICLE); LOGGER.log(Level.FINER, "Processing an event[type={0}, data={1}] in listener[className={2}]", new Object[] { event.getType(), eventData, ArticleCommentReplyNotifier.class.getName() }); final String originalCommentId = comment.optString(Comment.COMMENT_ORIGINAL_COMMENT_ID); if (Strings.isEmptyOrNull(originalCommentId)) { LOGGER.log(Level.FINER, "This comment[id={0}] is not a reply", comment.optString(Keys.OBJECT_ID)); return;//w w w . j a va 2 s . c o m } try { final String commentEmail = comment.getString(Comment.COMMENT_EMAIL); final JSONObject originalComment = commentRepository.get(originalCommentId); final String originalCommentEmail = originalComment.getString(Comment.COMMENT_EMAIL); if (originalCommentEmail.equalsIgnoreCase(commentEmail)) { return; } final JSONObject preference = preferenceQueryService.getPreference(); if (null == preference) { throw new EventException("Not found preference"); } final String blogTitle = preference.getString(Preference.BLOG_TITLE); final String adminEmail = preference.getString(Preference.ADMIN_EMAIL); final String commentContent = comment.getString(Comment.COMMENT_CONTENT) .replaceAll(SoloServletListener.ENTER_ESC, "<br/>"); final String commentSharpURL = comment.getString(Comment.COMMENT_SHARP_URL); final Message message = new Message(); message.setFrom(adminEmail); message.addRecipient(originalCommentEmail); final JSONObject replyNotificationTemplate = preferenceQueryService.getReplyNotificationTemplate(); final String mailSubject = replyNotificationTemplate.getString("subject").replace("${blogTitle}", blogTitle); message.setSubject(mailSubject); final String articleTitle = article.getString(Article.ARTICLE_TITLE); final String blogHost = preference.getString(Preference.BLOG_HOST); final String articleLink = "http://" + blogHost + article.getString(Article.ARTICLE_PERMALINK); final String commentName = comment.getString(Comment.COMMENT_NAME); final String commentURL = comment.getString(Comment.COMMENT_URL); String commenter = null; if (!"http://".equals(commentURL)) { commenter = "<a target=\"_blank\" " + "href=\"" + commentURL + "\">" + commentName + "</a>"; } else { commenter = commentName; } final String mailBody = replyNotificationTemplate.getString("body").replace("${postLink}", articleLink) .replace("${postTitle}", articleTitle).replace("${replier}", commenter) .replace("${replyURL}", "http://" + blogHost + commentSharpURL) .replace("${replyContent}", commentContent); message.setHtmlBody(mailBody); LOGGER.log(Level.FINER, "Sending a mail[mailSubject={0}, mailBody=[{1}] to [{2}]", new Object[] { mailSubject, mailBody, originalCommentEmail }); mailService.send(message); } catch (final Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); throw new EventException("Reply notifier error!"); } }
From source file:magma.agent.worldmodel.localizer.impl.LocalizerTriangulation.java
/** * Calculates absolute position and directions by performing triangulation * for all pairs of flags taking the average of all calculations. * @param flags visible landmarks with known position to be used for * localization/* w ww . j av a 2s . c o m*/ * @param neckYawAngle the horizontal neck angle (yaw) of the viewer * @param neckPitchAngle the vertical neck angle (pitch) of the viewer (not * used at the moment) * @return an array of two Vector3Ds, the first containing the absolute x,y,z * position of the viewer on the field, the second containing no real * vector, but the horizontal, latitudal and rotational absolute body * angles of the viewer */ public PositionOrientation localize(HashMap<String, ILocalizationFlag> flags, float neckYawAngle, float neckPitchAngle, Vector3D gyro) { if (flags.size() < 2) { // there are not 2 visible flags logger.log(Level.FINER, "Localization not possible, only have {0} flags", flags.size()); return null; } // sort the flags according to their angle List<ILocalizationFlag> sortedFlags = new ArrayList<ILocalizationFlag>(flags.values()); Collections.sort(sortedFlags); // get the two flags with maximum angle difference int triangulations = sortedFlags.size() * (sortedFlags.size() - 1) / 2; assert triangulations > 0 : "we need at least one triangulation"; PositionOrientation[] results = new PositionOrientation[triangulations]; int count = 0; for (int i = 0; i < sortedFlags.size() - 1; i++) { ILocalizationFlag flag1 = sortedFlags.get(i); for (int j = i + 1; j < sortedFlags.size(); j++) { ILocalizationFlag flag2 = sortedFlags.get(j); results[count] = triangulate(flag1, flag2, neckYawAngle); count++; } } PositionOrientation result = PositionOrientation.average(results); return result; }
From source file:org.geoserver.security.keycloak.GeoServerKeycloakFilterConfig.java
/** * Save an adapter-configuration object as a string. * * @param config config to save//from ww w . j a va 2 s . co m * @throws IOException if the provided config cannot be saved as a string */ public void writeAdapterConfig(AdapterConfig config) throws IOException { LOG.log(Level.FINER, "GeoServerKeycloakFilterConfig.writeAdapterConfig ENTRY"); ObjectMapper om = new ObjectMapper(); setAdapterConfig(om.writeValueAsString(config)); }
From source file:name.richardson.james.bukkit.alias.persistence.InetAddressRecordManager.java
public void save(InetAddressRecord inetAddressRecord) { logger.log(Level.FINER, "Saving {0}", inetAddressRecord.toString()); database.save(inetAddressRecord); }
From source file:org.apache.cxf.jca.outbound.ManagedConnectionFactoryImpl.java
public Object createConnectionFactory() throws ResourceException { if (LOG.isLoggable(Level.FINER)) { LOG.finer("Create connection factory for unmanaged connections"); }//from w ww.j av a2s . c o m return new ConnectionFactoryImpl(this, defaultConnectionManager); }