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

x33g5p2x  于2022-01-24 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(143)

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

/**
   * Writes an event to the logger.
   */
  private static void log(final Level level, final String method, final String message) {
    final LogRecord record = new LogRecord(level, message);
    record.setSourceClassName(Synchronizer.class.getName());
    record.setSourceMethodName(method);
    Logging.getLogger("org.geotoolkit.sql").log(record);
  }
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

/**
 * Logs a warning for a non-critical error. The callers should have a fallback.
 */
private static void warning(final String method, final Exception e) {
  Logging.recoverableException(Logging.getLogger(Modules.REFERENCING), IdentifiedObjects.class, method, e);
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

/**
 * Invoked when a recoverable exception occurred. Those exceptions must be minor enough
 * that they can be silently ignored in most cases.
 */
static void recoverableException(final Class<? extends Static> caller, final TransformException exception) {
  Logging.recoverableException(Logging.getLogger(Loggers.GEOMETRY), caller, "transform", exception);
}

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
   * Logs a recoverable exception that happened (directly or indirectly) in the {@link #configuration()} method.
   */
  private static void recoverableException(final String logger, final Exception e) {
    Logging.recoverableException(Logging.getLogger(logger), About.class, "configuration", e);
  }
}

代码示例来源:origin: org.apache.sis.storage/sis-storage

/**
   * Invoked for reporting exceptions that may be normal behavior. This method logs
   * the exception at {@link java.util.logging.Level#FINE} without stack trace.
   */
  private static void recoverableException(final Exception warning) {
    Logging.recoverableException(Logging.getLogger(Modules.STORAGE), ChannelFactory.class, "prepare", warning);
  }
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

/**
   * Logs a warning about a failure to compute the Bursa-Wolf parameters.
   */
  private static void log(final String logger, final String method, final Exception e) {
    Logging.recoverableException(Logging.getLogger(logger), GeocentricAffine.class, method, e);
  }
}

代码示例来源:origin: apache/sis

/**
   * Reports the given exception as an ignorable one. We consider {@link FactoryException} or
   * {@link TransformException} as ignorable exceptions only if they occurred while computing
   * whether a point is inside the domain of validity. Failure to answer that question is
   * considered as an indication that the point is outside the domain of validity.
   */
  private static void warning(final Exception e) {
    Logging.recoverableException(Logging.getLogger("org.apache.sis.console"), TransformCommand.class, "run", e);
  }
}

代码示例来源:origin: apache/sis

/**
 * Invoked when a recoverable exception occurred. Those exceptions must be minor enough
 * that they can be silently ignored in most cases.
 *
 * @param  exception  the exception that occurred.
 */
static void recoverableException(final Exception exception) {
  Logging.recoverableException(Logging.getLogger(Modules.RASTER), GridGeometry.class, "<init>", exception);
}

代码示例来源:origin: apache/sis

/**
   * Logs a recoverable exception that happened (directly or indirectly) in the {@link #configuration()} method.
   */
  private static void recoverableException(final String logger, final Exception e) {
    Logging.recoverableException(Logging.getLogger(logger), About.class, "configuration", e);
  }
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Same as {@link DomUtilities#textAttributeValue(org.w3c.dom.Element, java.lang.String, java.lang.String, java.lang.Class) }
 * but dont throw any exception.
 */
public static <T> T textAttributeValueSafe(final Element parent, final String tagName, final String attributeName, final Class<T> clazz) {
  try {
    return textAttributeValue(parent, tagName,attributeName,  clazz);
  } catch (UnconvertibleObjectException ex) {
    Logging.getLogger("org.geotoolkit.util").log(Level.WARNING, null, ex);
    return null;
  }
}

代码示例来源:origin: org.apache.sis.core/sis-utility

/**
 * Logs a warning about an exception that can be safely ignored.
 */
final void warning(final String method, final RuntimeException e) {
  Logging.recoverableException(Logging.getLogger(Loggers.MATH), Vector.class, method, e);
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

/**
 * Logs a warning about an unexpected but non-fatal exception.
 *
 * @param method     the source method.
 * @param exception  the exception to log.
 */
private static void unexpectedException(final String method, final Exception exception) {
  Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), EPSGDataAccess.class, method, exception);
}

