jodd.log.Logger.isInfoEnabled()方法的使用及代码示例

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

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

Logger.isInfoEnabled介绍

[英]Returns true if INFO level is enabled.
[中]如果启用了信息级别,则返回true

代码示例

代码示例来源:origin: oblac/jodd

/**
 * Logs a message at INFO level.
 */
default void info(final Supplier<String> messageSupplier) {
  if (isInfoEnabled()) {
    info(messageSupplier.get());
  }
}

代码示例来源:origin: oblac/jodd

/**
 * Close all the connections. Use with caution: be sure no connections are in
 * use before calling. Note that you are not <i>required</i> to call this
 * when done with a ConnectionPool, since connections are guaranteed to be
 * closed when garbage collected. But this method gives more control
 * regarding when the connections are closed.
 */
@Override
public synchronized void close() {
  if (log.isInfoEnabled()) {
    log.info("Core connection pool shutdown");
  }
  closeConnections(availableConnections);
  availableConnections = new ArrayList<>(maxConnections);
  closeConnections(busyConnections);
  busyConnections = new ArrayList<>(maxConnections);
}

代码示例来源:origin: oblac/jodd

/**
 * Checks if connection provider can return a connection.
 */
protected void checkConnectionProvider() {
  final Connection connection = connectionProvider.getConnection();
  try {
    final DatabaseMetaData databaseMetaData = connection.getMetaData();
    String name = databaseMetaData.getDatabaseProductName();
    String version = databaseMetaData.getDatabaseProductVersion();
    if (log.isInfoEnabled()) {
      log.info("Connected to database: " + name + " v" + version);
    }
  } catch (SQLException sex) {
    log.error("DB connection failed: ", sex);
  } finally {
    connectionProvider.closeConnection(connection);
  }
}

代码示例来源:origin: oblac/jodd

