org.geotools.util.logging.Logging.getLogger()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(254)

本文整理了Java中org.geotools.util.logging.Logging.getLogger()方法的一些代码示例,展示了Logging.getLogger()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logging.getLogger()方法的具体详情如下:
包路径:org.geotools.util.logging.Logging
类名称:Logging
方法名:getLogger

Logging.getLogger介绍

[英]Returns a logger for the specified class. This convenience method invokes #getLogger(String) with the package name as the logger name.
[中]返回指定类的记录器。这个方便的方法调用#getLogger(String),将包名作为记录器名称。

代码示例

代码示例来源:origin: geoserver/geoserver

Logger getLogger() {
    if (LOGGER == null) {
      LOGGER = Logging.getLogger("org.geoserver.logging");
    }
    return LOGGER;
  }
}

代码示例来源:origin: geoserver/geoserver

public RequestObjectLogger(String logPackage) {
  logger = org.geotools.util.logging.Logging.getLogger(logPackage);
}

代码示例来源:origin: geoserver/geoserver

protected static Logger LOGGER = Logging.getLogger("org.geoserver.security");

代码示例来源:origin: geoserver/geoserver

private static final Logger LOGGER = Logging.getLogger(GeoServerPropertyFactoryBean.class);

代码示例来源:origin: geoserver/geoserver

/**
 * Initializes a newly created data store factory by processing the {@link
 * DataStoreFactoryInitializer} extension point.
 */
@SuppressWarnings({"rawtypes", "unchecked"})
static DataAccessFactory initializeDataStoreFactory(DataAccessFactory factory) {
  List<DataStoreFactoryInitializer> initializers =
      GeoServerExtensions.extensions(DataStoreFactoryInitializer.class);
  for (DataStoreFactoryInitializer initer : initializers) {
    if (initer.getFactoryClass().isAssignableFrom(factory.getClass())) {
      try {
        initer.initialize(factory);
      } catch (Throwable t) {
        final Logger LOGGER2 = Logging.getLogger("org.geoserver.platform");
        String msg =
            "Error occured processing extension: " + initer.getClass().getName();
        LOGGER2.log(Level.WARNING, msg, t);
      }
    }
  }
  return factory;
}

代码示例来源:origin: geoserver/geoserver

@BeforeClass
public static final void setUpLogging() throws Exception {
  if (isQuietTests()) {
    Logging.getLogger("org.geoserver").setLevel(Level.SEVERE);
    Logging.getLogger("org.vfny.geoserver").setLevel(Level.SEVERE);
    Logging.getLogger("org.geotools").setLevel(Level.SEVERE);
  }
}

代码示例来源:origin: geoserver/geoserver

Formatter log4j = null;
final Logger logger = org.geotools.util.logging.Logging.getLogger(base);

代码示例来源:origin: geoserver/geoserver

@Test
public void testBeanString() {
  ApplicationContext appContext = createMock(ApplicationContext.class);
  GeoServerExtensions gse = new GeoServerExtensions();
  gse.setApplicationContext(null);
  Logger LOGGER = Logging.getLogger("org.geoserver.platform");
  Level level = LOGGER.getLevel();
  try {
    LOGGER.setLevel(Level.SEVERE);
    assertNull(GeoServerExtensions.bean("beanName"));
  } finally {
    LOGGER.setLevel(level);
  }
  gse.setApplicationContext(appContext);
  expect(appContext.isSingleton((String) anyObject())).andReturn(true).anyTimes();
  expect(appContext.getBean("beanName")).andReturn(null); // call #1
  expect(appContext.getBean("beanName")).andReturn(this); // call #2
  replay(appContext);
  assertNull(GeoServerExtensions.bean("beanName")); // call #1
  assertSame(this, GeoServerExtensions.bean("beanName")); // call #2
  verify(appContext);
}

代码示例来源:origin: geoserver/geoserver

@Test
public void testRemoveWorkspaceLocalService() throws Exception {
  testAddWorkspaceLocalService();
  File dataDirRoot = getTestData().getDataDirectoryRoot();
  WorkspaceInfo ws = getCatalog().getDefaultWorkspace();
  File f = new File(dataDirRoot, "workspaces" + "/" + ws.getName() + "/service.xml");
  assertTrue(f.exists());
  Logger logger = Logging.getLogger(GeoServerImpl.class);
  Level level = logger.getLevel();
  try {
    logger.setLevel(Level.OFF);
    ServiceInfo s = geoServer.getServiceByName(ws, "foo", ServiceInfo.class);
    geoServer.remove(s);
    assertFalse(f.exists());
  } finally {
    logger.setLevel(level);
  }
}

代码示例来源:origin: geoserver/geoserver

