org.modeshape.common.logging.Logger.warn()方法的使用及代码示例

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

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

Logger.warn介绍

[英]Log an exception (throwable) at the WARNING level with an accompanying message. If the exception is null, then this method calls #warn(org.modeshape.common.i18n.I18nResource,Object...).
[中]记录警告级别的异常(可丢弃),并附带消息。如果异常为null,则此方法调用#warn(org.modeshape.common.i18n.I18nResource,Object…)。

代码示例

代码示例来源:origin: org.fcrepo/modeshape-jcr

protected final void warn( I18n message,
              Object... params ) {
  logger.warn(message, params);
  problems.addWarning(message, params);
}

代码示例来源:origin: ModeShape/modeshape

protected final void warn( I18n message,
              Object... params ) {
  logger.warn(message, params);
  problems.addWarning(message, params);
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

@Override
public boolean shutdown( long timeout,
             TimeUnit unit ) throws InterruptedException {
  try {
    return ENGINE.shutdown().get(timeout, unit);
  } catch (ExecutionException e) {
    LOG.error(e, JcrI18n.errorShuttingDownJcrRepositoryFactory);
    return false;
  } catch (TimeoutException e) {
    LOG.warn(e, JcrI18n.timeoutWhileShuttingRepositoryDown);
    return false;
  }
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

protected void setExtractedText( BinaryKey key,
                 String text,
                 Connection connection ) throws SQLException {
  if (text.length() > maxExtractedTextLength) {
    LOGGER.warn(JcrI18n.warnExtractedTextTooLarge, EXTRACTED_TEXT_COLUMN_NAME, this.maxExtractedTextLength, tableName);
    text = text.substring(0, maxExtractedTextLength);
  }
  try (PreparedStatement setExtractedTextSql = prepareStatement(SET_EXTRACTED_TEXT_STMT_KEY, connection)) {
    setExtractedTextSql.setString(1, text);
    setExtractedTextSql.setString(2, key.toString());
    executeUpdate(setExtractedTextSql);
  }
}

代码示例来源:origin: ModeShape/modeshape

@Override
public void warn( String message,
         Object... params ) {
  if (logger.isWarnEnabled()) {
    logger.warn(new TextI18n(message), params);
  }
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

@Override
public void warn( Throwable t,
         String message,
         Object... params ) {
  if (logger.isWarnEnabled()) {
    logger.warn(t, new TextI18n(message), params);
  }
}

代码示例来源:origin: ModeShape/modeshape

@Override
public void warn( Throwable t,
         String message,
         Object... params ) {
  if (logger.isWarnEnabled()) {
    logger.warn(t, new TextI18n(message), params);
  }
}

代码示例来源:origin: org.modeshape/modeshape-web-jcr

@Override
public void warn( Throwable t,
         String message,
         Object... params ) {
  if (logger.isWarnEnabled()) {
    logger.warn(t, new TextI18n(message), params);
  }
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

@Override
public void warn( String message,
         Object... params ) {
  if (logger.isWarnEnabled()) {
    logger.warn(new TextI18n(message), params);
  }
}

代码示例来源:origin: ModeShape/modeshape

@Override
public void warn( String message,
         Object... params ) {
  if (logger.isWarnEnabled()) {
    logger.warn(new TextI18n(message), params);
  }
}

代码示例来源:origin: ModeShape/modeshape

@Override
public void warn( Throwable t,
         String message,
         Object... params ) {
  if (logger.isWarnEnabled()) {
    logger.warn(t, new TextI18n(message), params);
  }
}

代码示例来源:origin: org.modeshape/modeshape-web-jcr

@Override
public void warn( String message,
         Object... params ) {
  if (logger.isWarnEnabled()) {
    logger.warn(new TextI18n(message), params);
  }
}

代码示例来源:origin: ModeShape/modeshape

@Override
public void txStarted(String id) {
  logDebug("New transaction '{0}' started by ModeShape...", id);
  String activeTx = TransactionsHolder.activeTransaction();
  if (activeTx != null && !activeTx.equals(id)) {
    LOGGER.warn(RelationalProviderI18n.threadAssociatedWithAnotherTransaction,
        Thread.currentThread().getName(), activeTx, id);
  }
  // mark the current thread as linked to a tx...
  TransactionsHolder.setActiveTxId(id);
  // and allocate a new connection for this transaction preemptively to isolate it from other connections
  connectionForActiveTx();
}

代码示例来源:origin: ModeShape/modeshape

public RingBufferBuilder<T, C> ofSize( int bufferSize ) {
  CheckArg.isPositive(bufferSize, "bufferSize");
  try {
    CheckArg.isPowerOfTwo(bufferSize, "bufferSize");
  } catch (IllegalArgumentException e) {
    int nextPowerOf2 = nextPowerOf2(bufferSize);
    logger.warn(CommonI18n.incorrectRingBufferSize, bufferSize, nextPowerOf2);
    bufferSize = nextPowerOf2;
  }
  this.bufferSize = bufferSize;
  return this;
}

代码示例来源:origin: org.fcrepo/modeshape-common

public RingBufferBuilder<T, C> ofSize( int bufferSize ) {
  CheckArg.isPositive(bufferSize, "bufferSize");
  try {
    CheckArg.isPowerOfTwo(bufferSize, "bufferSize");
  } catch (IllegalArgumentException e) {
    int nextPowerOf2 = nextPowerOf2(bufferSize);
    logger.warn(CommonI18n.incorrectRingBufferSize, bufferSize, nextPowerOf2);
    bufferSize = nextPowerOf2;
  }
  this.bufferSize = bufferSize;
  return this;
}

代码示例来源:origin: org.modeshape/modeshape-common

public RingBufferBuilder<T, C> ofSize( int bufferSize ) {
  CheckArg.isPositive(bufferSize, "bufferSize");
  try {
    CheckArg.isPowerOfTwo(bufferSize, "bufferSize");
  } catch (IllegalArgumentException e) {
    int nextPowerOf2 = nextPowerOf2(bufferSize);
    logger.warn(CommonI18n.incorrectRingBufferSize, bufferSize, nextPowerOf2);
    bufferSize = nextPowerOf2;
  }
  this.bufferSize = bufferSize;
  return this;
}

代码示例来源:origin: ModeShape/modeshape

@Test
public void shouldLogNoMessagesIfLog4jSetToOffLevel() {
  log4jLogger.setLevel(Level.OFF);
  logger.error(errorMessageWithNoParameters);
  logger.warn(warningMessageWithNoParameters);
  logger.info(infoMessageWithNoParameters);
  logger.debug("This is a debug message with no parameters");
  logger.trace("This is a trace message with no parameters");
  assertEquals(false, log.hasEvents());
}

代码示例来源:origin: ModeShape/modeshape

@Test
public void shouldLogAppropriateMessagesIfLog4jSetToErrorLevel() {
  log4jLogger.setLevel(Level.ERROR);
  logger.error(errorMessageWithNoParameters);
  logger.warn(warningMessageWithNoParameters);
  logger.info(infoMessageWithNoParameters);
  logger.debug("This is a debug message with no parameters");
  logger.trace("This is a trace message with no parameters");
  log.removeFirst(Logger.Level.ERROR, "This is an error message with no parameters");
  assertEquals(false, log.hasEvents());
}

代码示例来源:origin: ModeShape/modeshape

public void shouldQuietlyAcceptNullMessage() {
  logger.error(null);
  logger.warn(null);
  logger.info(null);
  logger.debug(null);
  logger.trace(null);
  assertEquals(false, log.hasEvents());
}

代码示例来源:origin: ModeShape/modeshape

@Test
public void shouldLogAppropriateMessagesIfLog4jSetToWarningLevel() {
  log4jLogger.setLevel(Level.WARN);
  logger.error(errorMessageWithNoParameters);
  logger.warn(warningMessageWithNoParameters);
  logger.info(infoMessageWithNoParameters);
  logger.debug("This is a debug message with no parameters");
  logger.trace("This is a trace message with no parameters");
  log.removeFirst(Logger.Level.ERROR, "This is an error message with no parameters");
  log.removeFirst(Logger.Level.WARNING, "This is a warning message with no parameters");
  assertEquals(false, log.hasEvents());
}

相关文章