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

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

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

Logger.isWarnEnabled介绍

[英]Returns true if WARN level is enabled.
[中]如果启用了警告级别,则返回true

代码示例

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

/**
 * Logs a message at WARN level.
 */
default void warn(final Supplier<String> messageSupplier) {
  if (isWarnEnabled()) {
    warn(messageSupplier.get());
  }
}

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

/**
 * Logs a message at WARN level.
 */
default void warn(final Supplier<String> messageSupplier, final Throwable throwable) {
  if (isWarnEnabled()) {
    warn(messageSupplier.get(), throwable);
  }
}

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

if (log.isWarnEnabled()) {
  log.warn("Alias not found: " + aliasName);

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

/**
 * Resolves column db sql type and populates it in column descriptor if missing.
 */
protected void resolveColumnDbSqlType(final Connection connection, final DbEntityColumnDescriptor dec) {
  if (dec.dbSqlType != SqlType.DB_SQLTYPE_UNKNOWN) {
    return;
  }
  ResultSet rs = null;
  DbEntityDescriptor ded = dec.getDbEntityDescriptor();
  try {
    DatabaseMetaData dmd = connection.getMetaData();
    rs = dmd.getColumns(null, ded.getSchemaName(), ded.getTableName(), dec.getColumnName());
    if (rs.next()) {
      dec.dbSqlType = rs.getInt("DATA_TYPE");
    } else {
      dec.dbSqlType = SqlType.DB_SQLTYPE_NOT_AVAILABLE;
      if (log.isWarnEnabled()) {
        log.warn("Column SQL type not available: " + ded.toString() + '.' + dec.getColumnName());
      }
    }
  } catch (SQLException sex) {
    dec.dbSqlType = SqlType.DB_SQLTYPE_NOT_AVAILABLE;
    if (log.isWarnEnabled()) {
      log.warn("Column SQL type not resolved: " + ded.toString() + '.' + dec.getColumnName(), sex);
    }
  } finally {
    DbUtil.close(rs);
  }
}

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

throw ioex;
if (log.isWarnEnabled()) {
  log.warn("Download failed: " + src + "; " + ioex.getMessage());
    throw ioex;
  if (log.isWarnEnabled()) {
    log.warn(ioex.getMessage());
    throw ioex;
  if (log.isWarnEnabled()) {
    log.warn("Download failed: " + localUrl + "; " + ioex.getMessage());

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

if (log.isWarnEnabled()) {
  log.warn(createMixingMessage(targetBeanDefinition, refBeanDefinition));

代码示例来源: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 WARN level.
 */
default void warn(final Supplier<String> messageSupplier) {
  if (isWarnEnabled()) {
    warn(messageSupplier.get());
  }
}

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

/**
 * Logs a message at WARN level.
 */
default void warn(final Supplier<String> messageSupplier, final Throwable throwable) {
  if (isWarnEnabled()) {
    warn(messageSupplier.get(), throwable);
  }
}

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

/**
 * Resolves column db sql type and populates it in column descriptor if missing.
 */
protected void resolveColumnDbSqlType(final Connection connection, final DbEntityColumnDescriptor dec) {
  if (dec.dbSqlType != SqlType.DB_SQLTYPE_UNKNOWN) {
    return;
  }
  ResultSet rs = null;
  DbEntityDescriptor ded = dec.getDbEntityDescriptor();
  try {
    DatabaseMetaData dmd = connection.getMetaData();
    rs = dmd.getColumns(null, ded.getSchemaName(), ded.getTableName(), dec.getColumnName());
    if (rs.next()) {
      dec.dbSqlType = rs.getInt("DATA_TYPE");
    } else {
      dec.dbSqlType = SqlType.DB_SQLTYPE_NOT_AVAILABLE;
      if (log.isWarnEnabled()) {
        log.warn("Column SQL type not available: " + ded.toString() + '.' + dec.getColumnName());
      }
    }
  } catch (SQLException sex) {
    dec.dbSqlType = SqlType.DB_SQLTYPE_NOT_AVAILABLE;
    if (log.isWarnEnabled()) {
      log.warn("Column SQL type not resolved: " + ded.toString() + '.' + dec.getColumnName(), sex);
    }
  } finally {
    DbUtil.close(rs);
  }
}

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

throw ioex;
if (log.isWarnEnabled()) {
  log.warn("Download failed: " + src + "; " + ioex.getMessage());
    throw ioex;
  if (log.isWarnEnabled()) {
    log.warn(ioex.getMessage());
    throw ioex;
  if (log.isWarnEnabled()) {
    log.warn("Download failed: " + localUrl + "; " + ioex.getMessage());

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

if (log.isWarnEnabled()) {
  log.warn(createMixingMessage(targetBeanDefinition, refBeanDefinition));

相关文章