return;
if (log.isInfoEnabled()) {
  log.info("Core connection pool initialization");

代码示例来源:origin: oblac/jodd

/**
 * Clears all settings and removes all created bundle files from file system.
 */
public synchronized void reset() {
  if (strategy == Strategy.ACTION_MANAGED) {
    actionBundles.clear();
    mirrors.clear();
  }
  FindFile ff = new FindFile();
  ff.includeDirs(false);
  ff.searchPath(new File(bundleFolder, staplerPath));
  File f;
  int count = 0;
  while ((f = ff.nextFile()) != null) {
    f.delete();
    count++;
  }
  if (log.isInfoEnabled()) {
    log.info("reset: " + count + " bundle files deleted.");
  }
}

代码示例来源:origin: oblac/jodd

/**
 * Loads Madvoc parameters. New {@link Props} is created from the classpath.
 */
protected Props loadMadvocParams(final String[] patterns) {
  if (log.isInfoEnabled()) {
    log.info("Loading Madvoc parameters from: " + Converter.get().toString(patterns));
  }
  try {
    return new Props().loadFromClasspath(patterns);
  } catch (Exception ex) {
    throw new MadvocException("Unable to load Madvoc parameters from: " +
        Converter.get().toString(patterns) + ".properties': " + ex.toString(), ex);
  }
}

代码示例来源:origin: oblac/jodd

/**
 * Configures {@link DbEntityManager} with specified class path.
 */
public void configure() {
  long elapsed = System.currentTimeMillis();
  final ClassScanner classScanner = new ClassScanner();
  classScanner.detectEntriesMode(true);
  classScanner.scanDefaultClasspath();
  classScannerConsumers.accept(classScanner);
  registerAsConsumer(classScanner);
  try {
    classScanner.start();
  } catch (Exception ex) {
    throw new DbOomException("Scan classpath error", ex);
  }
  elapsed = System.currentTimeMillis() - elapsed;
  if (log.isInfoEnabled()) {
    log.info("DbEntityManager configured in " + elapsed + "ms. Total entities: " + dbEntityManager.getTotalNames());
  }
}

代码示例来源:origin: oblac/jodd

if (log.isInfoEnabled()) {
  log.info("Bundle created: " + bundleId);

代码示例来源:origin: oblac/jodd

@Test
void testIsLevelEnabled() {
  // Loggers does not provide any API to enable levels.
  // Instead we need to use log/level(trace/debug etc) API to log information into corresponding level
  assertFalse(logger.isTraceEnabled());
  assertFalse(logger.isDebugEnabled());
  assertFalse(logger.isInfoEnabled());
  assertFalse(logger.isWarnEnabled());
  assertFalse(logger.isErrorEnabled());
}

代码示例来源:origin: oblac/jodd

@Override
@Test
void testIsLevelEnabled() {
  //when
  initializeLogFactoryAndLogger(Logger.Level.DEBUG);
  //then 
  assertTrue(logger.isDebugEnabled());
  //when
  initializeLogFactoryAndLogger(Logger.Level.ERROR);
  //then 
  assertTrue(logger.isErrorEnabled());
  //when
  initializeLogFactoryAndLogger(Logger.Level.INFO);
  //then 
  assertTrue(logger.isInfoEnabled());
  //when
  initializeLogFactoryAndLogger(Logger.Level.TRACE);
  //then 
  assertTrue(logger.isTraceEnabled());
  //when
  initializeLogFactoryAndLogger(Logger.Level.WARN);
  //then 
  assertTrue(logger.isWarnEnabled());
}

代码示例来源:origin: org.jodd/jodd-log

/**
 * Logs a message at INFO level.
 */
default void info(final Supplier<String> messageSupplier) {
  if (isInfoEnabled()) {
    info(messageSupplier.get());
  }
}

代码示例来源:origin: org.jodd/jodd-db

/**
 * Close all the connections. Use with caution: be sure no connections are in
 * use before calling. Note that you are not <i>required</i> to call this
 * when done with a ConnectionPool, since connections are guaranteed to be
 * closed when garbage collected. But this method gives more control
 * regarding when the connections are closed.
 */
@Override
public synchronized void close() {
  if (log.isInfoEnabled()) {
    log.info("Core connection pool shutdown");
  }
  closeConnections(availableConnections);
  availableConnections = new ArrayList<>(maxConnections);
  closeConnections(busyConnections);
  busyConnections = new ArrayList<>(maxConnections);
}

代码示例来源:origin: org.jodd/jodd-joy

/**
 * Checks if connection provider can return a connection.
 */
protected void checkConnectionProvider() {
  final Connection connection = connectionProvider.getConnection();
  try {
    final DatabaseMetaData databaseMetaData = connection.getMetaData();
    String name = databaseMetaData.getDatabaseProductName();
    String version = databaseMetaData.getDatabaseProductVersion();
    if (log.isInfoEnabled()) {
      log.info("Connected to database: " + name + " v" + version);
    }
  } catch (SQLException sex) {
    log.error("DB connection failed: ", sex);
  } finally {
    connectionProvider.closeConnection(connection);
  }
}

代码示例来源:origin: org.jodd/jodd-db

return;
if (log.isInfoEnabled()) {
  log.info("Core connection pool initialization");

代码示例来源:origin: org.jodd/jodd-htmlstapler

/**
 * Clears all settings and removes all created bundle files from file system.
 */
public synchronized void reset() {
  if (strategy == Strategy.ACTION_MANAGED) {
    actionBundles.clear();
    mirrors.clear();
  }
  FindFile ff = new FindFile();
  ff.includeDirs(false);
  ff.searchPath(new File(bundleFolder, staplerPath));
  File f;
  int count = 0;
  while ((f = ff.nextFile()) != null) {
    f.delete();
    count++;
  }
  if (log.isInfoEnabled()) {
    log.info("reset: " + count + " bundle files deleted.");
  }
}

代码示例来源:origin: org.jodd/jodd-db

/**
 * Configures {@link DbEntityManager} with specified class path.
 */
public void configure() {
  long elapsed = System.currentTimeMillis();
  final ClassScanner classScanner = new ClassScanner();
  classScanner.detectEntriesMode(true);
  classScanner.scanDefaultClasspath();
  classScannerConsumers.accept(classScanner);
  registerAsConsumer(classScanner);
  try {
    classScanner.start();
  } catch (Exception ex) {
    throw new DbOomException("Scan classpath error", ex);
  }
  elapsed = System.currentTimeMillis() - elapsed;
  if (log.isInfoEnabled()) {
    log.info("DbEntityManager configured in " + elapsed + "ms. Total entities: " + dbEntityManager.getTotalNames());
  }
}

代码示例来源:origin: org.jodd/jodd-htmlstapler

if (log.isInfoEnabled()) {
  log.info("Bundle created: " + bundleId);

相关文章