@Test
public void testConcurrentCatalogModification() throws Exception {
  Logger logger = Logging.getLogger(CatalogImpl.class);
  final int tasks = 8;
  ExecutorService executor = Executors.newFixedThreadPool(tasks / 2);

代码示例来源:origin: geoserver/geoserver

.setImagingListener(
    new ImagingListener() {
      final Logger LOGGER = Logging.getLogger("javax.media.jai");

代码示例来源:origin: geotools/geotools

/**
 * Returns the logger to be used for this class.
 *
 * @todo Logger.setLevel(...) should not be invoked, because it override any user setting in
 *     {@code jre/lib/logging.properties}. Users should edit their properties file instead. If
 *     Geotools is too verbose below the warning level, then some log messages should probably
 *     be changed from Level.INFO to Level.FINE.
 */
private static final Logger getLogger() {
  Logger l = org.geotools.util.logging.Logging.getLogger(FCBuffer.class);
  l.setLevel(Level.WARNING);
  return l;
}

代码示例来源:origin: geotools/geotools

@Override
public boolean errorOccurred(
    String message, Throwable thrown, Object where, boolean isRetryable)
    throws RuntimeException {
  Logger log = Logging.getLogger(LoggingImagingListener.class);
  if (message.contains("Continuing in pure Java mode")) {
    log.log(Level.FINER, message, thrown);
  } else {
    log.log(Level.INFO, message, thrown);
  }
  return false; // we are not trying to recover
}

代码示例来源:origin: geotools/geotools

/**
 * Logs a warning. This method is invoked automatically by the {@link #parse parse} method when
 * a text can't be fully parsed. The default implementation logs the warning to the logger
 * specified by the last call to the {@link #setLogger setLogger} method. Subclasses may
 * override this method if they want to change the log record before the logging.
 *
 * @param warning The warning to log.
 */
protected void logWarning(final LogRecord warning) {
  if (logger != null) {
    final Logger logger = Logging.getLogger(this.logger);
    warning.setLoggerName(logger.getName());
    logger.log(warning);
  }
}

代码示例来源:origin: geotools/geotools

/** Logs the specified record. */
  private static void log(final String method, final LogRecord record) {
    record.setSourceClassName(Registry.class.getName());
    record.setSourceMethodName(method);
    final Logger logger = Logging.getLogger(Registry.class);
    record.setLoggerName(logger.getName());
    logger.log(record);
  }
}

代码示例来源:origin: geotools/geotools

/** Logs a warning message. */
  private static synchronized void log(final Exception e, final ByteBuffer buffer) {
    warned = true;
    String message =
        "Error attempting to close a mapped byte buffer : "
            + buffer.getClass().getName()
            + "\n JVM : "
            + System.getProperty("java.version")
            + ' '
            + System.getProperty("java.vendor");
    Logging.getLogger(NIOUtilities.class).log(Level.SEVERE, message, e);
  }
}

代码示例来源:origin: geotools/geotools

protected static class InfoWrapper {
  public InfoWrapper(String description, String name) {
    this.description = description;
    this.name = name;
  }
  String description;
  String name;
}

代码示例来源:origin: geotools/geotools

/** Invoked when a recoverable exception occured. */
private static void recoverableException(final String method, final SQLException exception) {
  // Uses the FINE level instead of WARNING because it may be a recoverable error.
  LogRecord record = Loggings.format(Level.FINE, LoggingKeys.UNEXPECTED_EXCEPTION);
  record.setSourceClassName(AuthorityCodes.class.getName());
  record.setSourceMethodName(method);
  record.setThrown(exception);
  final Logger logger = Logging.getLogger(AuthorityCodes.class);
  record.setLoggerName(logger.getName());
  logger.log(record);
}

代码示例来源:origin: geotools/geotools

/**
   * Invoked when an inverse transform was required but the transform is not invertible. This
   * error should not happen. However, even if it happen, it will not prevent the application to
   * work since <code>contains(...)</code> method may conservatively return <code>false</code>. We
   * will just log a warning message and continue.
   */
  private static void exceptionOccured(
      final NoninvertibleTransformException exception, final String method) {
    final LogRecord record = new LogRecord(Level.WARNING, exception.getLocalizedMessage());
    record.setSourceClassName(TransformedShape.class.getName());
    record.setSourceMethodName(method);
    record.setThrown(exception);
    org.geotools.util.logging.Logging.getLogger(TransformedShape.class).log(record);
  }
}

代码示例来源:origin: geotools/geotools

public ContentDataStore() {
  // get a concurrent map so that we can do reads in parallel with writes (writes vs writes
  // are actually synchronized to prevent double work, see getEntry()).
  this.entries = new ConcurrentHashMap<Name, ContentEntry>();
  // grabbing the logger here makes the logger name polymorphic (the name of the actual
  // subclass will be used
  this.LOGGER = org.geotools.util.logging.Logging.getLogger(getClass());
  // default
  setFilterFactory(CommonFactoryFinder.getFilterFactory());
}

相关文章