代码示例来源:origin: apache/sis

/**
   * Logs a warning about a failure to compute the Bursa-Wolf parameters.
   */
  private static void log(final String logger, final String method, final Exception e) {
    Logging.recoverableException(Logging.getLogger(logger), GeocentricAffine.class, method, e);
  }
}

代码示例来源:origin: apache/sis

/**
 * Logs a warning about an unexpected but non-fatal exception.
 *
 * @param method     the source method.
 * @param exception  the exception to log.
 */
private static void unexpectedException(final String method, final Exception exception) {
  Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), EPSGDataAccess.class, method, exception);
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Same as {@link DomUtilities#textAttributeValue(org.w3c.dom.Element, java.lang.String, java.lang.String, java.lang.Class, java.lang.boolean) }
 * but dont throw any exception.
 */
public static <T> T textAttributeValueSafe(final Element parent, final String tagName, final String attributeName, final Class<T> clazz, final boolean recursive) {
  try {
    return textAttributeValue(parent, tagName,attributeName,  clazz, recursive);
  } catch (UnconvertibleObjectException ex) {
    Logging.getLogger("org.geotoolkit.util").log(Level.WARNING, null, ex);
    return null;
  }
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

/**
   * Invoked when an unexpected exception occurred. Those exceptions must be non-fatal, i.e. the caller
   * <strong>must</strong> have a reasonable fallback (otherwise it should propagate the exception).
   */
  private static void unexpectedException(final String methodName, final Exception exception) {
    Logging.unexpectedException(Logging.getLogger(Modules.REFERENCING), CRS.class, methodName, exception);
  }
}

代码示例来源:origin: org.apache.sis.core/sis-metadata

/**
 * Logs the given record. This is used only when we can not use the {@link #warning warning methods},
 * or when the information is not worth to report as a warning.
 */
final void log(final LogRecord record) {
  Logger logger = Logging.getLogger(Loggers.WKT);
  record.setSourceClassName(getPublicFacade());
  record.setSourceMethodName(getFacadeMethod());
  record.setLoggerName(logger.getName());
  logger.log(record);
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

/**
 * Rewrites the given code in a canonical format.
 * If the code can not be reformatted, then this method returns {@code null}.
 */
static String reformat(final String code) {
  try {
    return format(Integer.parseInt(code.substring(skipNamespace(code) & ~LEGACY_MASK)));
  } catch (NoSuchAuthorityCodeException | NumberFormatException e) {
    Logging.recoverableException(Logging.getLogger(Loggers.CRS_FACTORY), CommonAuthorityFactory.class, "reformat", e);
    return null;
  }
}

代码示例来源:origin: org.apache.sis.core/sis-metadata

/**
   * Invoked if JNDI lost connection to the server while preparing the {@code NamingEvent}.
   * Clears the data source anyway. In the worst case scenario, the application will fetch
   * it again from a the JNDI context.
   */
  @Override
  public void namingExceptionThrown(NamingExceptionEvent event) {
    Logging.unexpectedException(Logging.getLogger(Loggers.SYSTEM),
        Listener.class, "namingExceptionThrown", event.getException());
    objectChanged(null);
  }
}

代码示例来源:origin: apache/sis

/**
   * Invoked if JNDI lost connection to the server while preparing the {@code NamingEvent}.
   * Clears the data source anyway. In the worst case scenario, the application will fetch
   * it again from a the JNDI context.
   */
  @Override
  public void namingExceptionThrown(NamingExceptionEvent event) {
    Logging.unexpectedException(Logging.getLogger(Loggers.SYSTEM),
        Listener.class, "namingExceptionThrown", event.getException());
    objectChanged(null);
  }
}

相关文章