/** * Gets a log record for the given key from this resource bundle or one of its parents. * * @param level The log record level. * @param key The key for the desired string. * @return The string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static LogRecord format(final Level level, final int key) throws MissingResourceException { return getResources(null).getLogRecord(level, key); }
/** * Returns resources in the given locale. * * @param locale The locale, or {@code null} for the default locale. * @return Resources in the given locale. * @throws MissingResourceException if resources can't be found. */ public static Logging getResources(Locale locale) throws MissingResourceException { if (locale == null) { locale = Locale.getDefault(); } return (Logging) getBundle(Logging.class.getName(), locale); /* * We rely on cache capability of ResourceBundle. */ }
/** * Prepares a message to be logged if any provider has been registered. */ private static StringBuffer getLogHeader(final Class category) { return new StringBuffer(Logging.getResources(null).getString( LoggingKeys.FACTORY_IMPLEMENTATIONS_$1, Utilities.getShortName(category))); }
/** * Invoked when a factory can't be loaded. Log a warning, but do not stop the process. */ private static void loadingFailure(final Class category, final Throwable error, final boolean showStackTrace) { final String name = Utilities.getShortName(category); final StringBuffer cause = new StringBuffer(Utilities.getShortClassName(error)); final String message = error.getLocalizedMessage(); if (message != null) { cause.append(": "); cause.append(message); } final LogRecord record = Logging.format(Level.WARNING, LoggingKeys.CANT_LOAD_SERVICE_$2, name, cause.toString()); if (showStackTrace) { record.setThrown(error); } record.setSourceClassName(FactoryRegistry.class.getName()); record.setSourceMethodName("scanForPlugins"); LOGGER.log(record); }
RIFRegistry.register(registry, op, "org.geotools", new NodataFilterCRIF()); record = Logging.format(Level.CONFIG, LoggingKeys.REGISTERED_JAI_OPERATIONS); op = null; } catch (IllegalArgumentException exception) { record = Logging.getResources(null).getLogRecord(Level.WARNING, LoggingKeys.CANT_REGISTER_JAI_OPERATION_$1, op); record.setThrown(exception);
/** * Serializes this grid coverage. Before serialization, a {@linkplain SerializableRenderedImage * serializable rendered image} is created if it was not already done. */ private void writeObject(final ObjectOutputStream out) throws IOException { ensureValid(); if (serializedImage == null) { RenderedImage source = image; while (source instanceof RenderedImageAdapter) { source = ((RenderedImageAdapter) source).getWrappedImage(); } if (source instanceof SerializableRenderedImage) { serializedImage = (SerializableRenderedImage) source; } else { if (tileEncoding == null) { tileEncoding = "gzip"; } serializedImage = new SerializableRenderedImage(source, false, null, tileEncoding, null, null); final LogRecord record = Logging.format(Level.FINE, LoggingKeys.CREATED_SERIALIZABLE_IMAGE_$2, getName(), tileEncoding); record.setSourceClassName(GridCoverage2D.class.getName()); record.setSourceMethodName("writeObject"); LOGGER.log(record); } } out.defaultWriteObject(); }
try { final Driver d = (Driver) Class.forName(driver).newInstance(); log = Logging.format(Level.CONFIG, LoggingKeys.LOADED_JDBC_DRIVER_$3, driver, new Integer(d.getMajorVersion()), new Integer(d.getMinorVersion()));
/** * Gets a log record for the given key. Replaces all occurence of "{0}" * with values of {@code arg0}. * * @param level The log record level. * @param key The key for the desired string. * @param arg0 Value to substitute to "{0}". * @return The formatted string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static LogRecord format(final Level level, final int key, final Object arg0) throws MissingResourceException { return getResources(null).getLogRecord(level, key, arg0); }
root.log(Logging.format(Level.CONFIG, LoggingKeys.REDIRECTED_TO_COMMONS_LOGGING));
/** * Gets a log record for the given key. Replaces all occurence of "{0}", * "{1}", with values of {@code arg0}, {@code arg1}, etc. * * @param level The log record level. * @param key The key for the desired string. * @param arg0 Value to substitute to "{0}". * @param arg1 Value to substitute to "{1}". * @param arg2 Value to substitute to "{2}". * @return The formatted string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static LogRecord format(final Level level, final int key, final Object arg0, final Object arg1, final Object arg2) throws MissingResourceException { return getResources(null).getLogRecord(level, key, arg0, arg1, arg2); }
/** * Register the "SampleTranscode" image operation to the operation registry of * the specified JAI instance. This method is invoked by the static initializer * of {@link GridSampleDimension}. */ public static void register(final JAI jai) { final OperationRegistry registry = jai.getOperationRegistry(); try { registry.registerDescriptor(new Descriptor()); registry.registerFactory(RenderedRegistryMode.MODE_NAME, OPERATION_NAME, "geotools.org", new CRIF()); } catch (IllegalArgumentException exception) { final LogRecord record = Logging.format(Level.SEVERE, LoggingKeys.CANT_REGISTER_JAI_OPERATION_$1, OPERATION_NAME); // Note: GridSampleDimension is the public class that use this transcoder. record.setSourceClassName(GridSampleDimension.class.getName()); record.setSourceMethodName("<classinit>"); record.setThrown(exception); AbstractGridCoverage.LOGGER.log(record); } } }
/** * Gets a log record for the given key. Replaces all occurence of "{0}", * "{1}", with values of {@code arg0}, {@code arg1}. * * @param level The log record level. * @param key The key for the desired string. * @param arg0 Value to substitute to "{0}". * @param arg1 Value to substitute to "{1}". * @return The formatted string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static LogRecord format(final Level level, final int key, final Object arg0, final Object arg1) throws MissingResourceException { return getResources(null).getLogRecord(level, key, arg0, arg1); }
/** * Register the "SampleTranscode" image operation to the operation registry of * the specified JAI instance. This method is invoked by the static initializer * of {@link GridSampleDimension}. */ public static void register(final JAI jai) { final OperationRegistry registry = jai.getOperationRegistry(); try { registry.registerDescriptor(new NoDataReplacerDescriptor()); registry.registerFactory(RenderedRegistryMode.MODE_NAME, OPERATION_NAME, "gce.geotools.org", new NoDataReplacerCRIF()); } catch (IllegalArgumentException exception) { final LogRecord record = Logging.format(Level.SEVERE, LoggingKeys.CANT_REGISTER_JAI_OPERATION_$1, OPERATION_NAME); record.setSourceClassName("GridSampleDimension"); record.setSourceMethodName("<classinit>"); record.setThrown(exception); AbstractGridCoverage.LOGGER.log(record); } } }
/** * Gets a log record for the given key. Replaces all occurence of "{0}", * "{1}", with values of {@code arg0}, {@code arg1}, etc. * * @param level The log record level. * @param key The key for the desired string. * @param arg0 Value to substitute to "{0}". * @param arg1 Value to substitute to "{1}". * @param arg2 Value to substitute to "{2}". * @param arg3 Value to substitute to "{3}". * @return The formatted string for the given key. * @throws MissingResourceException If no object for the given key can be found. */ public static LogRecord format(final Level level, final int key, final Object arg0, final Object arg1, final Object arg2, final Object arg3) throws MissingResourceException { return getResources(null).getLogRecord(level, key, arg0, arg1, arg2, arg3); } }
allowed ? nativeFactory : javaFactory, allowed ? javaFactory : nativeFactory); final LogRecord record = Logging.format(Level.CONFIG, LoggingKeys.NATIVE_ACCELERATION_STATE_$2, operation, new Integer(allowed ? 1 : 0));
final LogRecord record = Logging.getResources(locale).getLogRecord( OPERATION, LoggingKeys.APPLIED_OPERATION_$4, getName((source!=null) ? source : result, locale),
final LogRecord record = Logging.format(Level.FINER, LoggingKeys.DEFERRED_TILE_PAINTING_$2, new Integer(tileX), new Integer(tileY)); record.setSourceClassName(DeferredPlanarImage.class.getName());
final String shortName = (index>=0) ? operation.substring(index+1) : operation; final Locale locale = getLocale(); final LogRecord record = Logging.getResources(locale).getLogRecord( AbstractProcessor.OPERATION, LoggingKeys.SAMPLE_TRANSCODE_$3, new Object[] {
log(Logging.format(Level.WARNING, LoggingKeys.UNRECOGNIZED_SCALE_TYPE_$1, Utilities.getShortClassName(tr))); graduation = new NumberGraduation(units);
targetGG = new GridGeometry2D(actualGR, gridToCRS, targetCRS); if (!automaticGR) { log(Logging.getResources(locale).getLogRecord(Level.WARNING, LoggingKeys.ADJUSTED_GRID_GEOMETRY_$1, sourceCoverage.getName().toString(locale))); .equals(targetImage.getBounds()) : targetGG; if (AbstractProcessor.LOGGER.isLoggable(LOGGING_LEVEL)) { log(Logging.getResources(locale).getLogRecord(LOGGING_LEVEL, LoggingKeys.APPLIED_RESAMPLE_$11, new Object[] {